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

Question about OnBarUpdate()

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

    Question about OnBarUpdate()

    Here's my code:
    Code:
    protected override void OnBarUpdate()
    {
        // Prints the current bar time stamp
        Print(Time[0].ToString());
    }
    Since CalculateOnBarClose is set to true as default, it's supposed to only print on the close of each bar. However, the output window continuously prints timestamps even the bar is not closed. Am i missing something?

    #2
    Hello misotrader,

    May we have a screenshot of the parameters for this indicator as its set on the chart?
    (So we can confirm that CalculateOnBarClose is set to True)

    Do you have a secondary series added to your script in Initialize()?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Sure

      Comment


        #4
        Hi misotrader,

        Thank you. This screenshot shows that a secondary data series has not been added to the script.

        May we have a screenshot of the parameters for this indicator as its set on the chart?
        Right-click the chart -> select Indicators... -> select the Indicator -> take a screenshot
        (So we can confirm that CalculateOnBarClose is set to True)

        Also, may we have the output from the output window?
        Right-click the Output window -> select Save As... -> give the file a name and save location
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Somehow the chart did not pick up the updated parameter even it's compiled and rerun.
          I explicitly set CalculateOnBarClose to true in chart -> Indicators, now it works!

          Comment


            #6
            Hi misotrader,

            The default values set in Initialize() are only used when adding a new instance of the indicator to the chart. (So that if you change these values, it does not undo your changes)
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mupulen, 04-16-2024, 11:26 AM
            1 response
            54 views
            0 likes
            Last Post techbech  
            Started by Quanto, Today, 02:17 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by cmtjoancolmenero, 04-25-2024, 03:58 PM
            24 responses
            125 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by Skifree, Today, 11:21 AM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by manueldecastro, Today, 01:16 PM
            3 responses
            14 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Working...
            X