Hello everyone,
I wanted to share with you a strategy that works on the EUR / USD instrument in 15 minutes timeframe.
I have set up a partial position closure but unfortunately it still does not work in real time.
There is something that is problematic for me, some positions last very long time on the market and pay attention to overnight charges!
Good trades!
DEFPARAM CumulateOrders = False DEFPARAM PRELOADBARS = 10000 daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0 Horaire = time >= 000000 and time <= 200000 CloturePartielle = 1 PositionsizeA = 1 PositionsizeV = 1 IF CloturePartielle THEN PositionsizeA = 4 PositionsizeV = 3 ENDIF MM = Average[56,3](totalprice) Newhighest=0 FOR a = 0 TO 1 DO IF DHigh(a)>Newhighest or Newhighest=0 THEN Newhighest = DHigh(a) ENDIF NEXT Newlowest=0 FOR b = 0 TO 1 DO IF DLow(b)<Newlowest or Newlowest=0 THEN Newlowest = DLow(b) ENDIF NEXT Milieu = (Newhighest+Newlowest)/2 Surachat = average[10,4]((Newhighest+Milieu)/2) Survente = average[10,4]((Newlowest+Milieu)/2) CA = (MM > Surachat) and (close crosses over Milieu) CV = (MM < Survente) and (close crosses under Milieu) // Long Entries IF Horaire AND CA AND not daysForbiddenEntry AND NOT SHORTONMARKET THEN BUY PositionsizeA CONTRACTS AT MARKET ENDIF IF CloturePartielle THEN IF LONGONMARKET THEN SELL 1 CONTRACTS AT TRADEPRICE + 40*pointsize LIMIT ENDIF IF LONGONMARKET THEN SELL 1 CONTRACTS AT TRADEPRICE + 20*pointsize LIMIT ENDIF IF LONGONMARKET THEN SELL 1 CONTRACTS AT TRADEPRICE + 18*pointsize LIMIT ENDIF ENDIF // Short Entries IF Horaire AND CV AND not daysForbiddenEntry AND NOT LONGONMARKET THEN SELLSHORT PositionsizeV CONTRACTS AT MARKET ENDIF IF CloturePartielle THEN IF SHORTONMARKET THEN EXITSHORT 1 CONTRACTS AT TRADEPRICE - 40*pointsize LIMIT ENDIF IF SHORTONMARKET THEN EXITSHORT 1 CONTRACTS AT TRADEPRICE - 78*pointsize LIMIT ENDIF ENDIF //MFE //trailing stop trailingstop = 33 //resetting variables when no trades are on market if not onmarket then MAXPRICE = 0 MINPRICE = close priceexit = 0 endif //case SHORT order if shortonmarket then MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level endif endif //case LONG order if longonmarket then MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade if MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price level endif endif //exit on trailing stop price levels if onmarket and priceexit>0 then EXITSHORT AT priceexit STOP SELL AT priceexit STOP endif //SET TARGET pPROFIT 46 SET STOP pLOSS 200