im tryng to build a strategy that it stops when the equity curve is below its SMA (21 period).The problem is that the strategy dont start to do trades. the code that i write for obtain this is. Can i get some help to run it? thanks in advance
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[1] < 1
|| CurrentBars[2] < 1)
return;
myDoubleSeries[0] = SystemPerformance.AllTrades.TradesPerformance.Currency.CumProfit;
if (SystemPerformance.AllTrades.TradesPerformance.Currency.CumProfit <= SMA(myDoubleSeries, 21))
{
// Returns out of the OnBarUpdate() method. This prevents any further evaluation of trade logic in the OnBarUpdate() method.
return;
}


Comment