GBPUSD 4H Force_Indicator Strategy
Forums › ProRealTime English forum › ProOrder support › GBPUSD 4H Force_Indicator Strategy
- This topic has 2 replies, 3 voices, and was last updated 5 years ago by
GraHal.
Viewing 3 posts - 1 through 3 (of 3 total)
-
-
06/18/2020 at 12:25 PM #136156
Hello everyone, this is my first strategy, based on the FORCE INDICATOR applied to GBPUSD timeframe 4H.
The code is a draft that provides entry rules, trailing stops and money management.
I submit it to your attention for corrections and integrations of improvements and suggestions.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149// Force indicator Strategy - GBPUSD timefrsme 4H// Concept Indicator by jebus89// Coding Indicator by Vonasi// Strategy by Maurizio AngiusDEFPARAM CumulateOrders = falseDEFPARAM Preloadbars = 1000//************************************************************************// Indicator//p = period used for the average//AveType = 0 to 6 --- 0=SMA 1=EMA 2=WMA 3=Wilder 4=Triangular 5=End point 6=Time series//STDstart = first STD of average to be used//STDmax = maximum STD of average to be used//STDstep = Step levels of STD usedSTDstart = 0.1STDmax= 10STDstep = 0.1if close > Average[p, AveType](close) thena = STDstartforce = 0while a <= STDmaxif close > Average[p, AveType](close) + a*std[p](close) thenforce = force + 1a = a + STDstepelsebreakendifwendendifif close < Average[p, AveType](close) thena = -STDstartforce = 0while a >= -STDmaxif close < Average[p, AveType](close) + a*std[p](close) thenforce = force - 1a = a - STDstepelsebreakendifwendendifONCE NbBarLimit = 10//************************************************************************// Money ManagementCapital = 1000Risk = 0.01StopLoss = SLequity = Capital + StrategyProfitmaxrisk = equity * RiskMinSize = 1PositionSize = max(MinSize, (maxrisk/StopLoss))//************************************************************************// entry long conditionl1 = force[2] = 0l2 = force[1] > force[2]IF l1 and l2 THENMyLimitBuy = highMyIndex = BarindexENDIFIF BarIndex >= MyIndex + NbBarLimit THENMyLimitBuy = 0ENDIFIF MyLimitBuy > 0 AND NOT LongOnMarket THENBUY PositionSize CONTRACT AT MyLimitBuy STOPSet Stop Loss abs(close - lowest[20](low))SL = abs(close - lowest[20](low))/POINTSIZEENDIF//************************************************************************// entry short conditions1 = force[2] = 0s2 = force[1] < force[2]IF s1 and s2 THENMyLimitSell = lowMyIndex = BarindexENDIFIF BarIndex >= MyIndex + NbBarLimit THENMyLimitSell = 0ENDIFIF MyLimitSell > 0 AND NOT ShortOnMarket THENSELLSHORT PositionSize CONTRACT AT MyLimitSell STOPSet Stop Loss abs(close - highest[20](high))SL = abs(close - highest[20](high))/POINTSIZEENDIF//************************************************************************//trailing stop functiontrailingstart = Tstart //trailing will start @trailinstart points profittrailingstep = 5 //trailing step to move the "stoploss"//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+trailingstep*pipsizeENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsizeENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THENnewSL = tradeprice(1)-trailingstep*pipsizeENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep*pipsize THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF//************************************************************************06/18/2020 at 2:11 PM #136438Thank you for sharing.
I think it will be of interest to many of us in this community.
06/18/2020 at 3:01 PM #136462 -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
Find exclusive trading pro-tools on
Similar topics: