at the moment I ran 3 stocks in an automatated trading system. So 3 strategies are running at the same time. I like to install a daily loss limit of $300
Recently I put these lines in the code to not allow to open new trades when the loss limit is reached:
1
2
3
4
5
6
7
8
9
10
OnceMaxLoss=300
OnceTempProfit=0
OnceTradeON=1
IFIntraDayBarIndex=0Then
TempProfit=STRATEGYPROFIT
TradeON=1
ENDIF
IfTempProfit-STRATEGYPROFIT>=MaxLossTHEN
TradeON=0
ENDIF
But this only works for each stock. Therfore I am running the system for 3 stocks/3strategies, the system stops for the day when 3x-$300 is reached.
How can I install a check before a new trade is openend, regarding the total running profit/Loss for the day for the whole protfolio?