Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Parameters

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

    Indicator Parameters

    Hi, I'm writing an indicator that draws horizontal lines. I want the line style (eg., dot, dash,etc) and the line color to be selected from a drop down list when loading the indicator on a chart. Can you direct me to an example where this is coded? thanks!

    #2
    Originally posted by pman777 View Post
    Hi, I'm writing an indicator that draws horizontal lines. I want the line style (eg., dot, dash,etc) and the line color to be selected from a drop down list when loading the indicator on a chart. Can you direct me to an example where this is coded? thanks!
    Just program the line in the code's Initialize() method. The line class parameters are available in the dialog box by default. If you need help programming the line syntax, use the Indicator Wizard: it has a specific dialog for creating lines.

    Comment


      #3
      thanks ... I'm new to Ninja script so I'm not sure I'm doing this the best way ... below is the code I have ... can you comment on how I can achieve these drop down boxes with this code? Tx

      #region Variables
      // Wizard generated variables
      private int res01 = 1 ;
      private int res02 = 1 ;
      private int sup01 = 1 ;
      private int sup02 = 1 ;
      private int rlt = 1 ;
      private int slt = 1 ;



      // User defined variables (add any user defined variables below)

      #endregion



      /// </summary>
      protected override void Initialize()
      {
      CalculateOnBarClose = true;

      }

      protected override void OnStartUp() // creating an internal reference to the indicator to save resources
      {

      }

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate()
      {


      DrawHorizontalLine("Res01", false, res01, Color.LightSkyBlue , DashStyle.Dot, rlt);

      DrawHorizontalLine("Res02", false, res02, Color.LightSkyBlue , DashStyle.Dot, rlt);

      DrawHorizontalLine("Sup01", false, sup01, Color.Peru , DashStyle.Dot, slt);

      DrawHorizontalLine("Sup02", false, sup02, Color.Peru , DashStyle.Dot, slt);


      }

      Comment


        #4
        You would need to implement it through the Lines collection - http://www.ninjatrader.com/support/h.../nt7/lines.htm

        This is what the indicator wizard would setup for you easily as well...
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ninza33, Yesterday, 12:31 PM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by patrickmlee007, Today, 09:33 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
        53 responses
        5,306 views
        0 likes
        Last Post BartMan
        by BartMan
         
        Started by Richozzy38, Today, 01:06 PM
        2 responses
        12 views
        0 likes
        Last Post Richozzy38  
        Started by Lele2k24, Today, 01:32 PM
        4 responses
        10 views
        0 likes
        Last Post Lele2k24  
        Working...
        X