Forums › ProRealTime English forum › ProOrder support › profit reduces by 33% › Reply To: profit reduces by 33%
05/09/2018 at 5:31 PM
#70091
I ran the following code. I expect the system should stop out either 99 GBP loss or 90 GBP minimum profit or more
results attached ( why the system stopped out 49.8 gbp loss)
code
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 |
//------------------------------------------------------------------------- // Main code : 3secsell(2) //------------------------------------------------------------------------- defparam cumulateorders = false DEFPARAM Preloadbars = 2000 DEFPARAM flatafter = 205900 //startBreakeven = y//how much pips/points in gain to activate the breakeven function? //PointsToKeep = x//how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread) ctime1 = time > 161500 and time < 162500 x=2 IF not onmarket and ctime1 THEN sellshort .5 perpoint at market ENDIF Set stop loss 99 ret=.1 IF Not OnMarket THEN y = 0 ENDIF IF shortonMarket AND close < (TradePrice - (y * pipsize)) THEN x = (tradeprice-close) / pipsize //convert price to pips IF x >=98 then//go ahead only if 30+ pips y = max(x * ret, y) //y = 66.6% of max profit ENDIF ENDIF IF y THEN //Place pending LIMIT (not STOP) order when y>0 exitshort AT Tradeprice - (y * pipsize) stop //convert pips to price ENDIF Set stop loss 99 |