Trend Chaser Stop Loss
Forums › ProRealTime English forum › ProOrder support › Trend Chaser Stop Loss
- This topic has 5 replies, 2 voices, and was last updated 8 years ago by Nicolas.
-
-
03/12/2016 at 12:14 AM #3599
I would like some assistance please, to code the stop losses for this system. My idea is that when it takes a trade, say long, it will look back from the entry bar until it finds the previous swing low that is below the low of the entry bar. If there isn’t one within say 100 bars, it will not take the trade.
If it finds one, it will set the stop loss at 5 pips below it.
As the bar closes progress up, the system will then continue to move the stop loss to the next swing low until the close of a bar is above the Super Trend. The Super Trend will then become the stop loss and the close of the trade.
Of course, the reverse will apply for the short trades.
I have attached my code to date. Any comments on that would also be appreciated.
1234567891011121314151617181920212223242526272829303132333435363738394041424344// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// IndicatorsCOI = CALL "MGC-Coppock"[14, 11, 10](close)MAC = MACDline[12,26,9](close)STO = Stochastic[14,3](close)ST = Supertrend[3.2,22]// Conditions to enter long positionsc1 = COI > COI[1] AND COI < 0c2 = MAC > MAC[1]c3 = STO crosses over 20IF c1 AND c2 AND c3 THENBUY 1 CONTRACT AT MARKETENDIF// Conditions to exit long positionsc5 = close crosses under STIF c5 THENSELL AT MARKETENDIF// Conditions to enter short positionsc11 = COI < COI[1] AND COI > 0c12 = MAC < MAC[1]c13 = STO crosses under 80IF c11 AND c12 AND c13 THENSELLSHORT 1 CONTRACT AT MARKETENDIF// Conditions to exit short positionsc15 = close crosses over STIF c15 THENEXITSHORT AT MARKETENDIF//Stops and Targets03/12/2016 at 5:43 PM #360703/12/2016 at 11:25 PM #361203/12/2016 at 11:26 PM #361303/13/2016 at 12:04 AM #3616Nicolas, the main reason I think the stop loss is appropriate is that my indicators sometimes give a false signal, a you will see if you run it on the EURAUD. I have attached the pdf showing an excellent trade that was missed. I have run this example for the year from 12/3/15 to 12/3/16.
Would you like to escalate this to the Programming Services level, as I am happy to pay for your expert advice?
Best regards,
Mike
03/13/2016 at 8:09 AM #3618Mike, thanks for the files. I’ll investigate them and get back to you on Monday. For the progamming services purpose you can join me directly at prog@prorealcode.com
-
AuthorPosts
Find exclusive trading pro-tools on