How to code HMA Crossover Strategy?

clbradley17

Junior member
Messages
25
Likes
0
If I wanted to use the Hull Moving Average (jtHMA) for the crossover strategy instead of a simple or exponential moving average crossover strategy, what would I need to put in say for a fast length jtHMA(10) and a slow length jtHMA (20) with similar parameters as above, if fast avg jtHMA crosses above slow avg jtHMA then buy next bar after lines cross at open of bar, and SellShort if reverse, and want to be able to use the displace feature if possible to displace the jtHMAs +1, 2, or 3, going to test to see what works better. Also, is there a way to buy intrabar after crossing, and what other coding would need to be put in to use this on a 30 or 60 min. timeframe? Thanks for any help.

Curtis
 
I'll try to be a little clearer. If I wanted to use the Hull Moving Average (jtHMA) for a crossover strategy instead of a simple or exponential moving average crossover strategy, how would it be coded in Easy Language for a fast length jtHMA(10) and a slow length jtHMA (20) with parameters that if fast avg jtHMA crosses above slow avg jtHMA then BuyLong 100 shares next bar at market, and SellShort if reverse, and would like to be able to displace the jtHMAs + or -1, 2, or 3, and will be using this on a 30 or 60 min. timeframe?

Also, is it possible, or even necessary, to put within the strategy a buy/sellshort order with a pre-set stoploss? Possibly something like:

If conditions are met for fast jtHMAavg crosses slow jtHMAavg, then begin;
buy/sellshort 100 shares next bar at market;
SetProfitTarget(1000);
SetStopLoss( 100);
end;

This is going to be my first time using a strategy, and want to backtest it, haven't tried that and not sure how to figure it in for possible flaws and slippage for backtesting in Tradestation. I'm going to use it on a 2x or 3x Proshares or Direxion index fund, and the position will reverse immediately when the jtHMAs cross on the next bar after the cross, from long to sellshort, or vice-versa. Not sure if that brings more problems, the instant reversal.


Thanks for any help.

Curtis
 
Top