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 kevinenergy, Yesterday, 12:01 PM
      6 responses
      22 views
      0 likes
      Last Post kevinenergy  
      Started by DawnTreader, 05-08-2024, 05:58 PM
      15 responses
      46 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by ZeroKuhl, Yesterday, 04:31 PM
      7 responses
      40 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by xepher101, Today, 12:19 PM
      1 response
      22 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by jpeep, 08-16-2020, 08:31 AM
      16 responses
      498 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X