NexusFi: Find Your Edge


Home Menu

 





Coding trendlines in easylanguage


Discussion in EasyLanguage Programming

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




 
Search this Thread

Coding trendlines in easylanguage

  #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?
REcommedations for programming help
Sierra Chart
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
22 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,434 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


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 Twitter 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,434 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

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 Twitter 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,434 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

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 Twitter 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,434 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

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 Twitter Reply With Quote




Last Updated on November 1, 2017


© 2024 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 - Privacy Policy - Downloads - Top
no new posts