I want the rule to not enter the market if i have taken a trade within say the last 10 bars.
By “taken a trade” i mean if i have just finished a trade. If the trade was profitable i dont want to enter the market within the next 10 bars. If there is no way of seeing whether or not the last trade was a profit or loss i would still try to backtest the rule.
possible?
- You have to use a variable to start counting bars when you exit a trade (you have to check you are NOT LONGONMARKET now but were LONGONMARKET the previous bar) and set another variable to disable trading
- After 10 bars you have to allow trading again
ONCE BarCount = 0
ONCE TradeON = 1 //1=trading allowed 0=trading disbaled
IF LongOnMarket AND Not LongOnMarket[1] THEN
TradeON = 0 //disable trading
BarCount = 0 //reset counter
ENDIF
IF Not LongOnMarket THEN //Increase counter when not on market
BarCount = BarCount + 1
ENDIF
IF BarCount > 10 THEN
TradeON = 1
ENDIF
you’ll also have to add “AND TradeOn” to your condition to enter a new trade.