Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 B11 OnRender not plotting anything

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

    #16
    My conversion

    That was kind of a pain... My first attempt following the examples here made the graph come out backwards, I think. So I played with it until I got it..

    With:
    Code:
    Series<double> fib382;  // This is the data series that holds the plot we're plotting in OnRender()
    This in B10
    Code:
    points.Add( new Point( chartControl.GetXByBarIndex( ChartBars, i-1 ), chartScale.GetYByValue( fib382[CurrentBar-i+1]) ) );
    becomes this in B11:
    Code:
    points.Add( new Point( chartControl.GetXByBarIndex( ChartBars, i-1 ), chartScale.GetYByValue( fib382.GetValueAt( i-1 )) ) );
    I bet you don't believe me, do you? Well, I lined the NT8 version up against the NT7 version and it fits! So... I'm going with it.

    But I don't get the 30-40 second wait for the indicator to pop up when a strategy loads it. I pops up lickety-split as a straight indicator but not so much from a strategy. Have you seen that Ninja support, or anyone?
    Last edited by traderpards; 05-19-2016, 06:59 PM.

    Comment


      #17
      Chart plots in reverse

      The same thing happened to me at first, the chart plotted backwards because barsback had not yet been changed to the absolute index of the current bar in the loop.

      Barsback is zero for the current bar and increases from right to left, while the absolute bar index starts at zero for Bar[0],and increases left to right.

      Also needed to set MaximumBarsLookBack to infinite for those series that are referenced by the OnRender methods.

      Before doing that I had 256 bar long patterns repeating over and over again.

      This cries out for a Ninjatrader reference sample.
      Last edited by Ricam; 05-19-2016, 08:56 PM.

      Comment


        #18
        Getting OnRender to work

        After some helpful suggestions from a forum member, I am combing thru my OnRenders, weeding out the (surprisingly many) spots where I had DataSeries references using the old approach myDataSeries[barsBack].
        Once I got these changed to use the correct bar number and GetValueAt ... my OnRender started working again.
        Last edited by photog53; 05-19-2016, 08:55 PM.

        Comment


          #19
          Originally posted by traderpards View Post

          But I don't get the 30-40 second wait for the indicator to pop up when a strategy loads it. I pops up lickety-split as a straight indicator but not so much from a strategy. Have you seen that Ninja support, or anyone?
          It would be hard to say what may be happening, I assume this is when it is being added via AddChartIndicator? If so this could be something to do with how indicators are Hosted vs being applied to the chart directly, if you have any sort of sample that can demonstrate the difference in load time I would appreciate it if I could take a look.

          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #20
            Yes, when adding them using AddChartIndicator(). I'm not sure either. However, when I load a strategy by checking the Enabled checkbox in the Strategies page of the control center, it loads right up. But when I check the Enabled field in the Strategies' properties grid, it's a crap shoot. It might load right up or it might take 20-40 seconds or it might not even load at all. (Or it would load after several minutes if I had the patience to wait for it.)

            More (just a few minutes later)

            This is timely. I just noticed the draw objects on my indicator are not drawing properly when I start a strategy using the Strategies properties grid Enabled button. When I start a strategy that way, I don't get my up/down arrow on the indicator the strategy initializes.

            But when I click the Enabled button in the Strategies page of the control center, I get my draw object - in this case, my up/down arrows.

            You are clearly doing something different in two areas where you should be doing the same thing - reusable code, and all of that object oriented stuff.
            Last edited by traderpards; 05-20-2016, 12:41 PM.

            Comment


              #21
              Hello,

              That is quite strange if it is having a different outcome when enabled in the control center versus a chart, although when enabled through the control center there is no chart associated so graphics would not be drawn.

              Outside of the location where it is activated, it would still be very difficult to say what may be happening.

              I will try some tests on my end regarding the usage, if I can confirm anything I will reply back otherwise any sort of sample would be appreciated as well.

              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #22
                Yes it's strange and it gets even stranger. I created a test strat and it works like a champ. It doesn't make any trades but it plots diamonds and arrows like it's supposed to. So I went back and tried my other strategies again and they now work.

                So I closed and restarted the workspace that has eight strategies in it, each with a strategy and tried a couple more and they worked now - I could see all the draw objects. Except those two strategies that I tried originally that didn't show any draw objects, didn't get saved when I closed the workspace and specifically said 'do not save' - (They had already been saved in the workspace.) <sigh>

                So next I thought I would check the strategy analyzer because I had to something like this in B10 so the strategy analyzer would actually run:
                Code:
                	if( ChartControl != null )
                	{
                		Draw.ArrowUp( this, "up"+CurrentBar, IsAutoScale, 0, SlowEMA[0]-ArrowOffset*TickSize, UpArrowColor );
                	}
                And I'll be damned if the arrows don't appear there too... (like they should.) BTW: The strategy analyzer in optimization mode is much, MUCH better, except for that persistent memory leak that must be a pain to track down - that remains but it's actually usable now. The memory leak comes back when you close Ninjatrader so at least it's not as bad as having to restart your computer to get it back.

                So then after having closed Ninjatrader to get my memory back, I restarted and those two more strategies that I turned on to check for the draw objects were blown away, leaving me with only three left out of eight - all eight were successfully saved in the workspace the first time I reported this to you. (When I went to close Ninjatrader, I had those two that I checked for the draw objects were enabled and I didn't disable them - I never do. I just said "do not save" when it asked me because they were already saved.)

                So something is definitely not right but it seems to be intermittent. I'm used to having my strategies blown away when Ninjatrader crashes, but I'm not used to it when it doesn't crash. And it's completely random. There's not going to be any way to track this down.

                I did check the Log tab and there are a couple of errors there - it's complaining about an error calling OnStateChange - object reference not set to an instance of an object. Then it says in a different message, "Indicator '<my indicator>': Error on calling 'OnRender' method on bar 0..." But there is no OnRender override in that indicator so I can't figure out where that is coming from, unless it's the base class call that is freaking out.

                Finally, I have two charts with two strategies running out of eight charts in one workspace and four charts out of four charts with a strategy running on each them. After restarting, I now have one strategy left in one workspace, out of eight originally and one strategy left in the other workspace, out of four, after saying "no to all" for saving.

                Comment


                  #23
                  Hello,

                  Thank you for the details.

                  The log message would be important related to the strategies being removed. For example if one of the indicators is using Drawing objects, a Plot, or basically calling any type that also uses OnRender that could be related to why the strategies are being removed. If the indicator cant start and causes the strategy to not start, it would likely be removed on starting the workspace.

                  If the error is specific in saying the strategy name and indicator name, you may be able to test for what syntax is causing the error as that may solve the problem.

                  Because the error is coming from OnStateChange, this could potentially be if the indicator was made in an earlier beta and has old syntax that no longer complies with what works correctly. It would be hard to say without debugging the script.

                  I look forward to being of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by maybeimnotrader, Yesterday, 05:46 PM
                  2 responses
                  20 views
                  0 likes
                  Last Post maybeimnotrader  
                  Started by adeelshahzad, Today, 03:54 AM
                  5 responses
                  32 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by stafe, 04-15-2024, 08:34 PM
                  7 responses
                  32 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by merzo, 06-25-2023, 02:19 AM
                  10 responses
                  823 views
                  1 like
                  Last Post NinjaTrader_ChristopherJ  
                  Started by frankthearm, Today, 09:08 AM
                  5 responses
                  22 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Working...
                  X