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

Plot Thresholds - does NOT prevents Autoscale

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

    Plot Thresholds - does NOT prevents Autoscale

    If I have simple indicator, eg. SMA and I do not want to display it during some times, I can do it so:

    if( some condition )
    Values[0].Set( SMA(Period)[0] )
    else
    Values[0].Set(-1) // this I do not want to view

    So I prevent displaying it by setting

    Plots[0].Min = 0; // this prevents displaying values less then 0

    BUT!!! This works very bad when I have set indicator's AutoScale = true!!! Values -1 are not displayed, but I see all range from -1 up to prices!!!! Can this be corrected or am I missing something?

    Another possilibily I have deal with this earlier was that during some times I have not set Values at all. This works good visually, but Values not set have some random numbers ( I have printed values in strategies via Print).

    #2
    valecko, welcome to our forums - correct if you don't set a value there's a 'dummy' one then present.

    For your use the .Reset method should work best :

    Calling the Reset() method is unique and can be very powerful for custom indicator development. DataSeries objects can hold null values which simply means that you do not want to store a value for the current bar. Mathematically, you can correctly assign a value of zero however if the DataSeries was the primary DataSeries of an indicator whose values would be used for plotting, you may NOT want a zero value plotted. Meaning, you want a zero value for proper calculations but not a zero value for chart visualization. The Reset() method allows you to reset the current bar's DataSeries value to a zero for calculation purposes but NinjaScript would ignore this value when it plotted it on a chart.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand, thanks for quick reply. Reset is good but it works the same as if I do not Set any Value - then the plotting is OK, but if I Print Value, there is Close[0] number, not a zero.
      I have tested this:

      CurrentOpen.Reset();
      Print( CurrentOpen[0] );

      Value printed was the same as Close[0]

      But fortunately I can use something like this
      Print( CurrentOpen.ContainsValue(0)?CurrentOpen[0]:0 )
      to overcome this. But this is extra work:-(((

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by kempotrader, Today, 08:56 AM
      0 responses
      6 views
      0 likes
      Last Post kempotrader  
      Started by kempotrader, Today, 08:54 AM
      0 responses
      4 views
      0 likes
      Last Post kempotrader  
      Started by mmenigma, Today, 08:54 AM
      0 responses
      2 views
      0 likes
      Last Post mmenigma  
      Started by halgo_boulder, Today, 08:44 AM
      0 responses
      1 view
      0 likes
      Last Post halgo_boulder  
      Started by drewski1980, Today, 08:24 AM
      0 responses
      3 views
      0 likes
      Last Post drewski1980  
      Working...
      X