There are many 0-bar trades but only on the stoploss. Profit bars is 5 so I think the trades are valid and not subjected to the zerobar trade issue so many have written about here.
It makes a trade on 2nd day breakout and adds a trade every day with a minimum SL- many get stopped out but some get going.
I also added some extra trades if there was a trend. I hope you like it. I didn't clean up the code, so you would see some of the alternative things I have been optimizing.
Comments and improvement are as always welcome.
//==================DAX Daily Timeframe========================== // Definition of code parameters DEFPARAM CumulateOrders = true // Cumulating positions deactivated //Positionsize=2 // calculate daily high/low Capital = 20000 Risk = 0.005 StopLoss = 20// Could be our variable XREM Calculate contracts equity = Capital + StrategyProfit maxrisk = round(equity*Risk) PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize) if PositionSize>=1000 then PositionSize=1000 endif if PositionSize<=3 then PositionSize=3 endif //ONCE p=0 //x1=1 //x2=16.4 x1=2 x2=20.8 x5=5 SL=6 c1=(highest[x1](close)) if not shortonmarket and high>c1 then BUY Positionsize CONTRACTS AT MARKET //pris=open[p] ENDIF //if open>pris+x5 then if open>tradeprice+x5 then buy Positionsize CONTRACTS AT MARKET endif if longonmarket then CountDays=CountDays+1 //p=p+1 else CountDays=0 //p=0 endif if CountDays>=x2 then sell at market endif set stop loss SL//your SL code //graph (positionsize/equity)*100 COLOURED(0,255,0) AS "RISK"//GREEN //graph (positionsize*SL/equity)*100 COLOURED(0,255,255) AS "MAXRISK"//Aqua //GRAPH tradeprice COLOURED(50,50,75) AS "monthlyHigh" //GRAPH pris COLOURED(50,0,75) AS "pris"
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.ProRealTime ITF files and other attachments :