It’s getting late … that’s probably why I don’t see the error. The following problem with this test system: I created it as a breakout MTF, breakout from the M15 chart with the data from the M30 chart. So far it works according to my ideas. But … if I switch to the M3 chart now to add a trailing stop … my breakouts will no longer work. Unfortunately I cannot find the error. Can someone help me please? //================================================ DEFPARAM CUMULATEORDERS = false defparam preloadbars = 5000 //daysForbiddenEntry = OpenDayOfWeek = 5 and time >= ti //Risk Management PositionSize=1 //timeframe(4hour, updateonclose) ////MACDLiniex = MACDline[12,26,9](close) > 0 //MAxx = Average[15,1](typicalprice) //mylongx = MAxx > MAxx[1] timeframe(30minute, updateonclose) //MA25 = Average[25,1](close) //Exponential MA50 = Average[50,1](close) //Exponential MA100 = Average[100,1](close) //Exponential MA150 = Average[150,1](close) //Exponential MA180 = Average[180,1](close) //Exponential //timeframe(30minute, updateonclose) ////MACDLiniex = MACDline[12,26,9](close) > 0 //MAxx = Average[100,1](close) //typicalprice //mylongx = MAxx > MAxx[1] //timeframe(15minute, updateonclose) per = 200 //20 200 MA = Average[per,1](close) //close typicalprice //MA150 = Average[150,1](close) //Exponential //MA180 = Average[180,1](close) //Exponential MA5 = Average[5,1](close) //Exponential MA10 = Average[10,1](close) //Exponential MA21 = Average[21,1](close) //Exponential MA34 = Average[34,1](close) //Exponential MA55 = Average[55,1](close) //Exponential MA89 = Average[89,1](close) //Exponential mylong = MA > MA[1] mylong2 = MA100 > MA150 and MA150 > MA180 and MA50 > MA100 //and MA25 > MA50 mylong3 = MA21 > MA34 mylong4 = MA34 > MA55 mylong5 = MA55 > MA89 mylong6 = close > MA5 mylong7 = MA5 > MA10 and MA10 > MA21 and MA21 > MA21[1] and MA10 > MA10[1] mylong8 = close > MA //Volaititätfilter AvgRange = average[20,0](range) TradeOFF = range > (AvgRange * 3) //no trading if the current range > twice its average //3 //Breakout Hoch = highest[10](high) //8 timeframe(15minute, updateonclose) Breakout = close crosses over Hoch[1] //and close[1] > Hoch[2] // trading window ONCE BuyTime = 50000 ONCE SellTime = 210000 // position management IF Time >= BuyTime AND Time <= SellTime THEN If Breakout and mylong3 and mylong4 and mylong5 Then Buy PositionSize CONTRACTS AT MARKET SET STOP %LOSS 0.9 SET TARGET %PROFIT 1 ENDIF endif timeframe(default) //////////////////////////////////////////////////// //// %trailing stop function incl. cumulative positions //once trailingstoptype = 1 //if trailingstoptype then ////==================== //trailingpercentlong = start // % //trailingpercentshort = 0.2 // % //once acceleratorlong = step // typically tst*0.1 //once acceleratorshort= 0.05 // typically tss*0.1 //ts2sensitivity = 2 // [1] close [2] high/low [3] low/high [4] typicalprice ////==================== //once steppercentlong = (trailingpercentlong/10)*acceleratorlong //once steppercentshort = (trailingpercentshort/10)*acceleratorshort //if onmarket then //trailingstartlong = positionprice*(trailingpercentlong/100) //trailingstartshort = positionprice*(trailingpercentshort/100) //trailingsteplong = positionprice*(steppercentlong/100) //trailingstepshort = positionprice*(steppercentshort/100) //endif // //if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then //newsl = 0 //mypositionprice = 0 //endif //positioncount = abs(countofposition) //if newsl > 0 then //if positioncount > positioncount[1] then //if longonmarket then //newsl = max(newsl,positionprice * newsl / mypositionprice) //else //newsl = min(newsl,positionprice * newsl / mypositionprice) //endif //endif //endif //if ts2sensitivity=1 then //ts2sensitivitylong=close //ts2sensitivityshort=close //elsif ts2sensitivity=2 then //ts2sensitivitylong=high //ts2sensitivityshort=low //elsif ts2sensitivity=3 then //ts2sensitivitylong=low //ts2sensitivityshort=high //elsif ts2sensitivity=4 then //ts2sensitivitylong=(typicalprice) //ts2sensitivityshort=(typicalprice) //endif //if longonmarket then //if newsl=0 and ts2sensitivitylong-positionprice>=trailingstartlong then //newsl = positionprice+trailingsteplong + 0.2 //endif //if newsl>0 and ts2sensitivitylong-newsl>=trailingsteplong then //newsl = newsl+trailingsteplong //endif //endif //if shortonmarket then //if newsl=0 and positionprice-ts2sensitivityshort>=trailingstartshort then //newsl = positionprice-trailingstepshort //endif //if newsl>0 and newsl-ts2sensitivityshort>=trailingstepshort then //newsl = newsl-trailingstepshort //endif //endif //if barindex-tradeindex>1 then //if longonmarket then //if newsl>0 then //sell at newsl stop //endif //if newsl>0 then //if low crosses under newsl then //sell at market //endif //endif //endif //if shortonmarket then //if newsl>0 then //exitshort at newsl stop //endif //if newsl>0 then //if high crosses over newsl then //exitshort at market //endif //endif //endif //endif //mypositionprice = positionprice //endif // //if (shortonmarket and newsl > 0) or (longonmarket and newsl>0) then //if positioncount > positioncount[1] then //if longonmarket then //newsl = max(newsl,positionprice * newsl / mypositionprice) //endif //if shortonmarket then //newsl = min(newsl,positionprice * newsl / mypositionprice) //endif //endif //endif //////////////////////////////////////////////////////////////////