I am trying to create stop orders, both sales and purchases.
They must be able to be created no matter if a previous stopOrder already exists, whenever OnBarUpdate () is executed, the order that is written in the code must be created..
even if they are opposing sales and purchases, they must always be created.
Here is my code, but is not working as I described:
protected override void OnBarUpdate()
{
if(condition1)
{
SetStopLoss(signalName,CalculationMode.Price,sl,fa lse);
SetProfitTarget(signalName,CalculationMode.Price,t p);
EnterLongStopMarket(0,true,10000,stopPrice,signalN ame);
}
if(condition2)
{
SetStopLoss(signalName,CalculationMode.Price,sl,fa lse);
SetProfitTarget(signalName,CalculationMode.Price,t p);
EnterShortStopMarket(0,true,10000,stopPrice,signal Name);
}
}
Please, could you help me?
Comment