Heiken Ashi Smoothed Cloud – Day Trading System
Forums › ProRealTime English forum › ProOrder support › Heiken Ashi Smoothed Cloud – Day Trading System
- This topic has 11 replies, 4 voices, and was last updated 3 years ago by SB-FO.
-
-
03/03/2021 at 4:45 PM #162998
With the help of the community (Nonetheless, Nicolas, & Vonasi) I was able to turn the smoothed Heiken Ashi smoothed : Forum ProBuilder support – ProRealTime (prorealcode.com) from the blog into an equity strategy. I typically trade the leveraged small cap ETF TNA in the USA and so the backtest is on it.
I had luck going back 3 years on a 5 minute chart, but could not get to perform in other timeframes or longer and shorter horizons. I think something is here, but t needs works and I am open to ideas. I am thinking good meat, need sauce…
Code below and attached.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364DEFPARAM CumulateOrders = False // Cumulating positions deactivatedDEFPARAM FLATBEFORE = 093000DEFPARAM FlatAfter = 154500capital = 100000 + strategyprofitEquity = capital / closemyCurrentProfit = STRATEGYPROFITPrice = CustomClose//t and the deviation of the mean://t = 0 = average // Simple//t = 1 = exponentialaverage//t = 2 = weightedaverage//t = 3 = wilderaverage//t = 4 = triangularaverage//t = 5 = endpointaverage//t = 6 = timeseriesaverage//t = 7 = Hull (PRT v11 only)//t = 8 = ZeroLag (PRT v11 only)P = 19 // pP1 = 14 // p1T = 5 // endpointaverageT1 = 4 // triangularaverageif barindex > p + 1 thenmo = average[p,t](open)mc = average[p,t](close)ml = average[p,t](low)mh = average[p,t](high)//endifonce haopen=mohaclose=(mo+mc+ml+mh)/4haopen=(haopen[1]+haclose[1])/2endifHAopen1 = average[p1,t1](haopen)HAclose1 = average[p1,t1](haclose)// Draw indicatorGraph HAclose1 COLOURED(34,139,3) AS "Heiken Smoothed Cloud Open"Graph HAopen1 COLOURED(225,0,0) AS "Heiken Smoothed Cloud Close"// Conditions to enter long positionsIF NOT LongOnMarket AND HAopen1 Crosses Over HAclose1 THENBUY Equity SHARES AT MARKETENDIF// Conditions to exit long positionsIf LongOnMarket AND HAopen1 Crosses Under HAclose1 THENSELL AT MARKETENDIF////Conditions to enter short positionsIF NOT ShortOnMarket AND HAopen1 Crosses Under HAclose1 THENSellshort Equity SHARES AT MARKETENDIF// Conditions to exit short positionsIF ShortOnMarket AND HAopen1 Crosses Over HAclose1 THENEXITSHORT AT MARKETENDIF2 users thanked author for this post.
03/03/2021 at 5:25 PM #163064If I were you I’d try to re-optimize it for a major index – DJ or NASDAQ for example. Low liquidity on TNA means the spread is enormous and the margin requirement comparatively high.
Attached is a quick test with your MM switched off and Spread = 2. Position size = 20, roughly equivalent margin to $1 on the DJI
03/03/2021 at 5:59 PM #163068Actually you can ignore the result I attached as I forgot to alter the time settings for the UK. Running it on Wall St hours is better, but not great.
I think the spread is too high to make this work on that ETF.
03/03/2021 at 6:35 PM #163069I did not think of the spread as I normally trade on 4H charts and thus the spreads don’t bother me much as I’m not trying to pluck small gains, instead stay in a trade for days and catch the swing.
As I said prior, I like the idea of HA Cloud but it needs additional coding to work. I was my first code I have published.
03/06/2021 at 1:57 AM #163252@SB-FO thanks for publishing.
I ran it in ORT layout (optimised in step2), for 100k. Dow 1m. long&short, 0.25%sl
Added a criteria to reduce number of trades. I like to use i.e. close>totalprice
The thing is, disabling short shows a poor performance for long, disabling long shows a good result for short. Together they have the best results.
Here are results on 200k on step4. Don’t ditch your setup just yet. Above you have your ingredient for the sauce 🙂
03/06/2021 at 3:17 AM #163256looking at the charts, it’s pretty annoying that using a profittarget limits it’s potential. (I used sl* 1.5 in optimisation)
Optimising the ts unleashed extra performance while removing the pt.
Basically it makes sense. A wave of moving averages are always lagging, so if a wave start to move down, generally the index is already down the average. If the additional criteria happens there is enough room for an upswing with a low risk. You are then profiting from fake signals.
03/06/2021 at 3:07 PM #163299there’s still room for improvement.
2 bad days stood out, dec 31 and nov 03 us election
Ignoring those 2 days and looking at the start& endtime improved it further. Check the stoplos for both up to 0.5%
So it was optimised (core) on 100k and values applied on 200k I didn’t use the equitypart and it’s all based on 1 positionsize.
There is still doubt, why are results in months (besides november) different on 100k compared to 200k. Probably because a once function and could be a problem.
Anyway I hope this is a reason to look at the ORT layout because on that idea there was not much interest and the strategy posted by the SB-FO .
03/15/2021 at 9:25 PM #164267All, thanks for your feedback and my apologies for not responding sooner. It is ski season here in Utah and that keeping me fit.
Anyway, Paul, thanks for your input. Could you be so kind and post your revises code.
I’ll be posting another strategy which is also promising.
SB-FO
03/16/2021 at 4:15 AM #164284Hi, that’s a nice way to keep fit! Here’s one that is optimised on up to 200k dow 1minute. It really shows if loading it on 1M bars.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687defparam cumulateorders = falsedefparam preloadbars = 2000ONCE a1 = 50ONCE a2 = 40ONCE a3 = 6once a4 = 8once positionsize=1// excluding trading daysif year=2020 and month=11 and day=3 then // election ustradeday = 0elsif month=12 and day=31 thentradeday = 0elsetradeday = 1endif// strategy//t and the deviation of the mean://t = 0 = average // Simple//t = 1 = exponentialaverage//t = 2 = weightedaverage//t = 3 = wilderaverage//t = 4 = triangularaverage//t = 5 = endpointaverage//t = 6 = timeseriesaverage//t = 7 = Hull (PRT v11 only)//t = 8 = ZeroLag (PRT v11 only)P = a1 // pP1 = a2 // p1T = a3 // endpointaverageT1 = a4 // triangularaverageif barindex > p+1 thenmo = average[p,t](open)mc = average[p,t](close)ml = average[p,t](low)mh = average[p,t](high)//endifhaopen=mohaclose=(mo+mc+ml+mh)/4haopen=(haopen[1]+haclose[1])/2endifHAopen1 = average[p1,t1](haopen)HAclose1 = average[p1,t1](haclose)condbuy =HAopen1 Crosses Over HAclose1 and close>totalprice and close[1]<totalprice[1]condsell=HAopen1 Crosses Under HAclose1 and close<totalprice and close[1]>totalprice[1]//ctime = time >= 060500 and time < 215400ctime = ctime and tradeday// entryif ctime thenif condbuy thenbuy positionsize contract at marketset stop %loss 0.5set target %profit 0.75elsif condsell thensellshort positionsize contract at marketset stop %loss 0.5set target %profit 0.75endifendif//if dayofweek=5 and opentime>=215400 thensell at marketexitshort at marketendif//if positionperf(0)*100>0.4 thenif haclose1 crosses over haopen1 thenexitshort at marketendifif haclose1 crosses under haopen1 thensell at marketendifendif3 users thanked author for this post.
03/16/2021 at 9:20 PM #16438303/17/2021 at 11:50 AM #164453Thank you very much for sharing this strategy with us, it looks very promising and the overfit risk is really low as log as this is a simple stragegy without indicators (assumming that Heiken Ashi is not an indiciator).
I wonder if it could be interesting to include a vectorial component to this strategy, for example the angle and slope of the crossing between the upper and the lower Heiken Ashi Clould lines in order to avoid false signals when the angle is not big enough. What do you think? I’ll try to program this vectorial Heikin Cloud by myself but as long as my programming skills are very limited, maybe someone wants to take a step ahead and program it by him/herself and could share it whith us.
03/17/2021 at 3:23 PM #164498Ryugin, that is a great idea. I have thought of using the slop curve / crossing, alas my coding skills are not good enough to know how to do that. Perhaps indeed another member of the community can help out. Nicolas & Vonasi might have some insights.
Cheers, SB-FO
-
AuthorPosts
Find exclusive trading pro-tools on