any way to copy lines from one chart to another?

Questions about MultiCharts and user contributed studies.
gpw797
Posts: 216
Joined: 04 Mar 2006
Has thanked: 3 times
Been thanked: 7 times

any way to copy lines from one chart to another?

Postby gpw797 » 02 Nov 2011

One of the features I like in SC is you can link items from one chart to another. For example if I draw some important (lines) levels on one chart the lines transfer to another chart. Move them on chart one and they also move on chart 2. Is there any way to do this in MC?

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: any way to copy lines from one chart to another?

Postby bowlesj3 » 02 Nov 2011

You would have to write a script on all the charts to do something like that. It would require you know EL coding very well. It would involve passing the info across the charts via Global Variables. There are commands to find the lines that are on the chart for this (new manually placed lines). MC_TL_GetActive is one. There is a command to loop through to find lines. I think it would take a fair bit of time to get this coding done. I know the EL code but I figure it could take me several weeks to get such a script working properly (I know because I have done similar stuff - sort of). If the bar sizes are different the code would be more complex of course.

gpw797
Posts: 216
Joined: 04 Mar 2006
Has thanked: 3 times
Been thanked: 7 times

Re: any way to copy lines from one chart to another?

Postby gpw797 » 02 Nov 2011

Figured....

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: any way to copy lines from one chart to another?

Postby bowlesj3 » 03 Nov 2011

LOL, of course the good news is you only have to do that once (both once - learning the EL code well and writing that specific script set).

If your lowest bar size is 1 minute bars and you always put the first line on there I do not think it would be as hard as you think. You would have a set of named GVs that store the 1 minute bar locations of the anchor points and the other charts would pick up the new entries and create lines to match (converting to their bar sizes in the process). Logic to pick up the deletes would be interesting. MC_TL_GetActive could detect a line you are about to move (storing the ID) and once the line has lost the its highlight the code would try and get the new location to see if you moved it or deleted it. It would update the GVs as required and the other charts would do the rest.

However, if you decide you want to put a new line on any chart this would get really tricky because each chart would have both computer generated lines and manually generated lines. In fact I think you would start to get confused and if you tryed to delete a computer generated line you could generate the study (not a good thing to do). In this case you would need a popup to tell you that you had highlighted a computer generated line. You might also have to have one colour for computer generated and another colour for manually placed lines. So after thinking about this My suggestion would be to if you can only put new lines on one select bar size (or chart) and just have the rest copied over to the other bar sizes (much easier).

Now that I think about it I figure it is a fair bit easier than some of the stuff I have done. I have one script that took me about 6 weeks to get working fully and I have probably put about 2 more months of enhancements into it. Much of the code is outside MC too. So your script is not really that hard compared to some.

I have a script a bit like your script that detects an arrow in the 10 second bars and puts a vertical line both in the price chart and the RSI sub-chart then deletes the arrow (maybe 2 or 3 weeks to get it fully working). Enhancements come in about another 3 weeks spread out over 2 years.

All these estimates are full time however with a random trail off of bug fixes (much like a bell curve)

One thing. I have been programming 30 years and I have programmed in about 11 languages so I am use to this. If you are new to programming it could seem like a lot (some are not that great at it as well).
Last edited by bowlesj3 on 03 Nov 2011, edited 1 time in total.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: any way to copy lines from one chart to another?

Postby Henry MultiСharts » 03 Nov 2011

One of the features I like in SC is you can link items from one chart to another. For example if I draw some important (lines) levels on one chart the lines transfer to another chart. Move them on chart one and they also move on chart 2. Is there any way to do this in MC?
This feature has not been implemented yet.
You can vote for this feature request: Add Drawing Tool to All Linked Charts with same instrument in a workspace

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: any way to copy lines from one chart to another?

Postby bowlesj3 » 03 Nov 2011

Of note, the base script at the link below could be used for an app like this.
viewtopic.php?f=5&t=7764&hilit=MC_Text_GetActive

You could drop arrows on your prices. They could put the high/low value in the text of the arrow to ensure you have the correct location before drawing the line. Once two arrows are dropped and confirmed you could click a text to draw a line and remove the arrows. MC_Text_GetACtive would be used as the command to detect that you had highlighted the command text. At that point all charts get the lines. To delete you could highlight a line and move it or highlight a line and click a Text (using MC_Text_GetACtive to detect the text being highlighted) and have that line deleted from all charts. You could even highlight a line and then click a text marked "E" to extend the line and it would figure out which line it was and extend it. This would be a bit faster than the menus.

Using this method you could put lines on any chart and remove them from any chart. without the worry of deleting a study by removing a line. Map commands could write all line locations to a file for that matter so they reappear when MC comes back up.

The only problem here is snap mode (which MC needs to be better with). You will want snap for moving lines but unfortunately text and arrows also snap.


Return to “MultiCharts”