The questions I have are the following
Can one SetStopLoss AND SetProfitTarget before the the order is executed?
If not do I setStopLoss and ProfitTarget on OnPostionUpdate OR OnExecttionUpdate?
if(Position.MarketPosition == MarketPosition.Short)
{
ExitShort("Short1");
if(nTarget2Contracts != 0)
ExitShort("Short2");
}
if(Position.MarketPosition == MarketPosition.Flat)
{
SetProfitTarget("Long1",CalculationMode.Price,dPri ceA,true);
SetProfitTarget("Long2",CalculationMode.Price,dPri ceB,true);
SetStopLoss("Long1",CalculationMode.Price,dStopLos sA,false);
if(nTarget2Contracts != 0)
SetStopLoss("Long2",CalculationMode.Price,dStopLos sA,false);
EnterLongLimit(nTarget1Contracts,dLimitPriceA,"Lon g1");
if(nTarget2Contracts != 0)
EnterLongLimit(nTarget2Contracts,dLimitPriceA,"Lon g2");
}
Comment