Forums › ProRealTime English forum › ProOrder support › Candlestick Scalper 1s discussion › Reply To: Candlestick Scalper 1s discussion
04/14/2020 at 9:10 AM
#126039
i wil try.. i’m confused
the test..
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
//------------------------------------------------------------------------- // Code principal : CANDLE //------------------------------------------------------------------------- Defparam cumulateorders = false n =1 timeframe(15 minute,updateonclose) c160m = open > open[1] and close > close[1] and close > open timeframe(1 minute,updateonclose) c11m = open > open[1] and close > close[1] c21m = abs(close-open) >= 17 c31m = abs(close[1]-open[1]) c41m = c31m > c21m timeframe(default) c1def = open > open[1] and close > close[1] c2def = abs(close-open) >= 1 IF not longonmarket and c1def and c11m and c21m and c41m and c2def and c1def and c160m then BUY N contracts at market set stop ploss 300 ENDIF //if longonmarket and close crosses under st then //sell at market //endif //************************************************************************ //trailing stop function trailingstart = 19 //trailing will start @trailinstart points profit trailingstep = 7 //trailing step to move the "stoploss" //reset the stoploss value IF NOT ONMARKET THEN newSL=0 ENDIF //manage long positions IF LONGONMARKET THEN //first move (breakeven) IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN newSL = tradeprice(1)+trailingstep*pipsize ENDIF //next moves IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN newSL = newSL+trailingstep*pipsize ENDIF ENDIF //manage short positions IF SHORTONMARKET THEN //first move (breakeven) IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN newSL = tradeprice(1)-trailingstep*pipsize ENDIF //next moves IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN newSL = newSL-trailingstep*pipsize ENDIF ENDIF //stop order to exit the positions IF newSL>0 THEN SELL AT newSL STOP EXITSHORT AT newSL STOP ENDIF //************************************************************************ |