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 do I create and display on a chart a line parallel to my custom indicator?

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

    how do I create and display on a chart a line parallel to my custom indicator?

    how do I create and display on a chart a line parallel to my custom indicator?

    #2
    Hello joemiller,

    Thank you for your post.

    Are you looking for a line plotted at a set number from the original plot?

    Can you provide a screenshot of a chart with an example of what you are looking for?

    I look forward to your response.

    Comment


      #3
      I want to draw a line parallel [constant displacement] to the red indicator line displayed in the attachment.
      perhaps is can best be done by a separate indicator, or by more code in the same indicator, etc?
      Attached Files

      Comment


        #4
        Hello joemiller,

        Thank you for your response.

        It may be easier to add the additional plot to the current indicator.

        You could displace the line using + or - a number:
        Code:
        myCustomPlot.Set(joeXXOindicator()[0] + myDisplacement);
        You can find a reference sample on plots at the following link as well: http://www.ninjatrader.com/support/f...ead.php?t=3227

        Please let me know if I may be of further assistance.

        Comment


          #5

          I tried several things with no success [eg]

          Add(new Plot(new Pen(Color.Red, 2), "PlotXXO_1")); //initialize region
          PlotXXO_1.Set(joeXXOindicator()[0] + 0.00500);//onbarupdate region

          I have no idea how to make it work. please advise.


          Comment


            #6
            Hello joemiller,

            Thank you for your update on this item.

            Please attach the indicator to your response so I may provide an example of how to set this plot.

            Comment


              #7
              indicator is attached.

              indicator is attached.

              thanks Patrick
              Attached Files

              Comment


                #8
                Originally posted by joemiller View Post
                I tried several things with no success [eg]

                Add(new Plot(new Pen(Color.Red, 2), "PlotXXO_1")); //initialize region
                PlotXXO_1.Set(joeXXOindicator()[0] + 0.00500);//onbarupdate region

                I have no idea how to make it work. please advise.


                Did you define the Plot's access properties?

                Comment


                  #9
                  I don't have a clue what an access property is. Sounds like a good lead, which I would pursue if I were not waiting for Patrick's reply.

                  thanks for the response.

                  Comment


                    #10
                    Hello joemiller,

                    Thank you for your response.

                    Koganam was correct, the plot needs to be defined in the properties:
                    Code:
                            #region Properties
                            [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                            [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                            public DataSeries PlotXXO
                            {
                                get { return Values[0]; }
                            }
                    		
                           [B] [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                            [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                            public DataSeries PlotXXO_1
                            {
                                get { return Values[1]; }
                            }[/B]
                    In addition, adding the value of 0.005 may not even be noticeable on some instruments. I tried this on the ES and I had to expand the chart on the y-axis to even see the new plot. I tried the following and received more desirable results no matter the instrument:
                    Code:
                    PlotXXO_1.Set(XXOpen + (1*TickSize));
                    For information on TickSize please visit the following link: http://www.ninjatrader.com/support/h...7/ticksize.htm

                    Please let me know if I may be of further assistance.

                    Comment


                      #11
                      thanks Patrick & Koganam
                      worked like a charm

                      Comment


                        #12
                        In the initialize region I added the statement
                        ‘Add(new Plot(new Pen(Color.Black, 1), "PlotXXO_1"));’
                        patterned after
                        ‘Add(new Plot(new Pen(Color.Red, 2), "PlotXXO"));’

                        hoping that it would generate the parallel line in a black instead of a red color. However it did not work. I blindly tried several fixes without success. Should I maybe have something additional in the properties region or elsewhere?

                        Comment


                          #13
                          Hello joemiller,

                          Thank you for your response.

                          Please remove the indicator from your chart and then add it back, this should correct the plot.

                          Comment


                            #14
                            thank you Patrick
                            it worked

                            Comment


                              #15
                              I cannot get the following DrawLine to work.

                              // ..............(.... tag ,..... auto, ...start, starty, end, endy,.. color , ...........dash ,.. width)
                              // .................................scale... bars.............bars............................. ......style , ..pixels
                              // .............................................. ago.............ago
                              //DrawLine("PlotXXO", false,.... 10,... 1.33,.... 0,.. 1.33,.. Color.Red, DashStyle.Dot, 2);


                              It has been placed in region OnBarUpdate as follows
                              PlotXXO_1.Set(XXOpen + (25*TickSize));
                              DrawLine("PlotXXO", false, 10, 1.33, 0, 1.33, Color.Red, DashStyle.Dot, 2);

                              The following statements are in the initialize region:
                              Add(new Plot(new Pen(Color.Red, 2), "PlotXXO"));
                              Add(new Plot(new Pen(Color.Black, 0), "PlotXXO_1"));

                              starty and endy values = 1.33 are for test and are for the forex euro dollar/us dollar currency pair.

                              A listing of the indicator is attached in post #7.

                              I’m thinking that it may be a simple matter of syntax or form such as the wrong tag?
                              I’m aware that clarification to all this will probably be necessary.
                              Last edited by joemiller; 08-20-2013, 06:59 PM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by bortz, 11-06-2023, 08:04 AM
                              47 responses
                              1,603 views
                              0 likes
                              Last Post aligator  
                              Started by jaybedreamin, Today, 05:56 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post jaybedreamin  
                              Started by DJ888, 04-16-2024, 06:09 PM
                              6 responses
                              18 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by Jon17, Today, 04:33 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post Jon17
                              by Jon17
                               
                              Started by Javierw.ok, Today, 04:12 PM
                              0 responses
                              12 views
                              0 likes
                              Last Post Javierw.ok  
                              Working...
                              X