Forums › ProRealTime English forum › ProRealTime platform support › Stop loss not triggered on automatic trading system › Reply To: Stop loss not triggered on automatic trading system
08/14/2018 at 8:16 AM
#78123
Hey, here’s the code for a system I’m running on the DAX 4H timeframe. I was thinking, can it have anything to do with the space between the lines of text? Because this is exactly how the code is written in PRT. It does look a bit messy maybe.
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 |
Defparam FlatBefore = 125500 Defparam FlatAfter = 170000 xClose = (Open+High+Low+Close)/4 if(barindex>2) then xOpen = (xOpen[1] + xClose[1])/2 endif c1 = xClose>xOpen AND xClose[1]<xOpen[1] c2 = xClose<xOpen AND xClose[1]>xOpen[1] if c2 AND Not LongOnMarket then BUY 1 SHARE AT MARKET EXITSHORT AT MARKET endif if c1 AND Not ShortOnMarket then SELLSHORT 1 SHARE AT MARKET SELL AT MARKET endif SET STOP $TRAILING 20 set target pprofit 40 |