Code inquire: Pass information from 1st chart to 2nd chart

Questions about MultiCharts and user contributed studies.
faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Code inquire: Pass information from 1st chart to 2nd chart

Postby faraz » 14 Apr 2012

Hi,

What is the way to pass information from one chart to second chart.

Suppose on Chart number 1 indicator is running and I want that when that Chart 1 indicator is = 1 then
On chart Number 2 my strategy start placing orders.


and when on chart No.1 indicator become = -1 then
on chart No.2 my strategy stop placing orders.

Thanks

User avatar
TJ
Posts: 7739
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1032 times
Been thanked: 2221 times

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby TJ » 14 Apr 2012

Hi,

What is the way to pass information from one chart to second chart.

Suppose on Chart number 1 indicator is running and I want that when that Chart 1 indicator is = 1 then
On chart Number 2 my strategy start placing orders.


and when on chart No.1 indicator become = -1 then
on chart No.2 my strategy stop placing orders.

Thanks
Do a search in this forum for

GlobalVariables



if you want to do some advanced reading and programming,
search also for:

ELCollections
ADE ALL Data Everywhere

faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby faraz » 14 Apr 2012

Do a search in this forum for

GlobalVariables



if you want to do some advanced reading and programming,
search also for:

ELCollections
ADE ALL Data Everywhere
I checked forum and found example on this page and it is working.
viewtopic.php?t=2483

Thanks

User avatar
TJ
Posts: 7739
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1032 times
Been thanked: 2221 times

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby TJ » 14 Apr 2012

Do a search in this forum for

GlobalVariables



if you want to do some advanced reading and programming,
search also for:

ELCollections
ADE ALL Data Everywhere
I checked forum and found example on this page and it is working.
viewtopic.php?t=2483

Thanks
Thanks for the follow up and the link... Much appreciated.

NW27
Posts: 177
Joined: 25 Dec 2010
Has thanked: 40 times
Been thanked: 85 times

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby NW27 » 15 Apr 2012

Hi,

What is the way to pass information from one chart to second chart.

Suppose on Chart number 1 indicator is running and I want that when that Chart 1 indicator is = 1 then
On chart Number 2 my strategy start placing orders.


and when on chart No.1 indicator become = -1 then
on chart No.2 my strategy stop placing orders.

Thanks
In using the GV (Global Variable) approach, there are some issues ie, information obtained on the second chart using a GV is lost, as in if the chart is reloaded the past GV history is not there. No good for back testing etc.
If however you are wanting to have two charts that are say a 25tick chart and a 5min chart and the 25tick chart generates the signals that are used on the 5min chart. It may be easier to have both of the data series on the same physical chart. You can have two chart data series and two charts displayed in the one data window or do as I do and have the second data series hidden. Reference the indicator in the second data series as in "average(Close of Data(2),20)"

Neil.

P.S. I also use this method for displaying a 20EMA of a 5min data onto a 25tick chart.
the 5min data is a second hidden data series. And when I place the MA onto the 25tick chart I tell it to use "2 - ..." not "1 -..." via the "Properties/Base Study on" area.

Note - The second Data series can also be a different instrument. :)

faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby faraz » 15 Apr 2012


In using the GV (Global Variable) approach, there are some issues ie, information obtained on the second chart using a GV is lost, as in if the chart is reloaded the past GV history is not there. No good for back testing etc.
If however you are wanting to have two charts that are say a 25tick chart and a 5min chart and the 25tick chart generates the signals that are used on the 5min chart. It may be easier to have both of the data series on the same physical chart. You can have two chart data series and two charts displayed in the one data window or do as I do and have the second data series hidden. Reference the indicator in the second data series as in "average(Close of Data(2),20)"

Neil.

P.S. I also use this method for displaying a 20EMA of a 5min data onto a 25tick chart.
the 5min data is a second hidden data series. And when I place the MA onto the 25tick chart I tell it to use "2 - ..." not "1 -..." via the "Properties/Base Study on" area.

Note - The second Data series can also be a different instrument. :)

I want do something which cann't be done by using Data(2). Already checked those options.

GV working but Yes, I figured out already that GV is not good. I need the data available for backtesting and GV does not support that feature.

I m trying to make ADE and ELCollections.dll work but so far no luck. Did it worked on ur computer?

NW27
Posts: 177
Joined: 25 Dec 2010
Has thanked: 40 times
Been thanked: 85 times

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby NW27 » 16 Apr 2012

I want do something which cann't be done by using Data(2). Already checked those options.

GV working but Yes, I figured out already that GV is not good. I need the data available for backtesting and GV does not support that feature.

I m trying to make ADE and ELCollections.dll work but so far no luck. Did it worked on ur computer?
1. I'm curious as to why it would not work on Data2?

2. I have not tried ADE or ELCollections. No need to, I can do everything I need with Data2

Neil.

faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby faraz » 17 Apr 2012


1. I'm curious as to why it would not work on Data2?

2. I have not tried ADE or ELCollections. No need to, I can do everything I need with Data2

Neil.
1. Bit complicated and private, cann't discuss.
2. ok


