i am trying to make only one ATM strategy is active with below code but what is happening is it places one order id and when it is executed agait it places one more order. but i don't want to create one more order until existing closes .can u please help me?
if (orderId.Length == 0 ) //Create order only one time
{
//To create ore
isAtmStrategyCreated = false; // reset atm strategy created check to false
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(OrderAction.Buy, OrderType.Limit, (lstop+((entryOffsetPer*lstop)/100)), 0, TimeInForce.Day, orderId, ATM_TemplateName, atmStrategyId, (atmCallbackErrorCode, atmCallBackId) => {
//check that the atm strategy create did not result in error, and that the requested atm strategy matches the id in callback
if (atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == atmStrategyId)
isAtmStrategyCreated = true;
});
Print(string.Format("{0};{1}",Time[0],"New ATM Strategy created !!="+orderId.Length));
} else{ //Change entry order
Print("In change order -ATM Startegy already creaated -orderId="+orderId); // In market order type if ATM is executed it will place one more order with modifed price so this modify should not be used for market order only limit order it should be used
}
Comment