Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

GetAtmStrategyStopTargetOrderStatus("STOP2", "idValue")

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

    GetAtmStrategyStopTargetOrderStatus("STOP2", "idValue")

    Hi,

    I am using AtmStrategyCreate() to enter with a strategy previously created in the DOM. I then manage in the DOM.

    Is it possible to know in my program the current stoploss location even if it's moved?

    Would I do it like this?

    if ((atmStrategyId.Length > 0) && (GetAtmStrategyPositionQuantity(atmStrategyId) != 0))
    {
    string[,] orders = GetAtmStrategyStopTargetOrderStatus("STOP2",atmStr ategyId);
    Print("Current Stop is " + orders[0, 0].ToString());
    }

    I'm trying to do it like that and I keep getting "0" instead of the stop location.

    Thanks,

    Folls

    #2
    To double check...

    - The ATM strategy was generated via a NinjaScript strategy? If not, you will not be able to programatically manage it
    RayNinjaTrader Customer Service

    Comment


      #3
      Yes and I'm able to move the stop loss with AtmStrategyChangeStopTarget. However, I can't figure out how to print the current value of the stop (if that's possible).

      Thanks,

      Folls

      Comment


        #4
        I just checked...Price of current stop/targets is not retrievable.
        RayNinjaTrader Customer Service

        Comment


          #5
          OK. Thanks.

          Folls

          Comment


            #6
            Is it possible to find out if the "TARGET1" still exists? I'm trying to do this and keep getting a length of zero for the orders array with the following:

            //get order status
            string[,] orders = GetAtmStrategyStopTargetOrderStatus("TARGET1", "atmStrategyId");
            //if the order can't be moved
            if ((orders.Length == 0) || (orders[0,2] == "Cancelled" || orders[0,2] == "Rejected" || orders[0,2] == "Filled"))

            Thank you,

            Folls

            Comment


              #7
              If it can't find the order then an empty array is returned. Thus, you can't tell what the status is. Try checking a method that checks a property of the ATM strategy. If that is successful (you get some meaningful data back) then you can check for the status of a target.
              RayNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by AaronKoRn, Today, 09:49 PM
              0 responses
              1 view
              0 likes
              Last Post AaronKoRn  
              Started by carnitron, Today, 08:42 PM
              0 responses
              6 views
              0 likes
              Last Post carnitron  
              Started by strategist007, Today, 07:51 PM
              0 responses
              8 views
              0 likes
              Last Post strategist007  
              Started by StockTrader88, 03-06-2021, 08:58 AM
              44 responses
              3,975 views
              3 likes
              Last Post jhudas88  
              Started by rbeckmann05, Today, 06:48 PM
              0 responses
              9 views
              0 likes
              Last Post rbeckmann05  
              Working...
              X