how to automate a successful manual system
Forums › ProRealTime English forum › General trading discussions › how to automate a successful manual system
- This topic has 57 replies, 16 voices, and was last updated 3 years ago by Jan.
-
-
11/04/2020 at 8:48 PM #149486
@ nonetheless
I wrote your method in backtest
Hull 13 Backtest123456789101112131415161718192021Defparam cumulateorders = falseonce p=13Hull= Weightedaverage[round(SQRT(p))]( 2*Weightedaverage[round(p/2)](close)-Weightedaverage[p](close))c1 = HULL > HULL[1] and HULL[1]<HULL[2]c2 = HULL < HULL[1] and HULL[1]>HULL[2]if c1 and not longonmarket thenbuy 1 share at marketendifif c2 thensell at marketendifif c2 and not onmarket thensellshort 1 share at marketendifif shortonmarket and c1 thenexitshort at marketendifset stop ploss 75set target pprofit 5011/04/2020 at 10:12 PM #149489yes, but why 144 seconds, and why only 1 day of backtest?
11/04/2020 at 10:13 PM #14949011/04/2020 at 10:15 PM #149491why only 1 day of backtest?
We have to fit to another TF for the next day!? 🙂
11/05/2020 at 5:51 AM #149500@nonetheless, tried to incorporate also your HULL 34 idea using bollinger%
I simply pick 10s (no reason, just any small TF to handle quick decision like manual trade), result seems ok, however just 1 week of data, for sure need forward test. But maybe you can see if the trade quality is close to your expectation.
Many variables are just simply out of heart, only the gap is optimized.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133// Definition of code parametersDEFPARAM CumulateOrders = false // Cumulating positions deactivatedDEFPARAM preloadbars = 5000Ctime = time >= 080000 and time <= 163000//HULL 13TIMEFRAME(2 minutes)Period13 = 13inner13 = 2*weightedaverage[round( Period13/2)](close)-weightedaverage[Period13](close)HULL13 = weightedaverage[round(sqrt(Period13))](inner13)C1 = HULL13 > HULL13[1] and HULL13[1] < HULL13[2]C2 = HULL13 < HULL13[1] and HULL13[1] > HULL13[2]//ATR 13atr13 = AverageTrueRange[Period13](close)//HULL13min = MIN(HULL13, HULL13[1])//HULL13min = MIN(HULL13min, HULL13[2])//HULL13max = MAX(HULL13, HULL13[1])//HULL13max = MAX(HULL13max, HULL13[2])gap = 1.2C3 = close > HULL13 + gap * atr13C4 = close < HULL13 - gap * atr13//HULL 34Period34 = 34strend = 2inner34 = 2*weightedaverage[round( Period34/2)](typicalprice)-weightedaverage[Period34](typicalprice)HULL34 = weightedaverage[round(sqrt(Period34))](inner34)STDDEVtrend = STD[Period34]bollstrend = strend * STDDEVtrendbolltrendUP = HULL34 + bollstrendbolltrendDOWN = HULL34 - bollstrendIF bolltrendUP = bolltrendDOWN THENbolltrendPercent = 50ELSEbolltrendPercent = 100 * (close - bolltrendDOWN) / (bolltrendUP - bolltrendDOWN)ENDIFC5 = bolltrendPercent > 55 AND bolltrendPercent > bolltrendPercent[1] AND bolltrendPercent[1] > bolltrendPercent[2]C6 = bolltrendPercent < 45 AND bolltrendPercent < bolltrendPercent[1] AND bolltrendPercent[1] < bolltrendPercent[2]C7 = 1 //bolltrendPercent > 45 OR bolltrendPercent > bolltrendPercent[1]C8 = 1 //bolltrendPercent < 55 OR bolltrendPercent < bolltrendPercent[1]TIMEFRAME(default)SL = 0.5// Conditions to enter long positionIF NOT OnMarket AND Ctime AND close > open AND C1 AND C3 AND NOT C6 AND C7 THENBUY 1 CONTRACTS AT MARKETSET STOP %LOSS SL//SET TARGET %PROFIT SLENDIF// Conditions to exit long positionsIf LongOnMarket AND C2 AND C6 AND close > POSITIONPRICE THENSELL AT MARKETENDIF//If LongOnMarket AND C2 AND C6 AND close < POSITIONPRICE THEN//SELL AT MARKET//ENDIF// Conditions to enter short positionsIF NOT OnMarket AND Ctime AND close < open AND C2 AND C4 AND NOT C5 AND C8 THENSELLSHORT 1 CONTRACTS AT MARKETSET STOP %LOSS SL//SET TARGET %PROFIT SLENDIF// Conditions to exit short positionsIF ShortOnMarket AND C1 AND C5 AND close < POSITIONPRICE THENEXITSHORT AT MARKETENDIF//IF ShortOnMarket AND C1 AND C5 AND close > POSITIONPRICE THEN//EXITSHORT AT MARKET//ENDIF//// Stops and targets : Enter your protection stops and profit targets here//====== Trailing Stop mechanism - start =====stepfactor1 = 0.5stepfactor2 = 0.05trailingstart = (stepfactor1 * SL/100 * tradeprice(1) ) / pointsizetrailingstep = (stepfactor2 * SL/100 * tradeprice(1) ) / pointsize//resetting variables when no trades are on marketif not onmarket thenpriceexit = 0endif//case LONG orderif longonmarket then//first move (breakeven)IF priceexit=0 AND close-tradeprice(1) >= trailingstart*pointsize THENpriceexit = tradeprice(1) + trailingstep*pointsizeENDIF//next movesIF priceexit>0 THENpriceexit = priceexit + trailingstep*pointsizeENDIFendif//case SHORT orderif shortonmarket then//first move (breakeven)IF priceexit=0 AND tradeprice(1)-close >= trailingstart*pointsize THENpriceexit = tradeprice(1) - trailingstep*pointsizeENDIF//next movesIF priceexit>0 THENpriceexit = priceexit - trailingstep*pointsizeENDIFendifif longonmarket and priceexit>0 thensell at priceexit stopif low crosses under priceexit thensell at marketendifendifif shortonmarket and priceexit>0 thenexitshort at priceexit stopif high crosses over priceexit thenexitshort at marketendifendif//====== Trailing Stop mechanism - end =====1 user thanked author for this post.
11/05/2020 at 9:39 AM #149512looks interesting, but 10 seconds is too short for me. Not enough backtest to run on auto and manually there’d be too many false signals, chopping and changing.
Decent result for those few days though…
11/05/2020 at 10:04 AM #14951411/05/2020 at 10:09 AM #149515The unity of time is the second. I intended to work with 3 different TF .
144 sec is the only Fibonacci number when multiplier with 5 that gives round numbers:
144*5 (720 sec or 12 min)
144* 5², (3600 sec or 60 min or 1 hour)
144*5³ (18000 sec or 300 min or exactly 5 hours)
……..
1 user thanked author for this post.
11/05/2020 at 11:06 AM #149520signal is at 2 minutes TF. 10s is execution time frame…
Works good on DJI at signal 1 min TF and 5 sec execution over 100k bars.
Thank you for sharing Dow Jones.
11/05/2020 at 11:35 AM #14952211/05/2020 at 12:20 PM #14952811/05/2020 at 12:26 PM #149529I tried to set up the net and reverse simultaneously trade and can’t see how to do it. I tested it in a live trade set to net off, and clicked to place a reverse order and it closed the existing position but didn’t open a new one.
I’m with IG and just called support who said it wasn’t possible but agreed it was a valid suggestion and would try to include it at some point. Any ideas welcome, cheers!
1 user thanked author for this post.
11/05/2020 at 1:02 PM #149530Here you go Josef … a v1 of Zigo’s code (v0) above.
It might be an alternative to use Hull(34) as a Filter then it nearer to Nonetheless manual strategy?
I quickly added simple MA and it worked so I set it going on Demo Forward Test! 🙂
123456789101112131415161718192021222324252627//-------------------------------------------------------------------------// Main code : ZigoNone DJI S144 v1//-------------------------------------------------------------------------Defparam cumulateorders = falseP = 13A7 = 10A14 = 70Hull= Weightedaverage[round(SQRT(p))]( 2*Weightedaverage[round(p/2)](close)-Weightedaverage[p](close))c1 = HULL > HULL[1] and HULL[1]<HULL[2]c2 = HULL < HULL[1] and HULL[1]>HULL[2]if c1 and Close > Average[A7](close) thenbuy 1 share at marketendif//if c2 then//sell at market//endifif c2 and Close < Average[A14](close) thensellshort 1 share at marketendif//if shortonmarket and c1 then//exitshort at market//endif//set stop ploss 75//set target pprofit 502 users thanked author for this post.
11/05/2020 at 4:31 PM #149551144 sec is the only Fibonacci number when multiplier with 5 that gives round numbers:
interesting to use a Fibonacci relation with TFs, hadn’t thought of that.
Shame that, even though 144 secs is longer than 2mins, a 200k backtest is only 5 days as opposed to 13 months. Another weird quirk of PRT .
11/06/2020 at 2:20 PM #149680The only reason that I use irregular TF is, that the entire world use regular TF.
B.t.w. the code for Hull (13) with arrows (used in the main frame)
Hull 131234567891011once p=13H13=Weightedaverage[round(SQRT(round(0.89*p)))]( 2*Weightedaverage[round(round(0.89*p)/2)](close)-Weightedaverage[round(0.89*p)](close))c1 = H13 > H13[1] and H13[1]<H13[2]c2 = H13 < H13[1] and H13[1]>H13[2]if c1 thenDRAWARROWUP(barindex, low-AverageTrueRange[14](close))coloured(0,255,0,255)elsif c2 thenDRAWARROWDOWN(barindex, high +AverageTrueRange[14](close))coloured(255,0,0,255)endifreturn H13 as"Hull 13"B.t.w.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on