Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to create multiple bars range

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

    How to create multiple bars range

    I am using this below. I have a Length input which in this case is 6 but I would like to code that the Close minus the open of the Length input is calculated and then can be changed using the Length input ANY help appreciated. I know that on a RED bar that the Close - Open will create a negative for that part of the calculation (which is what I want - NOT looking for ATR calculations

    AverageBody[0] = ( ( (Close[0] - Open[0]) + (Close[1] - Open[1]) + (Close[2] - Open[2]) + (Close[3] - Open[3]) + (Close[4] - Open[4]) + (Close[5] - Open[5]) ) / Range_[Length] );

    #2
    Hello DTSSTS,

    Thanks for your notes.

    There are no supported NinjaScript methods or properties to accomplish this goal.

    You would have to come up with your own custom logic to go about accomplishing this specific goal in a script.

    This forum thread will be open for other community members to share their insights on custom logic you could consider using to accomplish this.
    <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


      #3
      I knew by your reply that it could be done. The way you worded made me instantly think of the solution.

      SMACloseLength = SMA(Close, Length);
      SMAOpenLength = SMA(Open, Length);


      (SMACloseLength[0] - SMAOpenLength[0])

      Thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      599 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      344 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      558 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      557 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X