I'm testing the ATM Strategy process and Methods.. I have a strategy that is working using StopLimtOrders.
At times i need to check if the Market is flat as you would guess... I do this before executing some code but needs to check flat first...
I'm using the example from your scripts and this it how it looks...
I have a lot more code but just showing the section in discussion..
I declared this..
private string atmStrategyId = string.Empty;
protected override void OnBarUpdate()
{
// Check if market flat
if (GetAtmStrategyMarketPosition("atmStrategyId") == MarketPosition.Flat)
Print("ATM Strategy position is currently flat");
// I do some checks for a LONG signal then submit the order
AtmStrategyCreate(OrderAction.Buy, OrderType.StopLimit, limitPrice, stopPrice, TimeInForce.Gtc, orderId, "AtmStrategyTest_Name", 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)
{
isLongAtmStrategyCreated = true;
}
} // End OnBarUpdate
I print to the output window the information so I can see whats happening.. and I get this...
'GetAtmStrategyMarketPosition' method error: ATM strategy ID 'atmStrategyId' does not exist
ATM Strategy position is currently flat
and as each OnBarUpdate..keeps saying same thing....
'GetAtmStrategyMarketPosition' method error: ATM strategy ID 'atmStrategyId' does not exist
ATM Strategy position is currently flat
GetAtmStrategyMarketPosition' method error: ATM strategy ID 'atmStrategyId' does not exist
ATM Strategy position is currently flat
So the documents for this method state this....
Method Return Value
MarketPosition.Flat
MarketPosition.Long
MarketPosition.Short
Syntax
GetAtmStrategyMarketPosition(string atmStrategyId)
Does anyone have any ideas?
Thanks
Bruce

Comment