Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Two different ATMs in a strategy

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

    Two different ATMs in a strategy

    Can you call and use 2 different ATMs in one strategy for say a short term trade and one to handle a longer term trade ?
    By using a ATMStrategyCreate() command, and if so, do you have to get the
    orderId and atmStrategyId for each instance of ATMStrategyCreate? Because I'm having trouble getting the atmStrategyId. NT keeps giving me an error of 'Unknown ATM Paramenter' and I tracked it down to the atmStrategyId.

    #2
    Hello Joe Average,

    Thank you for your post.

    You should be able to run two ATM Strategies from within NinjaScript. Can you provide the full details on the error message and how you tracked it down to the atmStrategyId?

    Comment


      #3
      Here is the code that I think is causing this error ...

      if (CrossBelow(SMA(Fast), SMA(Slow), 2)&&
      (SMA(Fast)[
      0]+ (.3 *TickSize) < (SMA(Slow)[0])))

      atmStrategyId = GetAtmStrategyUniqueId();
      orderId = GetAtmStrategyUniqueId();
      AtmStrategyCreate(Cbi.OrderAction.Sell, OrderType.Market, Close[
      0], 6, TimeInForce.Day, orderId, "openSlope", atmStrategyId);
      //Print(atmStrategyId);
      Print(orderId);
      Print(
      "ATM Short");
      Print(Close[
      0]);
      BarColor = Color.Blue;

      Here is the output window resulting from this code ...

      **NT** Submitting order with strategy 'SMAcrossover/80c32e795b0244ffb179576fa467dfc1'
      a2ab766096324facbae76ed88a09e194
      ATM Short
      1950.25
      **NT** Missing atmStrategyId parameter
      6f9fa7475b7747feb05424ada702065a
      ATM Short
      1950
      **NT** Missing atmStrategyId parameter
      aa2a1bc449b3455d8c5370377c0b1042
      ATM Short
      1949.5
      **NT** Missing atmStrategyId parameter
      678c4b7895a84c178afc5e0156354571
      ATM Short
      1949.25


      I have 'openSlope' saved as a ATM strategy.





      Comment


        #4
        Hello Joe Average,

        Thank you for your response.

        Can you provide the full .cs file for the strategy so I may test this strategy on my end?
        You will fin the strategy's .cs file in the following directory on your PC: (My) Documents\NinjaTrader 7\bin\Custom\Strategy

        Comment


          #5
          OK, I attached the .cs file.
          Attached Files

          Comment


            #6
            Hello Joe Average,

            The code you referenced is missing the open and close brackets in the strategy which is resulting in the error. Please change that section of code to the following:
            Code:
            if (CrossBelow(SMA(Fast), SMA(Slow), 2)&&
            (SMA(Fast)[0]+ (.3 *TickSize) < (SMA(Slow)[0])))
            {
            atmStrategyId = GetAtmStrategyUniqueId();
            orderId = GetAtmStrategyUniqueId();
            AtmStrategyCreate(Cbi.OrderAction.Sell, OrderType.Market, Close[0], 6, TimeInForce.Day, orderId, "openSlope", atmStrategyId);
            //Print(atmStrategyId);
            Print(orderId);
            Print("ATM Short");
            Print(Close[0]);
            BarColor = Color.Blue;
            }

            Comment


              #7
              Thank you

              Ahhhh, ###### ! I did not see that !!!!!!!
              I'm sorry for wasting your time, wow, that was stupid.
              Sorry,sorry.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by AdamDJ8, Today, 09:18 PM
              0 responses
              1 view
              0 likes
              Last Post AdamDJ8
              by AdamDJ8
               
              Started by knowmad, Today, 03:52 AM
              2 responses
              26 views
              0 likes
              Last Post knowmad
              by knowmad
               
              Started by ETFVoyageur, Today, 07:05 PM
              0 responses
              7 views
              0 likes
              Last Post ETFVoyageur  
              Started by Orion815, 05-02-2024, 08:39 AM
              2 responses
              18 views
              0 likes
              Last Post Orion815  
              Started by suroot, 02-25-2017, 04:43 AM
              11 responses
              2,552 views
              0 likes
              Last Post Zilvercat  
              Working...
              X