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

Is it possible to have an indicator calculate every other bar?

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

    Is it possible to have an indicator calculate every other bar?

    I downloaded a wonderful indicator from the other section of this forum. However, I found that for me... it's best used on a chart that is twice as long as the chart I used for entries (ie... if I was looking at a 1000 tick chart, then the 2000 tick chart readings of the indicator would be the base of my signal).

    normally, i would just put both charts in one window... however, because of the quirk that NT has where it doesn't evenly space bars out... my chart gets bungled in a hurry.

    Is there a way to mod the indicator to calculate every other bar? if so, can you help? thanks

    #2
    Hello SinatraFan,
    You have to modify the indicator and create a multi series indicator to do it.

    Unfortunately we do not do custom NinjaScript coding. To develop your custom indicator/strategies you can contact any of our independent NinjaScript consultants. You can get the list of our NinjaScript consultants from here http://www.ninjatrader.com/partners#...pt-Consultants
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      is there a tutorial or example code for this multi series?

      Comment


        #4
        Hello SinatraFan,
        Yes, you can refer to our help guide to know more about the multi-series codes.



        You can also refer to the NinjaScript codes which comes natively with NinjaTrader.
        • In Control Center menu bar goto Tools>Edit NinjaScript>Strategies
        • In the Strategies dialog please refer to the code SampleMultiTimeFrame/SampleMultiInstrument.


        You can also refer to this sample code
        Note: In NinjaTrader 8 It is no longer needed to use an indicator to sync a secondary series. This can be done directly from the Series<T> (https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?seriest.htm) constructor. This post is left for historical purposes. Series objects are useful for
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          I might be misunderstanding what you want to do, but if you just want to have the indicator calculate every other bar, couldn't you just do something like:

          if (CurrentBar % 2 == 0) return;

          Comment


            #6
            while I am no expert on Ninjacode, another possible method is to create code that counts bars.

            divide the count by 2, check remainder - if no remainder (even bars) then you execute the indicator code.

            Inside this loop put the indicator code.

            Comment


              #7
              i think the challenge is... you have to create "virtual bars" because even if you told the code to wait until every other bar... it would still calculate off of EACH close value. this would generate the wrong outcome

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by r68cervera, Today, 05:29 AM
              0 responses
              2 views
              0 likes
              Last Post r68cervera  
              Started by geddyisodin, Today, 05:20 AM
              0 responses
              3 views
              0 likes
              Last Post geddyisodin  
              Started by JonesJoker, 04-22-2024, 12:23 PM
              6 responses
              33 views
              0 likes
              Last Post JonesJoker  
              Started by GussJ, 03-04-2020, 03:11 PM
              12 responses
              3,239 views
              0 likes
              Last Post Leafcutter  
              Started by AveryFlynn, Today, 04:57 AM
              0 responses
              6 views
              0 likes
              Last Post AveryFlynn  
              Working...
              X