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

Swing indicator questions

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

    Swing indicator questions

    Hi!
    I have two questions to the code of the standard NT Swing indicator.

    1) In what situations will the code in the "else branch" be executed, that is when (saveCurrentBar == CurrentBar) ? Why does it exist? The only situation I have figured out is when you loop through the indicator on historical bars, but I still don't understand the reason for the code in this situation, since the historical output values are stored in DataSeries.

    Code:
            protected override void OnBarUpdate()
            {
                if (saveCurrentBar != CurrentBar)
                {
                    /.../
                    
                    saveCurrentBar = CurrentBar;
                }
                [COLOR=Red]else
                {
                    /.../
                }[/COLOR]
            }
    2) Why do you have to use "Update()" in the properties section although you use the IDataSeries Class?

    Code:
    public DataSeries SwingLow
            {
                get 
                { 
                   [COLOR=Red] Update();[/COLOR]
                    return swingLowSeries; 
                }
            }
    /Regards

    #2
    Hello poseidon_sthlm,

    I will have someone reply to you on Monday. Thank you for your patience.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      poseidon, I believe the else branch is for situations where CalculateOnBarClose = false and the indicator needs to be re-drawn.

      Along those lines, the Update() is there so if the indicator is called, it will be updated (re-drawn) before the results are returned.
      AustinNinjaTrader Customer Service

      Comment


        #4
        Thanks for the reply. Although the option exists, it would be unusual to use the Swing indicator with COBC == false, in my opinion. But the code then makes sense.

        /Regards

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mongo, Today, 11:05 AM
        4 responses
        14 views
        0 likes
        Last Post Mongo
        by Mongo
         
        Started by traderqz, Today, 12:06 AM
        7 responses
        13 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Skifree, Today, 03:41 AM
        5 responses
        13 views
        0 likes
        Last Post Skifree
        by Skifree
         
        Started by traderqz, Yesterday, 09:06 AM
        5 responses
        34 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by guillembm, Today, 11:25 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X