Need help with MTF breakout Nasdaq
Forums › ProRealTime English forum › ProOrder support › Need help with MTF breakout Nasdaq
- This topic has 30 replies, 7 voices, and was last updated 3 years ago by
phoentzs.
-
-
11/20/2021 at 4:09 AM #181919
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?MTF-Breakout Nasdaq M15123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175//================================================DEFPARAM CUMULATEORDERS = falsedefparam preloadbars = 5000//daysForbiddenEntry = OpenDayOfWeek = 5 and time >= ti//Risk ManagementPositionSize=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) //ExponentialMA50 = Average[50,1](close) //ExponentialMA100 = Average[100,1](close) //ExponentialMA150 = Average[150,1](close) //ExponentialMA180 = 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 200MA = Average[per,1](close) //close typicalprice//MA150 = Average[150,1](close) //Exponential//MA180 = Average[180,1](close) //ExponentialMA5 = Average[5,1](close) //ExponentialMA10 = Average[10,1](close) //ExponentialMA21 = Average[21,1](close) //ExponentialMA34 = Average[34,1](close) //ExponentialMA55 = Average[55,1](close) //ExponentialMA89 = Average[89,1](close) //Exponentialmylong = MA > MA[1]mylong2 = MA100 > MA150 and MA150 > MA180 and MA50 > MA100 //and MA25 > MA50mylong3 = MA21 > MA34mylong4 = MA34 > MA55mylong5 = MA55 > MA89mylong6 = close > MA5mylong7 = MA5 > MA10 and MA10 > MA21 and MA21 > MA21[1] and MA10 > MA10[1]mylong8 = close > MA//VolaititätfilterAvgRange = average[20,0](range)TradeOFF = range > (AvgRange * 3) //no trading if the current range > twice its average //3//BreakoutHoch = highest[10](high) //8timeframe(15minute, updateonclose)Breakout = close crosses over Hoch[1] //and close[1] > Hoch[2]// trading windowONCE BuyTime = 50000ONCE SellTime = 210000// position managementIF Time >= BuyTime AND Time <= SellTime THENIf Breakout and mylong3 and mylong4 and mylong5 ThenBuy PositionSize CONTRACTS AT MARKETSET STOP %LOSS 0.9SET TARGET %PROFIT 1ENDIFendiftimeframe(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//////////////////////////////////////////////////////////////////11/20/2021 at 4:19 AM #181920Hello phoentzs,
Quite late, yes. Or early !
1TradeOFF = range > (AvgRange * 3) //no trading if the current range > twice its average //3I am sure this is too simple … but if this line determines when not to trade, and your comments speaks of twice while the code does trice … who knows.
Edit : Never mind, because you don’t use that variable.
11/20/2021 at 4:30 AM #181921It is a trial code, so many variables are not used. I’m building the strategy with a few things from my construction kit. Add the system to the M15 chart and it will work perfectly as it should. But if you switch to the M3 or M5 or M1 chart, it should actually work. But it doesn’t. The question is why? Something is wrong with the MTF instructions. I believe.
11/20/2021 at 6:33 AM #181922Try increasing the number of units used in your default TF.
11/20/2021 at 10:45 AM #18192611/20/2021 at 11:28 AM #18192911/20/2021 at 11:54 AM #18193111/20/2021 at 11:55 AM #181932Explained again in words: The Trend and Highest [10] high come from the M30-TF. The close comes from the M15-TF. In the TF M15 it works as it should. But now I want to add a trailing stop to the M3 with this system structure … When switching to TF M3, it is noticeable that the system structure no longer works. Instead of several 100 entries, I only have 10 or 20 in the same period.
11/20/2021 at 11:57 AM #18193311/20/2021 at 12:06 PM #18193411/20/2021 at 12:09 PM #181936Could you please try the system to find out why it doesn’t convert the inputs to lower TF?
Did you try increasing the units?
A couple of variables are not defined, Start and Step.
11/20/2021 at 12:16 PM #18193711/20/2021 at 1:01 PM #181938I would change line 59 to
timeframe (default)
The 15 min TF seems redundant if you’re going to run it on 3min
11/20/2021 at 1:19 PM #18194011/20/2021 at 1:33 PM #181942 -
AuthorPosts
Find exclusive trading pro-tools on