Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Why doesn't it work?

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

    Why doesn't it work?

    protected override void OnBarUpdate()
    {
    if (ChartBars == null) return;

    Print(ChartBars.GetTimeByBarIdx(ChartControl, CurrentBar));
    //or
    Print(Bars.GetTime(CurrentBar));
    }

    #2
    It should work in OnRender, hope it helps!

    Comment


      #3
      Yeah I know but I need it in OnBarUpdate.
      Here is an example in guide, it's used in OnBarUpdate: https://ninjatrader.com/support/help...mebybaridx.htm

      Comment


        #4
        Thanks for sharing the link, its working for me, see snapshot. Attaching code for reference. Hope it helps!
        Attached Files

        Comment


          #5
          Your indicator works. But it doesn't work if I put this code into my strategy. Looks like some NT limitations. I need time value to output it with StreamWriter in my strategy. So indicator won't help me.
          Last edited by Leeroy_Jenkins; 04-23-2021, 03:10 AM.

          Comment


            #6
            Check this out!
            Attached Files

            Comment


              #7
              Doesn't work.

              Comment


                #8
                can you share your strategy, what i shared was working for me.

                Comment


                  #9
                  See my 1st post. I tried put this into separate strategy. Same problem.
                  I updated my NT8 to the latest version cuz I used old one. Still nothing.

                  Comment


                    #10
                    Can you please clarify this:
                    1. When you try to print as I shared with your strategy, it works or not. Be sure not to include rest of your strategy, follow step by step to debug.
                    2. You said you're using StreamWriter in Post #5, can I assume it will output string. For the time being don't use this as yo need to be sure you're on right track.
                    3. Go step by step, line by line & see what exactly is not working, comment out what is not working & confirm what works.
                    Keep only 1 line in your code & see if it works so you will find where exactly your code is not working & it can then be fixed. I am suspecting one simple miss & believe it can be fixed easily. No hurries, sit relax then go line by line. Hint: if you need string to output in StramWriter, it may not work.

                    Comment


                      #11
                      Well, example from this link https://ninjatrader.com/support/help...mebybaridx.htm doesn't work for me in a simple strategy. There is nothing to debug. Looks like a bug to me.
                      Attached Files

                      Comment


                        #12
                        Glad to say your code is working at my end, see snapshot of output window.

                        Comment


                          #13
                          Let me also share StreamWriter working (as strategy for you).
                          Reference: https://ninjatrader.com/support/help..._resources.htm
                          Attached Files

                          Comment


                            #14
                            I think I should have asked this earlier, anyways may I ask you if you've enabled the strategy after adding ?
                            If not, that's the only problem, do this from strategy dialog box or control center -> Strategies tab.
                            Hope it helps!

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by aligator, Today, 02:38 PM
                            0 responses
                            5 views
                            0 likes
                            Last Post aligator  
                            Started by Stett0002, Yesterday, 11:55 PM
                            1 response
                            11 views
                            0 likes
                            Last Post NinjaTrader_ShawnB  
                            Started by KasLB, Today, 05:12 AM
                            2 responses
                            17 views
                            1 like
                            Last Post KasLB
                            by KasLB
                             
                            Started by LeitoGTR, Yesterday, 06:41 PM
                            1 response
                            11 views
                            0 likes
                            Last Post NinjaTrader_ShawnB  
                            Started by Prisalice, Today, 07:07 AM
                            1 response
                            10 views
                            0 likes
                            Last Post NT-Roland  
                            Working...
                            X