Hello. is there a code that makes it not place any more orders if it makes 3 losing trades in a row through stop loss on the same day. I want it to start again after the next day.
There you go:
ONCE TradeON = 1
ONCE SLtally = 0
ONCE SLhit = 0
IF IntraDayBarIndex = 0 THEN
TradeON = 1
SLtally = 0
SLhit = 0
ENDIF
// check if a trade was profitable or not, then stop trading after 3 consecutive losses
IF StrategyProfit > StrategyProfit[1] THEN
SLhit = 0
SLtally = 0
TradeON = 1
ELSIF StrategyProfit < StrategyProfit[1] THEN
SLhit = SLhit + 1
IF SLhit = 3 THEN
TradeON = 0
ENDIF
ENDIF
Sma = average[20,0](close)
MyLongConditions = Not OnMarket AND close CROSSES OVER Sma AND TradeON
MyShortConditions = Not OnMarket AND close CROSSES UNDER Sma AND TradeON
IF MyLongConditions THEN
BUY 1 CONTRACT AT MARKET
ELSIF MyShortConditions THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
SET STOP pLOSS 10
SET TARGET pPROFIT 20
//graph SLhit
//graph TradeON coloured("Red")
Thanks for the quick response as usual