I am trying to create a condition in which it takes a price from a timeframe and submits an order once the price in a different timeframe crosses below. I think the code is good but it does not submit the order. (It does not annunciate any error)
else if (State == State.Configure)
{
// Add a 45 minute Bars object to the strategy
AddDataSeries(Data.BarsPeriodType.Minute, 1); // BarsArray[1]
AddDataSeries(Data.BarsPeriodType.Second, 1); // BarsArray[2]
}
protected override void OnBarUpdate()
{
if ( TimeToTrade() && barNumberOfLongEntries == 0 && okToEnter )
{
if (LongSignal())
{
precioentrada2 = Close[0] - (Convert.ToInt32(Order02Offset) * TickSize); Print("precioentrada2 " +precioentrada2);
CancelOpenEntries();
CancelOpenOrders();
barNumberOfLongEntries = CurrentBar;
escalondos = 1;
if (CrossBelow(Closes[2], (precioentrada2 - 5 * TickSize), 1) && CurrentBar < barNumberOfLongEntries + OrderActiveBars && escalondos > 0) //THIS IS THE PART NOT WORKING
{
EnterLongStopMarket(0, true, Convert.ToInt32(Order02LotSize), precioentrada2, "LE02"); Print("order 2 " +precioentrada2);
escalondos = 0;
}
}
}
Comment