| Automated Trading Black box systems, strategy automation, algorithmic trading, etc... |
![]() | | Tweet | |
| | #1 | ||
![]() | Need Help with Hull MA Crossover Strategy 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 | ||
| |
|
| | #2 | ||
![]() | Re: Need Help with Hull MA Crossover Strategy Quote:
Curtis You mention you would like to displace 1,2 or 3...... the displace feature is only affected on where to plot the lines..... the actual real time values are the same, all the displace feature does is move the lines back x amount of bars. With regards to your strategy, here's a code that should get you started... Inputs: FastLength(10), SlowLength(20); Vars: FastAvg(0),SlowAvg(0); FastAvg = jTHMA(Close,FastLength); SlowAvg = jTHMA(Close,SlowLength); If FastAvg crosses above SlowAvg then buy 100 shares next bar at market; If FastAvg crosses below SlowAvg then sellshort 100 shares next bar at market; SetProfitTarget(1000); SetStopLoss( 100); Hope this helps Blu-Ray
__________________ “ Search is the ultimate expression of the power of the individual, using a computer, looking at the world, and finding exactly what they want ” – Eric Schmidt, Google | ||
| |
|
| | #3 | ||
![]() | Re: Need Help with Hull MA Crossover Strategy Curtis | ||
| |
|
| | #4 | ||
![]() | Re: Need Help with Hull MA Crossover Strategy at the end? Thanks for any more info, especially on the time issue.Curtis | ||
| |
|
| | #5 | ||
![]() | Re: Need Help with Hull MA Crossover Strategy Quote:
The code will work on any timeframe, just insert the strategy onto the relevant chart and it will work. There's no need to use the word "end" on that code, you only use the word end if the true/ false condition is to specify more than one outcome and then you would have to use the word "begin" as well. Here's an example..... This is to specify only one outcome.... to plot something If FastAvg crosses above SlowAvg then Plot1(High,"Long"); _________________________ ______________________ This is to specify two outcomes... to plot & also to alert. If FastAvg crosses above SlowAvg then begin Plot1(High,"Long"); Alert("CrossOver Long"); end; Hope this helps Blu-Ray
__________________ “ Search is the ultimate expression of the power of the individual, using a computer, looking at the world, and finding exactly what they want ” – Eric Schmidt, Google | ||
| |
|
| | #6 | ||
![]() | Re: Need Help with Hull MA Crossover Strategy FastAvg = jTHMA(Close,FastLength); SlowAvg = jTHMA(Close,SlowLength); with SMA or EMA, instead of jtHMA? Thanks again for all your help. Curtis | ||
| |
|
| | #7 | ||
![]() | Re: Need Help with Hull MA Crossover Strategy Quote:
You just need to insert a start & endtime to the code.... so it would like this.... Inputs: FastLength(10), SlowLength(20), StartTime(0930),EndTime( 1600 ); Vars: FastAvg(0),SlowAvg(0); FastAvg = jTHMA(Close,FastLength); SlowAvg = jTHMA(Close,SlowLength); If Time > StartTime and Time < EndTime then begin If FastAvg crosses above SlowAvg then buy 100 shares next bar at market; If FastAvg crosses below SlowAvg then sellshort 100 shares next bar at market; end; SetProfitTarget(1000); SetStopLoss( 100); SetExitOnClose; With regards to changing the type of moving average, yes just replace the jTHMA with xaverage for EMA or average for SMA. Hope this helps Blu-Ray
__________________ “ Search is the ultimate expression of the power of the individual, using a computer, looking at the world, and finding exactly what they want ” – Eric Schmidt, Google | ||
| |
|
| | #8 | ||
![]() | Re: Need Help with Hull MA Crossover Strategy Curtis | ||
| |
|
![]() |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with Creating a 9/30 Crossover Paintbar Indicator | Disco Scottie | Coding Forum | 3 | 12-13-2010 04:38 AM |
| Hull Moving Average Strategy | Minetoo | Trading Indicators | 25 | 07-02-2009 05:23 PM |
| DMI Crossover for Charts, Radarscreen | clbradley | Coding Forum | 4 | 01-29-2009 09:18 AM |
| Hull MACD | Minetoo | Coding Forum | 12 | 11-07-2007 04:10 PM |
| MACD with Hull Moving Averages | Soultrader | Trading Indicators | 2 | 09-06-2007 05:52 PM |