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

Find all StopLoss orders Atm Strategy creates in Sample ATM Strategy

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

    Find all StopLoss orders Atm Strategy creates in Sample ATM Strategy

    Currently i have implemented a customized version of the Sample ATM Strategy included in NT8. The ATM I am using creates one stop for a potion of the order and another for the second portion. The first portion contains a stop and target while the second has just a trailing stop with no target. I am trying to go through the stops and set them to BE even when I do not know how many the ATM created. The ATM dynamically creates the stop order names to "Stop1" "Stop2" "Stop3" etc. I currently have implemented a quick loop from 1 to the total ATM qty and dynamically built the name using "Stop"+loopIndex. This works but does produce errors printing to the output log like "'AtmStrategyChangeStopTarget' method error: Order name 'STOP10' is invalid".

    I would like to just loop through the stop orders created by the ATM.

    Any Ideas?

    Thanks,
    Mark

    #2
    Hi Mark, thanks for posting. The for loop would need to stop at the last ATM that is created. You can have an int variable representing the max number, or keep a counter to keep track off all the ATMs that were created.

    private int MAXATMCOUNT = 3;

    for(int i = 1; i <= MAXATMCOUNT; i++)
    {
    Print(i); //this will print 1 through 3. Use it to build a string e.g. Print("STOP"+i);
    }
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Ellis, to count how many ATMs were created will take C# code and trial and error testing on your end. The alternative is to use OnOrderUpate to monitor the stops and targets. We have an example of this here:


      Start out by using Print() to print out the data coming from OnExecutionUpdate/OnOrderUpdate. Prints will be the best way to debug and find the correct data to target since you are workint with the ATM strategy methods.

      Kind regards,
      -ChrisL
      Chris L.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by llanqui, Today, 10:32 AM
      0 responses
      2 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by StockTrader88, 03-06-2021, 08:58 AM
      45 responses
      3,992 views
      3 likes
      Last Post johntraderuser2  
      Started by TAJTrades, Today, 09:46 AM
      0 responses
      8 views
      0 likes
      Last Post TAJTrades  
      Started by rhyminkevin, Yesterday, 04:58 PM
      5 responses
      62 views
      0 likes
      Last Post dp8282
      by dp8282
       
      Started by realblubb, Today, 09:28 AM
      0 responses
      8 views
      0 likes
      Last Post realblubb  
      Working...
      X