Trend Chaser Stop Loss
- This topic has 5 replies, 2 voices, and was last updated 9 years ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
Similar topics:
Forums › ProRealTime English forum › ProOrder support › Trend Chaser Stop Loss
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.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
// Definition of code parameters DEFPARAM CumulateOrders = False // Cumulating positions deactivated // Indicators COI = 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 positions c1 = COI > COI[1] AND COI < 0 c2 = MAC > MAC[1] c3 = STO crosses over 20 IF c1 AND c2 AND c3 THEN BUY 1 CONTRACT AT MARKET ENDIF // Conditions to exit long positions c5 = close crosses under ST IF c5 THEN SELL AT MARKET ENDIF // Conditions to enter short positions c11 = COI < COI[1] AND COI > 0 c12 = MAC < MAC[1] c13 = STO crosses under 80 IF c11 AND c12 AND c13 THEN SELLSHORT 1 CONTRACT AT MARKET ENDIF // Conditions to exit short positions c15 = close crosses over ST IF c15 THEN EXITSHORT AT MARKET ENDIF //Stops and Targets |
Nicolas, 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
Mike, 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
Find exclusive trading pro-tools on 