Here is a technical...coding related issue. I hope i'm posting this in the right place.
I have a NT strategy running that uses a predefined ATM Strategy template. The entry conditions are working fine and the ATM strategy kicks in and performs just fine. Unfortunately I'm getting an error when not in a trade (ATM Strategy not active)
as follows:
**NT** GetAtmStrategyMarketPosition() method error: Missing atmStrategyId parameter
to make matters worse, when the trade closes out - stop or target hit - the strategy stops running. I get no prints to the output window at that point and even though strategy is checked in control panel strategies tab it no longer takes any more trades until I deselect and reselect the strategy effectively "resetting". At that point the error mentioned above returns and the strategy code performs great until the next trade concludes.
I'm not getting much help at the moment from NT support, at least not as thoroughly as I'd like and so I'm posting code here for anyone willing to take a look.
here is all they key code effecting this problem as far as I can tell.
// Long Conditions
if (orderId.Length == 0 && atmStrategyId.Length == 0)
{
if(Rising(CUMRSI(BarsArray[1],periodRsi,3)))
{
Print("Rising 172");
Print("current CUMRSI(BarsArray[1] is: " + CUMRSI(BarsArray[1],periodRsi,3)[0]);
if(CUMRSI(BarsArray[2],periodRsi,3)[1] 0)
{
string[] status = GetAtmStrategyEntryOrderStatus(orderId);
// If the status call can't find the order specified, the return array length will be zero otherwise it will hold elements
if (status.GetLength(0) > 0)
{
// Print out some information about the order to the output window
Print("The entry order average fill price is: " + status[0]);
Print("The entry order filled amount is: " + status[1]);
Print("The entry order order state is: " + status[2]);
// If the order state is terminal, reset the order id value
if (status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected")
orderId = string.Empty;
}
} // If the strategy has terminated reset the strategy id
else if (atmStrategyId.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat)
atmStrategyId = string.Empty;
}