Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can i set AutoScale property?

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

    How can i set AutoScale property?

    Hello,

    I have a strategy and using custom plots inside that strategy. Plots for plot higher time frame indicator's value because of that there is big gaps between instrument prices and indicator values, candles squeeze inside narrow area. How can i set auto scale to false for these custom plots?

    Thanks,
    Aytac

    #2
    Hello aytacasan,

    Thanks for writing in to our Support Forums!

    You can set the plots of your NinjaScript to draw with AutoScale disabled by setting IsAutoScale to false inside OnStateChange() when the State is State.SetDefaults.

    Please consider the sample code from the help documentation:

    Code:
    protected override void OnStateChange()
    {
      if (State == State.SetDefaults)
      {         
        Name                 = "Example Indicator";         
        // set this to true to call CalculateMinMix() to ensure drawing tool is fully rendered in chart scale
        IsAutoScale = true; 
      }
      else if (State == State.Configure)
      {
      }
    }

    This code will set all of the plots to AutoScale. If we set IsAutoScale to false, the plots will not be set to draw with AutoScale.

    Drawing objects that you are adding from your indicator or strategy will have to use the isAutoScale argument of the Drawing Object's calling method. You may observe the function prototypes from Draw.Line() for reference.

    Code:
    Draw.Line(NinjaScriptBase owner, string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Brush brush)
    Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, Brush brush, DashStyleHelper dashStyle, int width)
    Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, DateTime startTime, double startY, DateTime endTime, double endY, Brush brush, DashStyleHelper dashStyle, int width)
    Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, Brush brush, DashStyleHelper dashStyle, int width, bool drawOnPricePanel)
    Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, DateTime startTime, double startY, DateTime endTime, double endY, Brush brush, DashStyleHelper dashStyle, int width, bool drawOnPricePanel)
    Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, DateTime startTime, double startY, DateTime endTime, double endY, string templateName)
    Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, string templateName)
    Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, bool isGlobal, string templateName)
    Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, DateTime startTime, double startY, DateTime endTime, double endY, bool isGlobal, string templateName)


    You may also wish to set the properties of each indicator separately. We have a reference sample that may be of help: http://ninjatrader.com/support/forum...ead.php?t=6651

    Please let me know if you have any further questions.
    Last edited by NinjaTrader_Jim; 03-07-2017, 09:01 AM.

    Comment


      #3
      Hello Jim,

      Thanks for your very detailed answer. I appreciate you.

      Thanks,
      Aytac

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      41 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      20 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      27 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      45 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      37 views
      0 likes
      Last Post CarlTrading  
      Working...
      X