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

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.
    Brandon H.NinjaTrader Customer Service

    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 futtrader, 04-21-2024, 01:50 AM
      4 responses
      41 views
      0 likes
      Last Post futtrader  
      Started by Option Whisperer, Today, 09:55 AM
      1 response
      11 views
      0 likes
      Last Post bltdavid  
      Started by port119, Today, 02:43 PM
      0 responses
      3 views
      0 likes
      Last Post port119
      by port119
       
      Started by Philippe56140, Today, 02:35 PM
      0 responses
      4 views
      0 likes
      Last Post Philippe56140  
      Started by 00nevest, Today, 02:27 PM
      0 responses
      2 views
      0 likes
      Last Post 00nevest  
      Working...
      X