I have an automated trading strategy based on Ninjascript. Is there a way to stop a strategy from making further trades based on the following criteria.
- If the cumulative loss is more than or equal to $4000 for any 'calender month', stop trading for that particular month.
On the other hand, I want the strategy to start placing trades next month if the cumulative loss for this month was more than or equal to $4000. I.e. if I have a loss of $4000 this month, I want the strategy to stop placing trades for this month only but want it to start working next calendar month without me in the need to activating it.
I found the following statement from Help section, but it is not working for me. Can someone please help me to understand what could be wrong here?
protected override void OnBarUpdate()
{
if Performance.RealtimeTrades.TradesPerformance.Curre ncy.ProfitPerMonth >= -4000
return;
Appreciate your help in advance.
Comment