PDA

View Full Version : ASM Strategy


chantj
02-01-2007, 11:29 PM
I am implementing an ASM strategy as follows:

if (AsmStrategyMarketPosition == MarketPosition.Flat && !AsmStrategyActive)
{
if (BuySignal == true)
{
AsmStrategyCreate(Action.Buy, OrderType.Market, 0, 0, TimeInForce.Day, "Test");
}
else if (SellSignal == true)
{
AsmStrategyCreate(Action.Sell, OrderType.Market, 0, 0, TimeInForce.Day, "Test");
}
}


I set this strategy up to run against Sim101, but found that, if I manually trade against another account, the strategy does not run. I assume this is because manually trading with an ASM makes AsmStrategyActive = True and AsmStrategyMarketPosition not flat, even though I'm using a different ASM for manual and the strategy. Is this correct? Is there any way to determine which ASM strategy (i.e. "Test" versus "Production") is active from within the script?
Also, do AsmStrategyActive etc. functions span all instruments or do they only look for active strategies in the current instrument?

NinjaTrader_Ray
02-02-2007, 02:07 AM
We are going to release another beta update likely Monday that has revamped all of the ASM strategy methods so do not spend muchmore time debugging the current source code.

If trading both manually and have a NinjaScript strategy execute an ASM Strategy in the same market, you have to be sensitive to what buttons you press manually.

Pressing Flatten Everything, ClosePosition via Positions Tab or pressing the CLOSE button in the SuperDOM with your left mouse button will close the position, cancell all working orders and terminate any active strategies. This is likely what is happening. Instead, when closinga strategy in the SuperDOM, use your middle mouse button which internally closes the strategy and position associated to it, NOT the actual account position. This will leave your NinjaScript strategy running. More information on this with the new methods in the next udpate in the Help Guide.

Ray