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

    #16
    Originally posted by joemiller View Post
    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.
    If you look in your log, you will see a statement about accessing an entity that is out of range. The log is always the first place to look for a clue as to what is wrong.

    In your particular case, you can solve the problem in more than one way. Look at the solutions that I offered in this particular post in a thread that is way too long to ask anyone to read for a nugget of information. ref: http://www.ninjatrader.com/support/f...t.php?p=242637

    You can easily draw the parallel. You probably want to use "10" where we used "20"?

    Comment


      #17
      Hello joemiller,

      Thank you for your post.

      The post that koganam references provides some great solutions for this item: http://www.ninjatrader.com/support/f...t.php?p=242637

      Comment


        #18

        you guys nailed it again. Many thanks.

        just as you thought, Koganam, the log entry was "Error on calling 'OnBarUpdate' method for indicator 'joeXXOindicator' on bar 1: joeXXOindicator.DrawLine: startBarsAgo out of valid range 0 through 1, was 10."

        I used the inelegant solution form presented in the solution thread link [ie]
        if (CurrentBar >= 10) DrawLine( ................................ )

        Comment


          #19
          nothing is plotting on my chart for the current live data day bar even though
          CalculateOnBarClose is set equal to false in the initialize indicator code;

          However, I was able to make Drawline go to the current bar by setting the EndBarsAgo parameter to minus one rather than zero.

          Is there a way to make the indicator display all the way to the current live chart day bar?

          Comment


            #20
            Hello joemiller,

            Thank you for your post.

            Can you attach a screenshot of your chart to your response so I may investigate this matter further?

            I look forward to your response.

            Comment


              #21
              Screen shot attached.

              Thanks
              Attached Files

              Comment


                #22
                Hello joemiller,

                Thank you for your response.

                If you right click in the chart > select Indicator > and then your indicator does it show the CalculateOnBarClose option set to False?

                In addition, can you attach your indicator file to your response?

                I look forward to your response.
                Last edited by NinjaTrader_PatrickH; 08-21-2013, 02:48 PM.

                Comment


                  #23
                  That fixed it Patrick.
                  Many thanks.

                  Comment


                    #24
                    Whoops,

                    almost overlooked the request for the indicator file.

                    Indicator file attached.
                    Attached Files

                    Comment


                      #25
                      Hello joemiller,

                      Thank you for your response.

                      I am glad you were able to resolve this matter.

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

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by TraderG23, 12-08-2023, 07:56 AM
                      9 responses
                      382 views
                      1 like
                      Last Post Gavini
                      by Gavini
                       
                      Started by oviejo, Today, 12:28 AM
                      0 responses
                      1 view
                      0 likes
                      Last Post oviejo
                      by oviejo
                       
                      Started by pechtri, 06-22-2023, 02:31 AM
                      10 responses
                      125 views
                      0 likes
                      Last Post Leeroy_Jenkins  
                      Started by judysamnt7, 03-13-2023, 09:11 AM
                      4 responses
                      59 views
                      0 likes
                      Last Post DynamicTest  
                      Started by ScottWalsh, Yesterday, 06:52 PM
                      4 responses
                      36 views
                      0 likes
                      Last Post ScottWalsh  
                      Working...
                      X