NexusFi: Find Your Edge


Home Menu

 





Coding trendlines in easylanguage


Discussion in EasyLanguage Programming

Updated
    1. trending_up 4,614 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 8 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
timtasmania
Trento, Italy
 
Posts: 4 since Oct 2017
Thanks Given: 1
Thanks Received: 0

Hi,

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


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The June 15 Resolution Trap: Irans Agreed Text Still Pri …
Prediction Markets & Event Contracts
MyForexFunds Begins Returning Frozen Funds After CFTC Ca …
Funded Trading Evaluation Firms
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
Sundays Verdict: Lebanon Locked at 99.85% as Iran June 7 …
Prediction Markets & Event Contracts
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


Hi Tim,

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.

Regards,

ABCTG


Follow me on X Reply With Quote
  #4 (permalink)
timtasmania
Trento, Italy
 
Posts: 4 since Oct 2017
Thanks Given: 1
Thanks Received: 0

Thanks for the reply ABCTG.

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.

Thanks again.

Cheers,
Tim


Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

Tim,

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).

Regards,

ABCTG


Follow me on X Reply With Quote
  #6 (permalink)
timtasmania
Trento, Italy
 
Posts: 4 since Oct 2017
Thanks Given: 1
Thanks Received: 0

HI ABCTG,

I'm just using daily bars. I'll try to keep searching and come up with something which resembles a workable code.

Thanks.


ABCTG View Post
Tim,

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).

Regards,

ABCTG


Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

Tim,

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.

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:
  #8 (permalink)
timtasmania
Trento, Italy
 
Posts: 4 since Oct 2017
Thanks Given: 1
Thanks Received: 0


ABCTG View Post
Tim,

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.

Regards,

ABCTG

Hi ABCTG,

I'm not sure how exactly...but I've managed to code it. It seems to all be working fine but obviously time will tell...

Many thanks for your help.

Regards,
Tim


Reply With Quote
  #9 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

Hi Tim,

you are welcome. Feel free to post your code here as it might help others or another pair of eyes might spot something.

Regards,

ABCTG


Follow me on X Reply With Quote




Last Updated on November 1, 2017


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts