NexusFi: Find Your Edge


Home Menu

 





Hull Moving Average Strategy


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one donmat with 6 posts (1 thanks)
    2. looks_two ABCTG with 5 posts (0 thanks)
    3. looks_3 Meytar Savir with 2 posts (0 thanks)
    4. looks_4 futuros with 1 posts (2 thanks)
    1. trending_up 8,095 views
    2. thumb_up 5 thanks given
    3. group 12 followers
    1. forum 16 posts
    2. attach_file 0 attachments




 
Search this Thread

Hull Moving Average Strategy

  #1 (permalink)
donmat
Chicago Illinois USA
 
Posts: 7 since Jul 2017
Thanks Given: 0
Thanks Received: 1

Looking for Easy Language Strategy the will Buy or Sell when the Hull MA changes direction.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
Better Renko Gaps
The Elite Circle
Increase in trading performance by 75%
The Elite Circle
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
My NQ Trading Journal
12 thanks
  #3 (permalink)
donmat
Chicago Illinois USA
 
Posts: 7 since Jul 2017
Thanks Given: 0
Thanks Received: 1


I found this code from about 10 years ago. Originally it didn't work because i think i had the function in the wrong place. I would be using this strategy when I already have an existing position. I would like to add a Stop to the strategy so I could exit the position if the Hull MA changes direction or the Stop is hit - which ever comes 1st.

inputs: price(Close), jthmaLength( 21 ), upColour(Blue), downColour(Red);

variables: Avg(0), colour(0);



Avg = jthma( price, jthmaLength ) ;



if Avg > Avg[1] then colour = upColour;

if Avg < Avg[1] then colour = downColour;



{buy sell Criteria}



if colour[1] <> colour then

if colour = upColour then

Buy ( "jup" ) next bar at market ;



if colour[1] <> colour then

if colour = downColour then

sell ( "jdn" ) next bar at market ; {original this line is: sell short ( "jdn" ) next bar at market ; }


















#function jtHMA
{jtHMA - Hull Moving Average Function}
{Author: Atavachron}
{May 2005}

Inputs: price(NumericSeries), length(NumericSimple);
Vars: halvedLength(0), sqrRootLength(0);

{
Original equation is:
---------------------
waverage(2*waverage(close,period/2)-waverage(close,period), SquareRoot(Period)
Implementation below is more efficient with lengthy Weighted Moving Averages.
In addition, the length needs to be converted to an integer value after it is halved and
its square root is obtained in order for this to work with Weighted Moving Averaging
}

if ((ceiling(length / 2) - (length / 2)) <= 0.5) then
halvedLength = ceiling(length / 2)
else
halvedLength = floor(length / 2);

if ((ceiling(SquareRoot(length)) - SquareRoot(length)) <= 0.5) then
sqrRootLength = ceiling(SquareRoot(length))
else
sqrRootLength = floor(SquareRoot(length));

Value1 = 2 * WAverage(price, halvedLength);
Value2 = WAverage(price, length);
Value3 = WAverage((Value1 - Value2), sqrRootLength);

jtHMA = Value3;

Reply With Quote
Thanked by:
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Hi donmat,

you could add the build in Stop Loss strategy together with your strategy to the same chart. This way the stop could exit an open position that the hull strategy created.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #5 (permalink)
donmat
Chicago Illinois USA
 
Posts: 7 since Jul 2017
Thanks Given: 0
Thanks Received: 1

The up and down signals show up on the chart and I can run backtests but the strategy isn't executing any trades on the OEC Trader demo platform. Called tech support and they said something is wrong with the script then.

Reply With Quote
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Hi donmat,

can you get any of the build in strategies to execute live in the OEC demo?

Regards,

ABCTG


donmat View Post
The up and down signals show up on the chart and I can run backtests but the strategy isn't executing any trades on the OEC Trader demo platform. Called tech support and they said something is wrong with the script then.


Follow me on Twitter Reply With Quote
  #7 (permalink)
donmat
Chicago Illinois USA
 
Posts: 7 since Jul 2017
Thanks Given: 0
Thanks Received: 1

This is the only one i tried

Reply With Quote
  #8 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Hi donmat,

I would suggest testing this to rule out any setting related issues.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #9 (permalink)
donmat
Chicago Illinois USA
 
Posts: 7 since Jul 2017
Thanks Given: 0
Thanks Received: 1

Apparently I had some of the boxes in the Strategy Manager wrong. Looks like the strategy works. As I said I would be using this strategy to exit existing positions and would only want it executed once. So then should i use " If entriestoday=0 then buy or sell " ?

Reply With Quote
  #10 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


Hi donmat,

depending on how entriestoday works within OEC, this might allow one trade per day. If you want the order to be executed just once, you could use a boolean variable that you set to true when you declare and initialize it. Then you only allow your orders when this variable is true and set it to false when you trigger your order. This would only allow the order to be triggered once.

Regards,

ABCTG


donmat View Post
Apparently I had some of the boxes in the Strategy Manager wrong. Looks like the strategy works. As I said I would be using this strategy to exit existing positions and would only want it executed once. So then should i use " If entriestoday=0 then buy or sell " ?


Follow me on Twitter Reply With Quote




Last Updated on January 23, 2022


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts