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

Big plot value makes it to disappear

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

    Big plot value makes it to disappear

    I made indicator that can mark some bars.

    It looks like this:

    Code:
            
            protected override void Initialize()
            {
                Add(new Plot(Color.FromKnownColor(KnownColor.RoyalBlue), PlotStyle.Bar, "Plot0"));
                Overlay                = true;
                AutoScale           = false;
            }
    
    
            protected override void OnBarUpdate()
            {
                if( CurrentBar < 1 ) return;          
                if( Time[1].Hour != Time[0].Hour ) Plot0.Set( 1000000 );
            }
    When indicator work on 8 range chart - it work normally.
    But when I put it on 1 range chart it also work ok until I scroll chart - after scrolling indicator disappeared.

    If i write Plot0.Set( 10000 ), it begin to work normally.

    What value I have to set to see vertical bar on all instruments and all charts?
    May be Close*2 ?
    Attached Files
    Last edited by fx.practic; 08-01-2015, 09:01 AM.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Code:
    Plot0.Set( Close*2 )
    worked good until I put
    Code:
    Plots[0].DashStyle = DashStyle.Dot;
    into OnStartUp(). After that, vertical lines disappeared again.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    Comment


      #3
      Are you getting any errors in your log tab on the control center?

      Comment


        #4
        Oh, thank You! Ofcourse, how can I forget to look there!

        There was errors - screenshot attached.

        So, what are the biggest and smallest valid plot values?
        Attached Files
        fx.practic
        NinjaTrader Ecosystem Vendor - fx.practic

        Comment


          #5
          Believe they are double.MaxValue and MinValue

          Comment


            #6
            This is logical. But, 1 000 000 produce error.
            And approximate range of double ±5.0 × 10−324 to ±1.7 × 10+308

            By the way, I found out that Plot0.Set( Close[0]*2 ) slows scroll significantly whem plots are visible.

            And Plot0.Set( Close[0] ) don't slows chart scrolling.
            fx.practic
            NinjaTrader Ecosystem Vendor - fx.practic

            Comment


              #7
              Close[0] +150* TickSize, for example, don't slow 1 range, but it looks strange on 16 range (screenshot).

              So the question: how to determine number of ticks that enough to hide upper edge of bar
              beyond upper chart edge (for different timeframes, scaling, instruments) ?


              (I know that it can be done by DrawVerticalLine() but big quantity of chart objects significantly slows operating with chart.)

              P.S.I use Close[0] +1000* TickSize for all CL charts now, but I don't like this solution at all.
              Attached Files
              Last edited by fx.practic; 08-01-2015, 02:18 PM.
              fx.practic
              NinjaTrader Ecosystem Vendor - fx.practic

              Comment


                #8
                Hello fx.practic,

                You could run something like MAX(), but then again you are concerned on performance and this will likely slow performance if you had MAX(High, CurrentBar-1)[0] as the plot.

                So you have a few choices, I would recommend experimenting until you find something that works best for your specific cases.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by trilliantrader, Yesterday, 03:01 PM
                3 responses
                29 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by cmtjoancolmenero, Yesterday, 03:58 PM
                4 responses
                26 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by Brevo, Today, 01:45 AM
                1 response
                14 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by rjbtrade1, 11-30-2023, 04:38 PM
                2 responses
                74 views
                0 likes
                Last Post DavidHP
                by DavidHP
                 
                Started by suroot, 04-10-2017, 02:18 AM
                5 responses
                3,022 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Working...
                X