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

ATM Strategy Stop Target methods

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

    ATM Strategy Stop Target methods

    There are two problems here one i think is a bugs the other relates to help.

    First one is in AtmStrategyChangeStopTarget()

    I can change both Stop and Target orders sucessfully however when changing a Target order "TARGET1" it never returns true. The calling method is a delegate ive attached to a custom barupdate event (HINT: where are ninjas events at?), but it cant unsubscribe if true is not returned.

    Second is your code example from the help for GetAtmStrategyStopTargetOrderStatus generates an index out of range error. (after you fix the entryOrder syntax error)
    Code:
    protected override void OnBarUpdate() 
    {   
        string[,] orders = GetAtmStrategyStopTargetOrderStatus("TARGET1", "idValue"); 
    
        // Check length to ensure that returned array holds order information 
        if (orders.Length > 0) 
        { 
            for (int i = 0; i < orders.Length - 1; i++) 
            { 
                Print("Average fill price is " + entryOrder[i, 0].ToString()); 
                Print("Filled amount is " + entryOrder[i, 1].ToString()); 
                Print("Current state is " + entryOrder[i, 2].ToString()); 
            } 
        } 
    }
    You need to use orders.GetLength(0) to determine the length of a multi dimensional array.

    in code above the for statement needs to be replaced with

    Code:
                string[,] orders = GetAtmStrategyStopTargetOrderStatus("TARGET1", entryATMs[level].AtmID); 
            
                // Check length to ensure that returned array holds order information 
                if (orders.Length > 0) 
                { 
                    for (int i = 0; i < orders.GetLength(0); i++) 
                    { 
                        Print("Average fill price is " + orders[i, 0].ToString()); 
                        Print("Filled amount is " + orders[i, 1].ToString()); 
                        Print("Current state is " + orders[i, 2].ToString()); 
                    } 
                }

    #2
    theperm,

    1) This is a bug, thank for reporting this. Its resolved for R3 update, might be a few weeks. We just released R2 within the last hour.

    2) You are right, thank for pointing out this documentation error, I will update the documentation for R3 release as well
    RayNinjaTrader Customer Service

    Comment


      #3
      There is something else regarding AtmStrategyChangeStopTarget().

      When you modify a stop or target to the same price as it allready is it doesnt return true.

      This makes it very difficult to write generic code to modify orders, As result i cant unsubscribe my modify handlers in my code cause of this. The only solution is to start calculating and storing lots of order prices so as not to try and modify order to the same price, all very messy indeed.

      I look as modifying to the same price as being successful, and any false returns telling me an error possibly occurred.

      Comment


        #4
        I see, let me think about this one. I will get back to you.
        RayNinjaTrader Customer Service

        Comment


          #5
          Think about it...

          If you issued a change to the same price then you obviously didnt know the order was allready at that price. If this was the case you want to know you where successfull in any event (literally!).

          I quess it only matters when the outcome is critical in an encapsulated OO event driven framework. Isn't this what .NET is suppose to be all about?
          Currently Ninjascript is severly crippled in this respect. Roll on when you guys open up the TradeMagic api. Until then, more adventurous developers like myself are going to try to emulate an event driven framework.

          Comment


            #6
            What happened was some time ago, the method did not check if the price was already at the proposed change to price and therefore it would always return true. Since this check was added, it would fall to the end of the method and return false.

            I will change this for the R3 release. Thanks for pointing this out.

            On another note, as we gain more experience in supporting these capabilities we will roll out more of the functionality that we have.
            RayNinjaTrader Customer Service

            Comment


              #7
              I understand your policies on supporting any advanced functionality. I dont see how it wouldnt hurt to make the entire functionality available, the API, generate an API help chm, using one of the automated tools, and make it quite clear there is no support for anything that is not mentioned in the main help/ninjascript reference.

              I like to think i am smart enough to figure most things out from an API doc alone as im sure a lot of seasoned developers would.
              If problems would arrise its because it would introduce to intelisense more properties and references, then you could have two modes, one that hides the unsupported api.

              Comment


                #8
                Most non exposed NT API functionality can not be used without a lot of support (which we can not deliver at this time). This has nothing to do with the smartness of the actual user.

                Comment


                  #9
                  this modify bug is proving to be a real thorn in my side. Each time i come up with a workarround, sooner or later it lets me down. Any chance of a quick patch release sometime soon. i cant afford to wait a few weeks for R3.

                  Comment


                    #10
                    Possibly but can't commit at this very moment. I will let you know if we decide to release something sooner.
                    RayNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by JonesJoker, 04-22-2024, 12:23 PM
                    7 responses
                    40 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by Waxavi, 04-19-2024, 02:10 AM
                    2 responses
                    37 views
                    0 likes
                    Last Post poeds
                    by poeds
                     
                    Started by chbruno, Yesterday, 04:10 PM
                    1 response
                    44 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by Max238, Today, 01:28 AM
                    1 response
                    24 views
                    0 likes
                    Last Post CactusMan  
                    Started by giulyko00, Yesterday, 12:03 PM
                    2 responses
                    10 views
                    0 likes
                    Last Post giulyko00  
                    Working...
                    X