I was wondering if anyone can help me modify a strategy sample uploaded by PatrickH called SampleATMReversal, which I have modified with my own triggers and variables.
I'm trying to get some more ideas on how to get the strategy to enter based on "entries per direction" specified in my strategy while calling upon an ATM strategy per each entry. Currently, the strategy enters only one time and calls upon the ATM strategy specified but the strategy will not initiate additional entries in the direction of the trigger.
ChelseaB has already recommended I look into making an array to accomplish and I would just like some more ideas before I ultimately decide how I should go about doing this.
Here is a portion of the code of PatrickH's code which initiates a long entry and calls upon an ATM strategy.
// Entries. // **** YOU MUST HAVE AN ATM STRATEGY TEMPLATE NAMED 'AtmStrategyTemplate' CREATED IN NINJATRADER (SUPERDOM FOR EXAMPLE) FOR THIS TO WORK **** // Enter long if Close is greater than Open. if(Close[0] > Open[0]) { // If there is a short ATM Strategy running close it. if(shortAtmId.Length != 0 && isAtmStrategyCreated) { AtmStrategyClose(shortAtmId); isAtmStrategyCreated = false; } // Ensure no other long ATM Strategy is running. if(longOrderId.Length == 0 && longAtmId.Length == 0 && !isAtmStrategyCreated) { longOrderId = GetAtmStrategyUniqueId(); longAtmId = GetAtmStrategyUniqueId(); AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 0, TimeInForce.Day, longOrderId, "AtmStrategyTemplate", longAtmId, (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 == longAtmId) isAtmStrategyCreated = true; }); } }
Comment