Replicating trend lines one multiple time frame

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Replicating trend lines one multiple time frame

Postby arjfca » 18 Feb 2012

Hello

I'm looking for info on how I could code, if it is possible, to replicate a trend line on all time frame. I found it annoying to redraw same line on each time frame that I use.

There should be a solution, but I just don't know from where to start.

Happy weekend to all

Martin

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Replicating trend lines one multiple time frame

Postby TJ » 18 Feb 2012

Hello

I'm looking for info on how I could code, if it is possible, to replicate a trend line on all time frame. I found it annoying to redraw same line on each time frame that I use.

There should be a solution, but I just don't know from where to start.

Happy weekend to all

Martin
are you talking about manually drawn trendlines?

My lines stay in the chart when I change the resolution.

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Replicating trend lines one multiple time frame

Postby arjfca » 18 Feb 2012

Hello TJ

Yes, manually draw trend line .

I'm using different windows chart. Individual time frame for each pane. The chart application that I was using before, from Saxo Bank, had an option to draw the same trend line on each charts of the same instrument.

Draw once, for all time frame.

Martin

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Replicating trend lines one multiple time frame

Postby JoshM » 18 Feb 2012

(..) draw the same trend line on each charts of the same instrument.

Draw once, for all time frame.
Hm, how much spare time do you have? :)

No seriously, I think it can be done with...

1) GlobalVariables that hold the start time, end time, start price and end price for the trend line, and a indicator that uses RecalcLastBarAfter() to periodically check for these global variables. If a new trend line is "found" in the GlobalVariables, this would need to be saved in other variables to prevent it from getting overwritten. This means that you only need to keep track of four global variables per instrument.

However, I do not know if this will work with existing trend lines, for example when you have two trendlines already on the chart from yesterday on the 15M time frame, how should the 5M know these? You could loop through the bars of the previous session, but if you have 5 time frames, how should one prevent the mingling up of the different variables?

2) With the ELCollection function that read text files. You can write the location of a trend line to a file, and then let another indicator "pull" these from the file. This would make it easier to have 'historical trendlines' (trendlines that you draw a previous session) across all charts. (I don't think this is a good or quick to code solution, but I wanted to present more than one way. :) )

Just thinking aloud, :)

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Replicating trend lines one multiple time frame

Postby arjfca » 18 Feb 2012

That is a good start John

- Reading existing trendline value
- Store these one in a Global Variable using CSV text string

On another chart
- Erase all trend line
- Read back GV and decode trendline data
- Redraw trendline


Hum nice project. Look feasible, but not as easy as I first thought.

Martin


Return to “MultiCharts”