Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Loss attached to an indicator

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

    Stop Loss attached to an indicator

    Hello All,

    When using the Chart / Chart Trader interface and you place an order, you may then attach the order to an indicator. The order trigger price is automatically adjusted based on the dynamic indicator value for the current bar.

    I have reviewed this threads:
    Attach to Indicator command for NT8 (which points to the next thread)
    Set Stop Loss as an indicator value in Strategy Builder
    PriceOs.cs expecting "," which has code examples from NinjaTrader_ChelseaB, in particular ProfitChaseStopTrailIndicatorExample.cs

    As far as I can tell, there's no means to programmatically attached a stop loss order to an indicator. Is that correct?

    Instead, I will have to code the update of the stop loss order on each OnBarUpdate, if needed, correct?

    Thanks!
    Matt

    #2
    Hello StealthM93,

    It's done by using an indicator for the order price.

    Below is a link to an example.
    Hello support team, I have 2 dataseries, a 1minute to detect the ATR value. Now I would like to set the stoploss and profit target based on the actual ATR Value Example: Stoploss 2xATR Profittarget 3xATR value 1. How can this be done with builder, I have no coding experience 2. Later I would like to have the possibility to
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      Thank you for the quick reply!
      Yes, I'm aware of updating the stop loss / exit orders on each call of OnBarUpdate. What I'm asking for something like this (in pseudo code):

      private SMA myStopLossSMA;
      myStopLossSMA = SMA(8);

      protected override void OnBarUpdate() {
      if (--flat--) {
      // Logic and code to determine that I'm going to make a Long Entry
      SetStopLoss("MyEntryName", CalculationMode.Indicator, myStopLossSMA, false);
      Order myOrder = EnterLong(1, "MyEntryName");
      }
      }


      With that, I no longer have to update the stop loss order as NT8 will manage the update of the stop loss price automatically anytime the SMA changes. This is just like attaching an order to an indicator on the chart. That is, once done, then I do not have to do anything as the stop loss order trigger price is updated dynamically and automatically by NT8.

      Hopefully, this example makes my question more clear.

      Thanks!
      Matt

      Comment


        #4
        Hello Matt,

        No, an order price would have to set from the code.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          Thank you for confirming.

          Please add to the list of enhancements/ideas to have this functionality. NT8 certainly has the logic available since it is provided in the chart/DOM user interfaces. Please add a "hook" in the code API to do the same.

          Thank you!
          Matt

          Comment


            #6
            Hello Matt,

            I will submit a feature request for development to consider.

            Once I have a tracking ID I will post in this thread for future reference.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello Matt,

              Thanks for your patience.

              This is Brandon responding on behalf of Chelsea who is out of the office at this time.

              The internal tracking number for your feature request is SFT-5474. Please reference this internal tracking number when contacting Platform Support if you ever have questions regarding this feature request.

              When a feature request is implemented, you'll find a description of the new feature in the release notes:Let us know if we may assist further.
              <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              54 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              130 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              73 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              44 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              49 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X