allow ONLY one trade, and that trade being the trade immediately following the crossover. Per the instruction of NinjaTrader, I added code as follows:
This however results in an error code "The name savedBar does not exist in the current context" Can anyone help with this .
// Set 1
if (CrossAbove(HMA1, HMA2, 1)&& CurrentBar!=savedBar)
{
EnterLong(Convert.ToInt32(DefaultQuantity), "");
savedBar = CurrentBar; //save the entry bar number
}
// Set 2
if (CrossBelow(HMA1, HMA2, 1)&& CurrentBar!=savedBar)
{
EnterShort(Convert.ToInt32(DefaultQuantity), "");
savedBar=CurrentBar; //save the entry bar number
Comment