#region variables
private int priorTradesCount = 0
private double priorTradesCumProfit = 0
#OnBarUpdate()
//Store the strategy's prior cumulated realized profit and number of trades
priorTradesCount = Performance.AllTrades.Count;
priorTradesCumProfit = Performance.AllTradesPerformance.Currency.CumProfi t;
I guess here if the strategy makes 3 trades, then the priorTradesCount =3, the same with the cumulated realized profit, if the profit is 1000, then the priorTradesCumProfit=1000
Is that correct?
What I don't understand is:
Prevents further trading if the current session's realized profit exceeds 1000, and also prevent trading if 10 trades have already been made in this session.
If I write this:
if(Performance.AllTradesPerformance.Currency.CumPr ofit - priorTradesCount>=1000
I understand that if in the previous part I wrote:
priorTradesCumProfit = Performance.AllTradesPerformance.Currency.CumProfi t; and the result is 1000, if now I write if(Performance.AllTradesPerformance.Currency.CumPr ofit - priorTradesCount>=1000, it is like 1000 - 1000 = 0 so it makes no sense.
The same happens with the number of trades.
Thank you
Sincerely
Daniel
Comment