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

Please look at this code and tell me why it won't work

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

    Please look at this code and tell me why it won't work

    Hi;

    I'm trying to make this work in Market Analyzer.

    It was working at one time but now it's not. I'm adding the indicator to Mrkt Analyzer 9 times for the nine plots, and now all plots show the same value (in trying to figure it out I've tried to make each plot simply show a different sma and even then all the plots show the same value for the instrument.)

    I'm loading 360 days of data and lookback set to infinite.

    Thanks for your help.


    Attached Files

    #2
    It looks to me like you would still need to load more data, perhaps try it with at least 560 bars?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      That's right, I needed to load more bars. Thank you!!!

      How did you know? the longest MA is 200 so why wouldn't 300 be enough? thanks

      Comment


        #4
        Because you already skip the 360 bars at the start of your series.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          So you came to 560 by 360 + 200?

          And, the 360 comes from the stmt: if (CurrentBar < 360) return; correct?

          I understand this to mean "if there isn't enough data loaded then don't start"

          I don't understand how this would "skip" bars. I only put this stmt in because I thought it good programming. Do I misunderstand?


          Thanks for your help!

          Comment


            #6
            Yes - it skips bars your MA's would need to initialize properly, the technique to return out of OnBarUpdate() for certain bars in only needed really if you work with bars indices for your codes, so for example trying to get a SMA value 10 bars back at CurrentBar 0 > this will not work, as there's simply no bars to the left from this starting point.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Irukandji, Today, 09:34 AM
            0 responses
            1 view
            0 likes
            Last Post Irukandji  
            Started by TraderBCL, Today, 04:38 AM
            3 responses
            24 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by WeyldFalcon, 08-07-2020, 06:13 AM
            11 responses
            1,423 views
            0 likes
            Last Post jculp
            by jculp
             
            Started by RubenCazorla, Today, 09:07 AM
            0 responses
            4 views
            0 likes
            Last Post RubenCazorla  
            Started by BarzTrading, Today, 07:25 AM
            2 responses
            29 views
            1 like
            Last Post BarzTrading  
            Working...
            X