Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Help Drawing Lines Connecting Bars (Indicator Development)
Hi all, I'm looking for an example on how to draw a line on a bar chart for automated channel/support resistance indicators. The Vertical Line is easy, but for any other type of line, it isn't clear to me from the documentation how to ensure that a line is draw at a Y coordinate that matches the bar. Two prime examples I'm struggling with are:
1) Just draw a horizontal bar at the top of the highest bar close in the last N bars. Once I find the bar how do I get the line to draw aligned to the top of the bar and how to derive the X length from the current width of bars.
2) I want to draw a line between two bars of some number of bars apart and extending in either direction by an extra N bars.
I'm using NT8, but NT7 examples are fine too.
Thanks,
-Jason
Can you help answer these questions from other members on NexusFi?
From what I read about your issue, I have made some code in NT8 to exemplify what I gathered you need.
This code is for the On Bar Update part of the indicator. What this does is it looks for which bar in the last "barsBack" (this you can have as a variable) number of bars back has the highest high and records the bar number. The draw line part of the code draws a line that will be over ridden on each new draw (bar), from the bar that gave you the highest high with "barsExtend" (this is a variable of type int) to the left, the y co-ordinate of the line remains the same so you draw just a horizontal line and the second x co-ordinate is the x bar minus a variable that you can change and minus the "barsExtend" again so it extends to the right of the bar that you wanted.