The following is from a Ninjascript I recently optimized. The optimized results were entry2_sl = 1 and entry2_slx =1. Logically there should not be any trades resulting since both Close[0]>Close[1] and Close[0]<Close[1] cannot be true at the same time. Yet, I am getting trade results from these conditions. Any idea what is happening?
[NinjaScriptProperty]
public int entry2_sl
{ get; set; }
[NinjaScriptProperty]
public int entry2_slx
{ get; set; }
protected override void OnBarUpdate()
{
if (CurrentBar < BarsRequiredToTrade)
return;
// Input Variables
int entry2_sl = 5, entry2_slx = 20;
// entry2_sl = short term trend length
// entry2_slx = longer term trend length
if ((Close[0] < Close[entry2_sl])
&& (Close[0] > Close[entry2_slx]))
EnterLong(Convert.ToInt32(DefaultQuantity), @"Entry02Long");
Comment