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 strategist007, Today, 07:51 PM
      0 responses
      2 views
      0 likes
      Last Post strategist007  
      Started by StockTrader88, 03-06-2021, 08:58 AM
      44 responses
      3,967 views
      3 likes
      Last Post jhudas88  
      Started by rbeckmann05, Today, 06:48 PM
      0 responses
      4 views
      0 likes
      Last Post rbeckmann05  
      Started by rhyminkevin, Today, 04:58 PM
      4 responses
      55 views
      0 likes
      Last Post dp8282
      by dp8282
       
      Started by iceman2018, Today, 05:07 PM
      0 responses
      6 views
      0 likes
      Last Post iceman2018  
      Working...
      X