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

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.
    JimNinjaTrader Customer Service

    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 Tim-c, Today, 03:54 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by rocketman7, Today, 01:00 AM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by wzgy0920, 04-23-2024, 09:53 PM
      3 responses
      76 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by JonesJoker, 04-22-2024, 12:23 PM
      9 responses
      46 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by timko, Today, 06:45 AM
      1 response
      7 views
      0 likes
      Last Post gaz0001
      by gaz0001
       
      Working...
      X