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

Hourly CPR Indicator feedback

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

    Hourly CPR Indicator feedback

    Are you able to give feedback on an indicator I've developed? It's a hourly CPR indicator. I'm trying to figure out how to add a future CPR to show the upcoming 1 hour CPR. I'll post the indicator if this is something that can be done here.







    #2
    I need to add a bit more to this post. In particular it's working great. My formula for calculating the CPR for the previous1H period and displaying it on the current 1H period is as follows:

    Pivot = ((Highs[1][0] + Lows[1][0] + Closes[1][0]) / 3);
    Bcpr = ((Highs[1][0] + Lows[1][0]) / 2 );
    Tcpr = (Pivot - Bcpr + Pivot);

    I'm confused as to why the [1][0] calculates the previous 1H bar rather than the current. I'd like to calculate the current 1H bar so I can display it ahead of the current 1H period. I would think that should be [1][0] and the previous 1H would be [1][1]. I have a secondary series as AddDataSeries(Data.BarsPeriodType.Minute, 60); Maybe I'm way off on how this should be done.

    Comment


      #3
      Hello abandonedBaby,

      Thanks for your post.

      Highs[1][0] would refer to the current bar high price of the first added secondary series in the script. A BarSeriesIndex of 1 would refer to the first added secondary series in your script. BarsAgo 0 refers to the current bar's High price.

      Highs[1][1] would refer to the previous bar's high price of the first added secondary series in the script.

      Note if your indicator is set to use Calculate.OnBarClose, OnBarUpdate() logic only processes at the close of a bar. This means that Highs[1][0] would refer to the high price of the most recently closed bar of the first added secondary series.

      See this help guide page about Highs: https://ninjatrader.com/support/help.../nt8/highs.htm

      See this help guide page about Calculate: https://ninjatrader.com/support/help.../calculate.htm

      See this help guide page about working with Multi-TimeFrame/Multi-Instrument NinjaScripts: https://ninjatrader.com/support/help...nstruments.htm

      I recommend adding debugging prints to your script that prints out all the values being used for calculations to understand exactly how the logic in your script is evaluating.

      Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

      Below is a link to a forum post that demonstrates how to use prints to understand behavior.



      Brandon H.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Haiasi, 04-25-2024, 06:53 PM
      2 responses
      17 views
      0 likes
      Last Post Massinisa  
      Started by Creamers, Today, 05:32 AM
      0 responses
      5 views
      0 likes
      Last Post Creamers  
      Started by Segwin, 05-07-2018, 02:15 PM
      12 responses
      1,786 views
      0 likes
      Last Post Leafcutter  
      Started by poplagelu, Today, 05:00 AM
      0 responses
      3 views
      0 likes
      Last Post poplagelu  
      Started by fx.practic, 10-15-2013, 12:53 AM
      5 responses
      5,408 views
      0 likes
      Last Post Bidder
      by Bidder
       
      Working...
      X