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 Aviram Y, Today, 05:29 AM
              0 responses
              1 view
              0 likes
              Last Post Aviram Y  
              Started by quantismo, 04-17-2024, 05:13 PM
              3 responses
              25 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by ScottWalsh, 04-16-2024, 04:29 PM
              7 responses
              34 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by cls71, Today, 04:45 AM
              0 responses
              6 views
              0 likes
              Last Post cls71
              by cls71
               
              Started by mjairg, 07-20-2023, 11:57 PM
              3 responses
              216 views
              1 like
              Last Post PaulMohn  
              Working...
              X