Plz any body in the forum used ADE and ELCollections please help me out here. I m unable to make them work.

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby ABC » 17 Apr 2012

Faraz,

if I tell you that ELCollections and ADE work fine for me and expect that this information should get you going, it wouldn't be very helpful for you.
The same applies for "I am unable to make it work", there are so many things that could cause problems, that in my opinion you won't get much help with this remark only. To make anyone able to help you should provide us with:
1. The steps you did already
2. The version of MC you are running
3. The version of the DLL you are using (to make sure you are using the 32 Bit DLL with the 32 Bit version of MC for examples)
4. Your operating system and if you have administrator rights with the account you log in with.
5. What error messages do you get with ELC or ADE?

This enables us to rule out certain problems and be specific about the help, which saves you time. This by the way applies to any problems with MC and programming, always give all the information that someone would need to reproduce the problem, as the solution could be in something you wouldn't have thought about.

Regards,

ABC

faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby faraz » 17 Apr 2012

Faraz,

if I tell you that ELCollections and ADE work fine for me and expect that this information should get you going, it wouldn't be very helpful for you.
The same applies for "I am unable to make it work", there are so many things that could cause problems, that in my opinion you won't get much help with this remark only. To make anyone able to help you should provide us with:
1. The steps you did already
2. The version of MC you are running
3. The version of the DLL you are using (to make sure you are using the 32 Bit DLL with the 32 Bit version of MC for examples)
4. Your operating system and if you have administrator rights with the account you log in with.
5. What error messages do you get with ELC or ADE?

This enables us to rule out certain problems and be specific about the help, which saves you time. This by the way applies to any problems with MC and programming, always give all the information that someone would need to reproduce the problem, as the solution could be in something you wouldn't have thought about.

Regards,

ABC

ABC,

Thanks for ur reply. Sound good to me.

Here is what i did;
1) copy elcollections.dll in MC folder C:\Program Files\TS Support\MultiCharts
2) imported elcollection eld functions in MC
3) make ADE folder on C:
4) make 3 more (data, classes, code) folders in c:\ADE
5) moved ohlcv.txt file in to classes folder
6) imported ade.eld files to MC
7) created a indicator ADE Sender and put this code;

Code: Select all

Vars: Class("DailyAvg") , AvgMap(MapSN.New ), MA( 0 );
// CACULATE MOVING AVERAGE
MA = AverageFc(c,50);
//Store the data we are interested in into AvgMap
Value1 = MapSN.put(AvgMap,"DailyAvg", MA);
//Use ADE to store for current symbol and bar interval
Value1 = ADE.putBarinfo(class, GetsymbolName, ADE.Barinterval, ADE.BarID, AvgMap);
//plot daily average on daily chart
Plot1(MA, "Av", DarkBlue);
8 ) Created a indictor ADE Reciver and put this code in it;

Code: Select all

vars: Interval(0), Class("DailyAvg"), AvgMap(Mapsn.new);
value1 = Ade.GetBarInfo(Class, GetSymbolName, Interval, Ade.BarID, AvgMap);
Value2 = MapSN.Get(AvgMap,"DailyAvg");
Plot1(Value2,"DailyAvg",Darkblue);
9) My MC v7.4 build 4953 32 bit
10) OS xp 32 bit
11) not sure if elcollections.dll file is 32 bit file as well or not. I download ADE and EL files from this link http://www.multicharts.com/discussion/v ... php?t=2483
12) Nothing happens when i run the code no errors coming and it is not working. I m not sure why it is not working.

Awaiting

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby ABC » 17 Apr 2012

What do you mean with run the code?
You loaded the sender on a daily chart and it didn't plot anything?

faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby faraz » 17 Apr 2012

What do you mean with run the code?
You loaded the sender on a daily chart and it didn't plot anything?
Yes, I created 2 charts and added Sender indicator on one chart and added receiver indicator on second chart.

And nothing was ploted on Receiver indicator.

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby ABC » 17 Apr 2012

I just checked your code examples and they work fine here. If there is anything wrong with the syncronization, it should raise an error right away. The fact that it doesn't makes it hard to track the problem down.

Do you see the sender plotting?

faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby faraz » 17 Apr 2012

Ok, I re-make charts and it is working now.
Don't know what was the problem with it.
May be this time i created both charts the same and then re-started my workspace and MC few times and that fixed the missing link some where.

Thanks for the checking Chris.
Last edited by faraz on 17 Apr 2012, edited 1 time in total.

User avatar
TJ
Posts: 7739
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1032 times
Been thanked: 2221 times

Re: Code inquire: Pass information from 1st chart to 2nd cha

Postby TJ » 17 Apr 2012

I found the problems;

1. MC does not issuing error until i restart the workspace.

2. second thing i noticed that ADE require both charts same symbol and interval other wise data will not be accurately plotted.

3. i attached pic, this time i did not changed the symbol but changed the Daily interval to 2 and the indicator is not matching on 2nd chart.

its look like ADE and ELCollections r not accurately working. What u say?
I say a bit more reading of the manual is in order.


ADE and ELC have been in service for years, you will find them invaluable additions to your trading arsenal.


Return to “MultiCharts”