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)
I’m trying to code trend lines into easylanguage so they appear on the charts in TS2000i and am having problems.
It should (I think) in theory be super simple for someone who actually knows what they’re doing..so thought I’d ask for help and try to lose this headache
Basically I would like:
1. A line which connects the close of today (latest bar on chart) with the close of 21 days ago.
2. A line which connects the close of 21 days ago with the close of 42 days ago.
3. A horizontal line at the highest high of the past 21 days (it would go from today back 21 days)
4. A horizontal line at the lowest low of the past 21 days (it would also go from today back 21 days).
These lines would obviously then update automatically every time new data is entered & the chart updates.
Many many thanks for anyone willing to help me out!
All the best,
Tim
Can you help answer these questions from other members on NexusFi?
if you post the code that is giving you problems, I am sure someone here is able to steer you in the right direction.
In general I'd suggest to create the trendlines once and then just update their location. Getting the prices will depend a bit on the timeframe that you are working on, though.
To be honest I've never coded any trend lines and reading through the TS manual and searching google hasn't helped much, at least not for the types of (trend) lines I want coded... I'm stuck before I've started!
I can of course persevere and try to come up with something which resembles the code but thought I'd see if anyone could get me started more easily on this forum and save me a bunch of time.
the first thing to consider is the timeframe you are working on. If you are only using daily bars you can simply back reference the Open, High, Low and Close of a bar to get the values from X bars ago. In case you are working on intraday data, this won't work and you need to track the values from X days ago (using an array for example).
in that case you can access the values from previous day's easily by back referencing them - for example Close[10] would be the Close of the bar ten bars to the left of the current bar (Close[0] is the current bar).
Look into the functions "highest" and "lowest" to get the highest/lowest value within the last X bars.
For the trendlines I would suggest to create the four trendlines once at CurrentBar = 1 and then just update the trend line start and end points.