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

Draw line on same high

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

    Draw line on same high

    Hello,
    i've a problem to determine the end position of the line.
    Like this:
    Code:
    DrawLine("Resistance",true,NbBarsPrevHighs,Highh,0,???????,Color.Navy,DashStyle.Solid,3);
    The ???? must be the same position of 'High' but at currentbar - 1.

    #2
    Hello mate41,

    Do you want the value of the "???????" to be same value as the "Highh" so that it is a horizontal line but plot 1 bar ago from the current, or did you want to just plot on the previous bars High[] value?

    Happy to be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Hi JC,
      yes i want the value of the "???????" to be same value as the "Highh" so that it is a horizontal line !

      Comment


        #4
        Hello mate41,

        Then you can set the "???????" to the same value as the "Highh" and if you would like it to plot 1 bar ago from the current bar you can use "1". For example:

        Code:
        DrawLine("Resistance",true,NbBarsPrevHighs,Highh, 1 ,Highh ,Color.Navy,DashStyle.Solid,3);
        Last edited by NinjaTrader_JC; 10-09-2012, 07:09 AM.
        JCNinjaTrader Customer Service

        Comment


          #5
          Thanks ,
          i did as follows and it works.
          Code:
          DrawLine("Resistance",true,NbBarsPrevHighs,PrevHigh + textOffset,0,PrevHigh + textOffset,Color.Navy,DashStyle.Dash,3);
          But i can't change the "PlotStyle" .... DrawLine don't support it i presume.

          Code:
          Add(new Plot(new Pen(Color.Blue,3), PlotStyle.TriangleUp, "Support"));
           Add(new Plot(new Pen(Color.Magenta,3), PlotStyle.Line, "Resistance"));
          Is there an other way i can modify the plot and dash style?

          Comment


            #6
            Hello mate41,
            You can change the dash style of the plot using the following code.

            Code:
            protected override void Initialize()
            {
               Add(new Plot(new Pen(Color.Blue,3), PlotStyle.TriangleUp, "Support"));
               Add(new Plot(new Pen(Color.Magenta,3), PlotStyle.Line, "Resistance"));
               Plots[0].Pen.DashStyle = DashStyle.Dash;
               Plots[1].Pen.DashStyle = DashStyle.Dash;
            
               //other codes
            }
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              Thanks,
              but it didn't solve the problem.
              As you can see DrawLine do not accept some of Plot.
              The DashStyle is not the problem, it's the PlotStyle.
              Attached Files
              Last edited by mate41; 10-09-2012, 06:57 AM.

              Comment


                #8
                Hello mate41,

                The Plot object is going to be different than the a Line object so there is not going to have the same styles or functionality. If you would like to use the different Plot styles you would have to change from using the DrawLine() method to using the Plot Class inside the indicator.

                http://www.ninjatrader.com/support/h...plot_class.htm
                JCNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by wzgy0920, 04-20-2024, 06:09 PM
                2 responses
                27 views
                0 likes
                Last Post wzgy0920  
                Started by wzgy0920, 02-22-2024, 01:11 AM
                5 responses
                32 views
                0 likes
                Last Post wzgy0920  
                Started by wzgy0920, 04-23-2024, 09:53 PM
                2 responses
                49 views
                0 likes
                Last Post wzgy0920  
                Started by Kensonprib, 04-28-2021, 10:11 AM
                5 responses
                193 views
                0 likes
                Last Post Hasadafa  
                Started by GussJ, 03-04-2020, 03:11 PM
                11 responses
                3,235 views
                0 likes
                Last Post xiinteractive  
                Working...
                X