Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATM/Multiple orders

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    ATM/Multiple orders

    I've read the text on ATMs within strategies and have the sample ATM strategy, but I've only just started manually altering strategies so I'm not too clear on what I should be including or not. The code I have currently is as below (although I have this repeated several times for different trade entry conditions), but it seems to be taking in more than one order every so often. Am I missing some important code and if so, what?

    Many thanks

    Mike

    if (GetAtmStrategyMarketPosition("10 tick") == MarketPosition.Flat
    && (SEVERAL CONDITIONS FOR STRATEGY)

    {
    AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 10,
    TimeInForce.Day, GetAtmStrategyUniqueId(), "10 tick",
    GetAtmStrategyUniqueId());
    }

    #2
    Hi Mike,

    You'll want to work mainly from the sample. All the string structure there is required to control order submission. To save a copy of the sample: Right Click > Save as and provide a new name. About the only part of the sample you should remove or comment is the stop price change block. // You can change the stop price
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan,

      I've done as you suggested.

      I've run it within a market replay. It currently takes in one order and once that's closed out it takes in no more.

      I repeatedly get an error in the output window:

      **NT** GetAtmStrategyMarketPosition() method error: AtmStrategyId 'AtmStrategyTemplate' does not exist

      I created an 'AtmStrategyTemplate' (just in case it actually needed to be called that!).

      I have also repeated the ATM template code for each entry block.

      Any idea what's likely to be going wrong here?

      Many thanks

      Mike

      Comment


        #4
        The AtmStrategyId should not be named the same as the template. These are two different things. The ID is internally generated and will never be a readable string like "AtmStrategyTemplate". The code changes you made to assign atmStrategyId = "AtmStrategyTemplate" won't work.

        "AtmStrategyTemplate" used in code should match the name of an ATM strategy template you create in another window, like the SuperDom.

        You should not have to change much from the sample to see it working. Best will be to play around with an unmodified sample until you get the hang of it. There's a lot of parts, and the print statements used there are designed to show the code flow.

        Follow these steps to see a working NS > ATM strategy:

        1) Create an ATM strategy in the SuperDom called AtmStrategyTemplate. See here for help managing ATM templates.

        2) Run the unmodified SampleAtmStrategy. On bars that close higher than open, a limit order is submitted at the low of the bar. If this order is filled, you'll then see an ATM strategy applied.

        Use Tools > Output Window to monitor for messages, and a SuperDom or ChartTrader to visualize the orders.
        Last edited by NinjaTrader_RyanM1; 08-08-2011, 01:42 PM.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by usazencort, Today, 01:16 AM
        0 responses
        1 view
        0 likes
        Last Post usazencort  
        Started by kaywai, 09-01-2023, 08:44 PM
        5 responses
        603 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        6 responses
        23 views
        0 likes
        Last Post xiinteractive  
        Started by Pattontje, Yesterday, 02:10 PM
        2 responses
        22 views
        0 likes
        Last Post Pattontje  
        Started by flybuzz, 04-21-2024, 04:07 PM
        17 responses
        230 views
        0 likes
        Last Post TradingLoss  
        Working...
        X