I use some ADE indicators that send data from lower timeframes to another chart. It works fine with tick/volumecharts.
Is there a way to send ADE data from a range chart to another range or tick chart
or is the only solution using Global Variables ?
ADE and receiving data from Range Bars
- Anastassia
- Posts: 179
- Joined: 18 Jan 2010
- Been thanked: 4 times
Re: ADE and receiving data from Range Bars
Hi SP,
If you use "ADE.BarInterval" function in your scripts, then:
The function is meant for the following BarType values:
1 – Intra-Day (Seconds, Minutes, & Hours)
2 – Days
3 – Weeks
4 – Months, Quarters, & Years
If you change 4 to 5 in the "else if BarType >= 2 and BarType <= 4 then" line, then function will also get calculated for Points (point resolution=range resolution)
Thank you
If you use "ADE.BarInterval" function in your scripts, then:
Code: Select all
[LegacyColorValue = TRUE];
// For intraday charts, this function returns the normal BarInterval.
// Otherwise, it returns 0 for daily, -1 for weekly, and -2 for monthly.
if BarType = 1 then
ADE.BarInterval = BarInterval
else if BarType >= 2 and BarType <= 4 then
ADE.BarInterval = 2 - BarType
else if BarType = 0 then begin
ADE.BarInterval = 0;
Value1 = ADE.RaiseError("ADE.BarInterval can't be used on tick/volume charts. " +
"Use ADE.TypeZeroInterval instead.");
end
else begin
ADE.BarInterval = 0;
Value1 = ADE.RaiseError("ADE cannot store data for this chart type.");
end;
1 – Intra-Day (Seconds, Minutes, & Hours)
2 – Days
3 – Weeks
4 – Months, Quarters, & Years
If you change 4 to 5 in the "else if BarType >= 2 and BarType <= 4 then" line, then function will also get calculated for Points (point resolution=range resolution)
Thank you
-
- Posts: 53
- Joined: 04 Jan 2008
- Has thanked: 21 times
- Been thanked: 3 times
Re: ADE and receiving data from Range Bars
When I follow your instructions I get an ADE error: "Unsupported ADE interval code: 3". Any solutions to this? Thanks.
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: ADE and receiving data from Range Bars
Have you installed the TypeZero Library?When I follow your instructions I get an ADE error: "Unsupported ADE interval code: 3". Any solutions to this? Thanks.
You can get it here:
http://www.tradersxchange.com/viewtopic.php?f=49&t=4
-
- Posts: 53
- Joined: 04 Jan 2008
- Has thanked: 21 times
- Been thanked: 3 times
Re: ADE and receiving data from Range Bars
Thanks for reply TJ. TypeZero library was installed. I also created a VirtBarTypes.cfg file named "201,Point" to let ADE know of this bar to use for Interval function as per Virtual Bar Type instructions and got this error: " Interval not supported: -201".
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: ADE and receiving data from Range Bars
Hello Rick,Thanks for reply TJ. TypeZero library was installed. I also created a VirtBarTypes.cfg file named "201,Point" to let ADE know of this bar to use for Interval function as per Virtual Bar Type instructions and got this error: " Interval not supported: -201".
The post above by Anastassia provides the right direction, but scripts should be manually adjusted.
It is easier to create custom functions to read and write to avoid using functions like ADE.BarInterval that have certain resolution limitations. Here is the read function:
Code: Select all
inputs:
Sym(stringsimple),
Interval(numericsimple),
BarID(numericsimple),
DataName(stringsimple),
vLoadData(numericref);
vars:
_last_sym(""),
_last_interval(-1),
_index(0),
_data_map(0),
_bar_list(0),
_data_name_list(0);
if Sym <> _last_sym or Interval <> _last_interval then begin
_last_sym = Sym;
_last_interval = Interval;
_data_map = ADE.GetRequiredMap("GData" + DataName, Sym, Interval);
_bar_list = MapSC.Get(_data_map, ":Bar");
_data_name_list = MapSC.Get(_data_map, DataName);
end;
if ListN.IsSorted(_bar_list) = false then
Value1 = ADE.SortDataMap(_data_map);
if ListN.Lookup(_bar_list, BarID, _index) = false then
_index = _index - 1;
if _index <> 0 then
vLoadData = ListN.Get(_data_name_list, _index);
load_global_data = _index;
Code: Select all
variables: var0(0);
var0 = close + open / 2;
save_global_data(symbolname, barinterval, date+time_s/1000000, "MyVar", var0);
Code: Select all
variables: var0(0);
load_global_data("ESM3", 5, date+time_s/1000000, "MyVar", var0);
-
- Posts: 53
- Joined: 04 Jan 2008
- Has thanked: 21 times
- Been thanked: 3 times
Re: ADE and receiving data from Range Bars
Thanks for the detailed instructions Dave. I have yet to dig into this but seems to be the solution to a problem I've had for a long time. Should be helpful to many.