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

Need to draw vertical and horizontal lines

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

    Need to draw vertical and horizontal lines

    hello,

    I have some price levels and certain dates (pre determined). I want to put that info into an indicator so that whenever I open the chart and load this indicator they are always there.

    I tried to draw a vertical line on 17th march 2015, but it is not showing up. There are no errors in the code btw.
    Code:
      public class Dates : Indicator
        {
            #region Variables
            // Wizard generated variables
                private uint date; // Default setting for MyInput0
            // User defined variables (add any user defined variables below)
            #endregion
    
            /// <summary>
            /// This method is used to configure the indicator and is called once before any bar data is loaded.
            /// </summary>
            protected override void Initialize()
            {
                Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
                Overlay				= true;
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
     			 protected override void OnBarUpdate()
            {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
    			//           if (date == 20150317 && FirstTickOfBar)
    			//			DrawVerticalLine("MyVerticalLine", 0, Color.Blue);
    			if (ToTime(Time[0]) == 00000 && ToDay(Time[0]) == 20150317 && FirstTickOfBar) 
    			
    			DrawVerticalLine( "myTag", 20150317  , Color.Blue, DashStyle.Dash , 2);
    Why is this not working ?

    Also please mention how to draw lines at specific price levels using ninjascript

    #2
    Hello karthik007,

    What time interval are you using on the chart? Minute, Daily, Tick
    Cal H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Segwin, 05-07-2018, 02:15 PM
    10 responses
    1,769 views
    0 likes
    Last Post Leafcutter  
    Started by Rapine Heihei, 04-23-2024, 07:51 PM
    2 responses
    30 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by Shansen, 08-30-2019, 10:18 PM
    24 responses
    943 views
    0 likes
    Last Post spwizard  
    Started by Max238, Today, 01:28 AM
    0 responses
    10 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by rocketman7, Today, 01:00 AM
    0 responses
    7 views
    0 likes
    Last Post rocketman7  
    Working...
    X