Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATM Strategy Signal Name

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

    ATM Strategy Signal Name

    Originally posted by NinjaTrader_AlanP View Post
    Hello fx.practic,

    Thank you for your note.

    If you replace, "STOP1" with fx.practic "Stop1", do you no longer receive the error?



    I look forward to your reply.
    I have the exact same issue.

    I've changed the text from "STOP1" to "Stop1" and I still get the issue with the error.

    Also, I have run the sampleATM script, and I note that it also does not adjust the stop to 3 ticks below the low of the bar?

    Is the AtmStrategyChangeStopTarget() an asynchronous call in the same way that AtmStrategyCreate() is?

    #2
    Hi forrestang, thanks for posting. I moved your post from the old one since it was from 2018, reference post:
    https://ninjatrader.com/support/foru...op1-is-invalid

    I will need to test our example tomorrow since we are at the end of office hours today. The signal name should be "Stop1" not "STOP1" so it may require a change. Are you doing the same checks before calling AtmStrategyChangeStopTarget()? e.g.

    Code:
    if (atmStrategyId.Length > 0)
    {
        // You can change the stop price
        if (GetAtmStrategyMarketPosition(atmStrategyId) != MarketPosition.Flat)
            AtmStrategyChangeStopTarget(0, Low[0] - 3 * TickSize, "Stop1", atmStrategyId);

    Comment


      #3
      Howdy ChrisL.

      So, I am still working with the list that contains multiple orders.

      I can actually get the stop to update. I do this right after I check for the order status using "GetAtmStrategyEntryOrderStatus()".

      After getting the order status, I populate a list with a bool of "InTrade[i]", which just is a flag checked against the order status being equal to "Filled".

      The above all works properly.

      Lastly, I loop through and find values that have an orderId, have had the atmstrategyCreated, and are currently filled. So I'm checking that a valid order exists and has been filled.

      I can actually update the stop with this:
      Code:
      for (int i=0; i < _price.Count; i++)
      {
          if (_orderId[i].Length > 0 && _isAtmStrategyCreated[i] && _inTrade[i] /* && _ticsSinceEntry[i] ==0 */)
         {
            if (GetAtmStrategyMarketPosition(_atmStrategyId[i]) != MarketPosition.Flat )
               AtmStrategyChangeStopTarget(0, _stopPrice[i], "Stop1", _atmStrategyId[i]);
      
            _ticsSinceEntry[i] =_ticsSinceEntry[i] +1; //So this is only done ONCE
         }
      
      }
      The above will place the order in the correct location. HOwever, I would like to have the option to adjust the stop if I choose. And with the above, it updates ALL the time, so if you manually move the stop, it replaces it.

      So thats why that IF statement has the comment in it, as I was only trying to run this ONCE, so the manual adjustment will be possible.

      Comment


        #4
        Also of note, I do see that the AtmSampleStrategy is working properly. I wasn't paying attention. I can see how it continually readjusts the stop to 3 ticks below the low of the bar.

        It also doesn't produce any errors(the sample atm strategy), so my issue must be related to creating multiple stops, and my attempt at getting it to work only once so that the stop can be adjusted AFTER its seeded with its initial values.

        Another question. Does the "orderName" parameter need to be unique like the string tag on a drawn object? I have tried renaming them to unique identifiers and still get the stop issue.
        Last edited by forrestang; 04-15-2022, 06:18 AM.

        Comment


          #5
          Hi forrestang, thanks for the follow up. Use a boolean variable to act as a flip switch e.g.

          private bool flag = false;

          if(!flag)
          {
          for (int i=0; i &amp;lt; _price.Count; i++)
          {
          //perform price move
          }
          flag = true;
          }

          The flag can be reset with some additional code conditions or by using a custom button.

          ​​​​​​​

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          62 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          134 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          75 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          50 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X