Hello
I have this strategy that works with NQ Information but it Executes in MNQ, the Entry Orders are executed perfectly in the MNQ instrument (SubmitOrderUnmanaged(1.....), but the change Order in the Trail Stop does not work, it does not move the Orders Please can you help me to know what step I need. Note: I work with unmanaged orders.
thank you
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
// Verificar si la primera estrategia está activa
if (!IsMainStrategyActive())
{
Print("La estrategia principal no está activa. Por favor, active tanto la estrategia ATMBSR como la estrategia ATMR2");
return;
}
ReadSignal();
CancelOrderForTakeProfit();
TrailStop();
if (!orderPlaced)
{
if (signalType == "Long")
{
double orderLimit_Trigger = Convert.ToInt32(entryPrice - (Math.Abs(entryPrice - stopLoss) * (entradaRetrocesoOrdenR2/100)));
SubmitOrderUnmanaged(1, OrderAction.Buy, OrderType.Limit,Convert.ToInt32(cantidadComprada), orderLimit_Trigger,0,"","R2-LE");
orderPlaced = true;
}
else if (signalType == "Short")
{
double orderLimit_Trigger = Convert.ToInt32(entryPrice + (Math.Abs(entryPrice - stopLoss) * (entradaRetrocesoOrdenR2/100)));
SubmitOrderUnmanaged(1, OrderAction.SellShort, OrderType.Limit,Convert.ToInt32(cantidadComprada), orderLimit_Trigger,0,"","R2-SE");
orderPlaced = true;
}
}
}
private void TrailStop()
{
if (MyExitType != ExitType.Static)
{
if (stopLossLong != null)
{
// Actualizamos La Variables de Activacion del Trail
double CurrentTriggerTrailPriceLong = takeProfit * (activacionTrailforProfit/100);
double trailStop = Close[0] - aTR[0] * ATRMultiple;
if (GetCurrentAsk() >= CurrentTriggerTrailPriceLong - (2 * TickSize)
&& !activaPrimerMontoTrailLong)
{
ChangeOrder(stopLossLong,Position.Quantity,0,Curre ntTrailStopPriceLong);
activaPrimerMontoTrailLong = true;
}
if (trailStop > CurrentTrailStopPriceLong)
{
CurrentTrailStopPriceLong = trailStop;
ChangeOrder(stopLossLong,Position.Quantity,0, CurrentTrailStopPriceLong);
}
}
else if (stopLossShort != null)
{
// Actualizamos La Variables de Activacion del Trail
double CurrentTriggerTrailPriceShort = takeProfit * (activacionTrailforProfit/100);
double trailStop = Close[0] + aTR[0] * ATRMultiple;
if (GetCurrentBid() <= CurrentTriggerTrailPriceShort + (2 * TickSize)
&& !activaPrimerMontoTrailShort)
{
ChangeOrder(stopLossShort,Position.Quantity,0,Curr entTrailStopPriceShort);
activaPrimerMontoTrailShort = true;
}
if (trailStop < CurrentTrailStopPriceShort)
{
CurrentTrailStopPriceShort = trailStop;
ChangeOrder(stopLossShort,Position.Quantity,0,Curr entTrailStopPriceShort);
}
}
else if (stopLossLong == null)
{
activaPrimerMontoTrailLong = false;
}
else if (stopLossShort == null)
{
activaPrimerMontoTrailShort = false;
}
}
}

Comment