The strategy takes off at the beginning of the current code :
protected override void OnBarUpdate()
{
// Enter for 1st Enter
if (//Bars.BarsSinceSession < 50 &&
N_3 == 1 &&
Close[0] > Open[0] &&
CrossAbove(SMA(7), SMA(14), 2)
)
{
N=1;
SetProfitTarget("", CalculationMode.Ticks, TP);
SetStopLoss("", CalculationMode.Ticks, SL, false);
EnterLong(N, "");
N_3 = 2;
}
// Enter Long if LastWin
if (//Bars.BarsSinceSession > 50 &&
N_3 != 1 &&
Performance.AllTrades[Performance.AllTrades.Count - 1].ProfitCurrency > 0 &&
Close[0] > Open[0] &&
Position.MarketPosition != MarketPosition.Long &&
Position.MarketPosition != MarketPosition.Short &&
CrossAbove(SMA(7), SMA(14), 2)
)
{
N=1;
SetProfitTarget("", CalculationMode.Ticks, TP);
SetStopLoss("", CalculationMode.Ticks, SL, false);
EnterLong(N, "");
}
It compiles okay.
N_3 =1 (int)
If make via : Bars.BarsSinceSession < 50
and here and there , all running at 50 pc , at < 40 - no.
I do not want to lose the bars since the beginning of the session.
What 's the problem ?
Comment