This ProBuilder code snippet demonstrates how to halt trading activities in an automated trading system after incurring a significant loss, specifically a 5% drop in equity. The code uses conditional statements to monitor and update the trading status based on the equity level after each trade.
ONCE BigLoss = 0.95 //5% or more has to be considered a big loss
ONCE TradeOn = 1 //Trading enabled by default at launchtime
ONCE Capital = 10000 //Set your initial capital
IF NOT OnMarket AND OnMarket[1] THEN //When a trade is closed ...
IF (Capital + StrategyProfit) <= (Capital * BigLoss) THEN //... check if it's a big loss and ...
TradeOn = 0 //... eventually stop trading
ENDIF
Capital = Capital + StrategyProfit //Update your Equity
ENDIF
IF Your_Conditions AND TradeOn AND Not OnMarket THEN
BUY/SELLSHORT .......
ENDIF
Explanation of the code:
This approach ensures that the trading system pauses operations after a significant loss, potentially safeguarding against further undesirable drawdowns until conditions are deemed favorable again or manual intervention resets the trading flag.
Check out this related content for more information:
https://www.prorealcode.com/topic/stay-flat-after-a-big-loss/#post-65637
Visit Link