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 Tim-c, Today, 02:10 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by Taddypole, Today, 02:47 PM
              0 responses
              2 views
              0 likes
              Last Post Taddypole  
              Started by chbruno, 04-24-2024, 04:10 PM
              4 responses
              50 views
              0 likes
              Last Post chbruno
              by chbruno
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              10 responses
              400 views
              1 like
              Last Post beobast
              by beobast
               
              Started by lorem, Yesterday, 09:18 AM
              5 responses
              25 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X