1. 首页
  2. 易语言 - EasyLanguage
  3. ELC&ADE
  4. ELC FAQ – All-Data-Everywhere
  1. 首页
  2. 易语言 - EasyLanguage
  3. ELC FAQ – All-Data-Everywhere

ELC FAQ – All-Data-Everywhere

401. What are the differences between using ADE and DATA1/DATA2?

ADE and the DATA1/DATA2 functionality in TS perform essentially the same task – both allow you to access data from different symbols and/or timeframes.

The main disadvantages of using ADE are:

  • An add-on to TS so more to learn
  • Slower and more processor intensive than DATA1/DATA2

The main advantages are:

  • Latest version of ADE/ELC is supported by TradeStation
  • Can read in new symbols from disk, and can chart them and apply indicators
  • Provides a workaround for the limited functionality of DATA1/DATA. Specifically:
    • can use ‘next bar’ functionality in strategies
    • can mix Tick and Volume charts with Minute charts
    • can mix Tick and Volume charts with other Tick and Volume charts
    • can mix symbols with different delays and time zones
    • can use the new intra-bar order generation functionality

These workarounds are discussed in more detail in topics 401.1 – 401.5 below.
Without trying to get into a subjective argument some people also find ADE more intuitive and easier to use than the DATA1/DATA functionality. But, of course, some people don’t!

401.1. I am getting the error “Cannot mix next bar prices with data streams other than data1.”

This is a TS error that occurs if you try to use ‘next bar’ terminology in strategies with more than one datastream (DATA2, DATA3 etc.).

ADE allows you to use ‘next bar’ terminology in strategies whilst still having access to data from other symbols and timeframes.

401.2. I am getting the error “Tick and Volume intervals cannot be used in a multi-symbol chart.”

This is a TS error that occurs if you try to use more than one datastream (DATA2, DATA3 etc.) with Tick or Volume charts.

ADE allows you to use minute (or daily, weekly, yearly) data in Tick or Volume charts. TZS, an extension to ADE, allows you to combine and synchronize two tick or volume charts of the same symbol but with different tick or volume intervals.

401.3. I am getting the error “You may not mix symbols with different delays in the same window.”

This is a TS error that occurs if you try to use more than one datastream (DATA2, DATA3 etc.) with symbols that have different delays. For example, if you don’t have a subscription to the NYMEX but you do to the CME and you wish to compare a daily chart of Crude Oil (@CL) with the S&P E-mini (@ES) then you will get this error. Obviously, the easiest way to get avoid this error is to subscribe to all exchanges (the NYMEX in the above example) but this can be very expensive, especially if you are just backtesting.

ADE allows you to combine real-time and delayed data feeds to build strategies.

401.4. I am getting the error “Symbols from different time zones cannot be plotted together using exchange time.”

This is a TS error that occurs if you try to use more than one datastream (DATA2, DATA3 etc.) with symbols from different exchanges that are in different timezones.

ADE allows you to combine data from different exchanges that are in different timezones. This means you can set all your charts to ‘TimeZone: Exchange’ and still be able to work with them.

This feature is especially important to TS users outside the US, whose winter to summer (and vice versa) clock changes do not occur at the same time as the US. If your strategy uses times (e.g. if time>1430 and time<1600 then buy) then during the period when the US and your country’s timezones are out of synch you will get erroneous backtesting results. Using ADE resolves this issue.

401.5. I am getting the error “Generate Orders Intra-bar has been disabled.”

This is a TS error that occurs if you try to use more than one datastream (DATA2, DATA3 etc.) with symbols from different exchanges that are in different timezones.

ADE allows you to combine data from different exchanges that are in different timezones. This means you can set all your charts to ‘TimeZone: Exchange’ and still be able to work with them.

This feature is especially important to TS users outside the US, whose winter to summer (and vice versa) clock changes do not occur at the same time as the US. If your strategy uses times (e.g. if time>1430 and time<1600 then buy) then during the period when the US and your country’s timezones are out of synch you will get erroneous backtesting results. Using ADE resolves this issue.

401.5. I am getting the error “Generate Orders Intra-bar has been disabled.”

This is the most common type of error in ADE.

ADE works by ‘sending’ data from one chart and ‘receiving’ that data in another chart. So it is important that:

  1. you apply a ‘send’ indicator to the ‘sending’ chart
  2. your ‘receive’ indicator has its inputs set to match the symbol and bar interval of the ‘sending’ chart

For example if you want to ‘send’ data from a Daily @YM.D chart and ‘receive’ that data on a 5 minute @ES.D chart you need to

  1. apply the ‘ADE Save OHLCV’ indicator (or another ‘send’ indicator) to the Daily @YM.D chart
  2. apply the ‘ADE Plot OHLCV’ indicator (or another ‘receive’ indicator) to the 5 minute @ES.D chart, but change it ‘Sym’ input to “@ES.D” (including double quotes and in CAPITALS) and its ‘Interval’ input to ‘ADE.Daily’.

The Interval input is either ‘ADE.Monthly’ for monthly charts, ‘ADE.Daily’ for daily charts, or a number representing the bar interval (e.g. ‘5’ for a 5 minute chart, ’20’ for a 20 minute chart).

If everything normally works and this error only occurs when you first start TradeStation or when you first open the workspace then this could be a synchronization issue.

ADE IS CASE-SENSITIVE!

Alternatively, if you are working with Personal Stock Index (PSI) then there could be another solution.


I’m working with a Personal Stock Index, called $MYIDX.

I’m using a chart with the base symbol $COMPX. When I apply the ‘ADU Bollinger Bands’ indicator I get the following ADE error

No data available for Class ‘OHLCV’, $COMPX, Daily

This error always means that ADE can’t find the data it needs for this symbol ($COMPX) and timeframe (Daily). The solution is usually just to apply the ‘ADE Save OHLCV’ indicator to a Daily chart of the $COMPX – this then saves the data into memory and is accessible by ADE.

However, in this case you aren’t interested in $COMPX, you are interested in your personal index – $MYIDX

So, when you apply the ‘ADU Bollinger Bands’ indicator you need to make sure that it is referencing the correct symbol. If you look at its inputs there is one called ‘Sym’ with the default setting GetSymbolName (this just uses the symbol from the chart, in this case $COMPX). You need to change this to “$MYIDX”.


403. DeriveBars

403.1. How does ‘DeriveBars’ work and what are its uses and limitations?

When working with ADE the first step is to save any data you require into shared memory using ‘ADE Save OHLCV’. Then you retrieve that data back from shared memory to work on your current chart. However, with ‘DeriveBars’ functionality you do not need the first step and can instead derive higher timeframe data directly from the data in your current chart. The ‘DeriveBars’ functionality in ADE is often referred to as synthetic or virtual bars.

ADU indicators have an input called ‘DeriveBars’. By turning ‘DeriveBars’ on (set the Input to ‘1’) you are telling ADE to calculate higher timeframe bars using data in the current chart.

So, for example, if you have a 5 minute chart of the ES and you apply the ‘ADU Bollinger Bands’ indicator to it, if you set the ‘DeriveBars’ Input to 1 and change the ‘Interval’ Input to 15, now the Bollinger Bands will be created and plotted as though they were on a 15 minute chart of the ES.

The most obvious benefit of ‘DeriveBars’ functionality is that you do not have to setup multiple timeframe charts with the ‘ADE Save OHLCV’ indicator applied to them all.

There are a few of limitations to ‘DeriveBars’…
*You can only ‘DeriveBars’ for bar intervals that are direct multiples of the current chart. i.e. if you are working with a 5 minute chart then you can DeriveBars for 10, 15, 20 etc minutes, but you cannot DeriveBars for 7, 12, 19 etc minutes.

  • Although you can use minute charts to derive daily bars the results will not be exactly the same as if you were working directly with daily bars. This is because intraday (minute) data is different from daily data. This has nothing to do with ELC/ADE or TS but is an exchange issue and is discussed elsewhere in these forums.
  • Because you are deriving new data on the fly this is a more processor intensive and slower approach than first applying ‘ADE Save OHLCV’ indicators.
  • DeriveBars only works on the ‘OHLCV’ Class.
  • Obviously, you can only derive data for the same symbol as the current chart. If you need data from different symbols then you will still need to use the ‘ADE Save OHLCV’ indicator to save that data to shared memory.

An additional use of ‘DeriveBars’ is when working with a Personal Stock Index (PSI). PSI creates your index with 1 minute bars. You can then use the indicator PSI Derive HTF Bars to derive higher timeframe bars which are saved into shared memory. Your index is then available, with multiple timeframes, to all your other ADE charts.

I am confused about whether you can correctly interpret data from one data series to another. There seems to be some discrpencies, i have a chart with 5m, 1m, 3m and 1,3 hr all of the same symbol. Some post i read say that you can use and corrctly calculate the data and other posts seem to say that the data has to be in multiples of the base timeframe.

As an example…

If you have two 5 min bars…

First – O 15, H 26, L 11, C 16
Second – O 18, H 21, L 8, C 14

Then you can combine the two into a single 10 min bar and you will get…

O 15, H 26, L 8, C 14

There would be no way of constructing, say, a 7 minute bar with two 5 minute bars because you just don’t have the correct information available. So it is correct that you can calculate higher timeframes with lower timeframes as long as they are direct multiples.

The exception is that daily data is different from intraday data and therefore you cannot accuratly turn intraday (minute or hourly) data into daily data. However, you can create rough approximations. The differences between daily and intraday data are discussed elsewhere in this forum.


403.2. I’m getting an ADE error “ADE can only derive OHLCV data for intervals which are direct multiples of the current interval”

The DeriveBars functionality can derive only direct multiples of the current bar interval.

So, for instance, if you apply an ADE indicator to a 5 minute chart and you set ‘DeriveBars’ to 1 then you can derive only 10, 15, 20 etc minute bars. You cannot derive bars such as 7, 12, 19 etc. Trying to derive bars that are not direct multiples of the original chart generates the above error.


403.3. Can I derive minute bars from tick bar or volume bar data?

No, you cannot derive minute bars from tick or volume bars.

DeriveBars only works with direct multiples. So, you can derive a 5 minute bar using 1 minute bars because 1×5=5.

However, e.g. with a 100 tick chart the ticks could all come through in 1 second or could take 10 minutes so there is no way you could build this into a minute bar.

403.4. I’m getting an ADE error – “ADE.DerivedOHLCV can’t be used on tick/vol chart”

You cannot use DeriveBars functionality on tick or volume charts. DeriveBars can only be used on minute charts.

404. I can’t get MapSS to work with ADE

ADE only supports the MapSN type.

Please see this thread for more information.

Originally posted by Bamboo

Are you asking whether it’s possible to store string data as well as numeric data using ADE? In other words, is it possible to create a class whose members represent string series as well as numeric series?

If this is your question, the answer is no. Currently ADE only supports numeric series. If there is sufficient interest in string series, I may consider it for a future version of ADE.


405. How is ADE.BarInterval used and how is it different from the inbuilt TS reserved word BarInterval?

Originally posted by Bamboo
Regarding your question about ADE.BarInterval – it’s really just an ADE substitute for BarInterval, which returns the interval of the current chart. The reason that ADE provides its own version is that BarInterval doesn’t distinguish between daily, weekly, and monthly charts (it returns zero for all of them). Rather than requiring another argument to specify chart type, I decided to denote daily, weekly, and monthly charts by “intervals” of 0, -1, and -2, which will never be returned by minute charts. The ADE.BarInterval function checks the chart type and returns these codes if appropriate; otherwise it just returns BarInterval.

One way to think about it is that you should always use ADE.BarInterval when you are storing data (i.e. in an ADE provider), but you should pass the specific bar interval that you want when you are requesting data (i.e. in an ADE consumer). There are times when you might want to use ADE.BarInterval in a consumer (e.g. when you want to access data from other symbols in the same timeframe), but generally you should make it an input that you can specify.


406. I notice small differences between real-time data when using ADE vs. DATA1/DATA2 indicators. Why?

If you have the ‘Update value intra-bar’ tick box selected for an indicator, then apply this indicator to a chart with DATA1 and DATA2, the indicator will be updated every time a tick occurs on either DATA1 or DATA2.

If you apply an indicator (with ‘Update value intra-bar’ selected) to a chart with only DATA1 then it can only update when a tick occurs on DATA1. So this indicator will update less often than the one on a DATA1/DATA2 chart.

When you use ADE it is only on a chart with DATA1. The second (or third etc) datastreams are being brought through ELC/ADE. Therefore, ADE indicators will, potentially, update less often then those applied to multiple DATA streams. This should be a fairly minor issue in most instances and will only affect real-time data calculations.

If this is a potential issue for you then you should make sure the chart with the most updates/volume/liquidity is in DATA1 and other data comes through ADE.


407. How and when is ADE data deleted/removed from memory

Originally posted by Bamboo
ADE doesn’t destroy the data after you read it. Once you’ve stored data in a class, you can read it from as many studies or strategies as you want, and as many times as you want.

The data for a class is destroyed only when:

  • the last study/strategy that uses that class is unloaded, or
  • you destroy a DataMap explicitly with ADE.DeleteMap.

Note that when I say “data for a class”, I mean all of the symbols and intervals for that class. Only when no study/strategy is using any data from that class is the class data automatically destroyed.

If you want to take control of freeing class memory yourself, the ADE.DeleteMap function lets you delete the DataMap for a specific class, symbol, and interval. This is not normally necessary, and this function should be used with care, but it can be useful for some applications where you want to control memory usage (such as my correlation matrix generator).


408. Performance

408.1. General performance issues in TS and EL

There is a thread that discusses how to improve EasyLanguage performance. Although it is not specific to ELC/ADE I have included it because it is extremely important to all TradeStation users.

EasyLanguage Performance Timer


408.2. How can I improve the performance of my ADE strategies?

Originally posted by aspTrader
I’m using a couple of your tools (ADE and EL Performance Timer) along with a GA optimization product. In using the Performance timer I’ve been able to determine that my ADE.OpenMap statements at CurrentBar = 1 take half the time of each iteration. I have quite a few Class, Symbol, and Interval combinations to Open at Bar 1.

The optimization process would zip along much faster if there was some way to skip the ADE.OpenMap statements once the Class/Symbol/Intervals had been Opened during the first iteration.

Any thoughts about how this might be accomplished?

Originally posted by Bamboo

Try applying the strategy to another chart first. (It can have a relatively small number of bars so that it executes quickly.) Then apply the strategy to your test chart and optimize. Having the strategy open in two charts should keep all the maps in memory.

An optimization reloads the strategy on each iteration, which is why the maps are getting unloaded each time and have to be read from disk again. But if the maps are shared by more than one chart, they won’t get unloaded.

Originally posted by aspTrader
Wow! That did the trick. My ADE.OpenMap statements were executing in a loop (as illustrated in a previous post) and I have a lot of them. The statements were taking 20 seconds. Now they take less than a second!


408.3. How can I make my indicators more efficient?

Originally posted by progster
I’d like to pose an efficiency question:-

Considering that calculations may be saved to ADE files, and considering that a newly opened chart might contain bars either before or after the dates/times of any previously saved calculations, could someone (Bamboo? ) recommend a good code layout to accomplish the goal of maximal re-use and minimal re-calculation?

IOW, I’d like to calculate my metrics for the “new” bars before and after the previously saved time period, while not having to re-calculate (instead, simply loading from memory or disk) for those bars which I calculated in the past.

Originally posted by Bamboo
progster,

That’s a great question. Here’s a special version of the “ADE Save Info Test” indicator that illustrates how to do what you want. After calling ADE.OpenMap, it checks to see whether the DataMap contains a BarList. If it does, then the map contains data, so the indicator sets FirstCalcBar to the first BarID in the BarList and LastCalcBar to the last BarID in the BarList. Then it only calculates and stores data for BarIDs that fall outside that range. If the map doesn’t contain any data (because no data file exists yet), the default values of FirstCalcBar and LastCalcBar ensure that all bars get calculated and stored.

Inputs:
	UseFile(ADE.UseFile),     // default UseFile is returned by ADE.UseFile function
	ADXLen(14),
	RSILen(14),
	StochLen(14);

Vars:
	Class("BarInfoTest"), // class name for our test data
	InfoMap(MapSN.New),   // we will use this map to pass data to ADE.PutBarInfo
	WriteOk(true),
	DataMap(0),
	BarList(0),
	FirstCalcBar(999999999),
	LastCalcBar(0),
	BarID(0),
	oFastK(0),
	oFastD(0),
	oSlowK(0),
	oSlowD(0);

// If UseFile is true, load any previously stored data from the file on the first bar.
if CurrentBar = 1 and UseFile then begin
	DataMap = ADE.OpenMap(Class, GetSymbolName, ADE.BarInterval);
	BarList = MapSC.Get(DataMap, ":Bar");
	if BarList <> 0 then begin
		FirstCalcBar = ListN.Front(BarList);
		LastCalcBar = ListN.Back(BarList);
	end;
end;

BarID = ADE.BarID;
if BarID < FirstCalcBar or BarID > LastCalcBar then begin
	// Calculate metrics
	Value1 = Stochastic(High, Low, Close, StochLen, 3, 3, 1, oFastK, oFastD, oSlowK, oSlowD);

	// Store the indicator values in InfoMap so that we can pass it to ADE.PutBarInfo
	Value1 = MapSN.Put(InfoMap, "ADX", ADX(ADXLen));
	Value1 = MapSN.Put(InfoMap, "RSI", RSI(Close, RSILen));
	Value1 = MapSN.Put(InfoMap, "SlowK", oSlowK);
	Value1 = MapSN.Put(InfoMap, "SlowD", oSlowD);

	// Store the data for this symbol and bar interval.
	// ADE.PutBarInfo will copy the information from our InfoMap into the appropriate DataMap.
	Value1 = ADE.PutBarInfo(Class, GetSymbolName, ADE.BarInterval, BarID, InfoMap);
end;

// If UseFile is true, save the data to the file on the last bar.
if LastBarOnChart and BarStatus(1) = 2 and UseFile and WriteOk then begin
	Value1 = ADE.SaveMap(Class, GetSymbolName, ADE.BarInterval);
	WriteOk = false; // prevent repeated writes on new bars
end;

Plot1(0); // include a Plot statement so we can use this indicator in RadarScreen

Originally posted by Bamboo
Here’s another version of the indicator that plots the data as well as storing it (unlike the original version of “ADE Save Info Test”). I’m including this version because it illustrates an important issue that I haven’t documented, but that is worth knowing about.

The issue is that it’s not a good idea to intersperse Get and Put calls on the same bar if some of the bars may be older than the earliest bar in the DataMap. Note that this will only happen if (1) you loaded the DataMap from a file using ADE.OpenMap, and (2) the current chart contains bars older than the first bar in the file.

So why is this not a good idea? The explanation is a bit technical, so bear with me. When you Put data, ADE appends it to the end (for speed) and keeps track of it with an index map. The next time you Get the data, ADE sorts the DataMap (if necessary) so that all the series are in order. Thus, if you intersperse Gets and Puts while processing bars older than those currently in the map, the DataMap will get sorted on every bar! It will work, but it will slow things down a lot.

Fortunately, it’s easy to avoid this situation. You don’t really need to Get the data from ADE if you’re also Putting it. The following version of the indicator caches the results in variables when it needs to calculate new bars (before or after the bars currently in the DataMap). For existing bars, it retrieves data from the DataMap into the variables. Finally, it plots the variables. If you want to plot the results as well as store them, this is a much better approach than retrieving the data from the DataMap on every bar, since that would cause the problem described above.

Note that the approach discussed in these two posts is only necessary if the calculations take a lot of time. If that’s the case, however, it could make the indicator much more efficient.

Inputs:
	UseFile(ADE.UseFile),     // default UseFile is returned by ADE.UseFile function
	ADXLen(14),
	RSILen(14),
	StochLen(14);

Vars:
	Class("BarInfoTest"), // class name for our test data
	InfoMap(MapSN.New),   // we will use this map to pass data to ADE.PutBarInfo
	WriteOk(true),
	DataMap(0),
	BarList(0),
	FirstCalcBar(999999999),
	LastCalcBar(0),
	BarID(0),
	oFastK(0),
	oFastD(0),
	oSlowK(0),
	oSlowD(0),
	vADX(0),
	vRSI(0);

// If UseFile is true, load any previously stored data from the file on the first bar.
if CurrentBar = 1 and UseFile then begin
	DataMap = ADE.OpenMap(Class, GetSymbolName, ADE.BarInterval);
	BarList = MapSC.Get(DataMap, ":Bar");
	if BarList <> 0 then begin
		FirstCalcBar = ListN.Front(BarList);
		LastCalcBar = ListN.Back(BarList);
	end;
end;

BarID = ADE.BarID;
if BarID < FirstCalcBar or BarID > LastCalcBar then begin
	// Calculate metrics
	Value1 = Stochastic(High, Low, Close, StochLen, 3, 3, 1, oFastK, oFastD, oSlowK, oSlowD);
	vADX = ADX(ADXLen);
	vRSI = RSI(Close, RSILen);

	// Store the indicator values in InfoMap so that we can pass it to ADE.PutBarInfo
	Value1 = MapSN.Put(InfoMap, "ADX", vADX);
	Value1 = MapSN.Put(InfoMap, "RSI", vRSI);
	Value1 = MapSN.Put(InfoMap, "SlowK", oSlowK);
	Value1 = MapSN.Put(InfoMap, "SlowD", oSlowD);

	// Store the data for this symbol and bar interval.
	// ADE.PutBarInfo will copy the information from our InfoMap into the appropriate DataMap.
	Value1 = ADE.PutBarInfo(Class, GetSymbolName, ADE.BarInterval, BarID, InfoMap);
end
else begin
	Value1 = ADE.GetBarInfo(Class, GetSymbolName, ADE.BarInterval, BarID, InfoMap);

	vADX = MapSN.Get(InfoMap, "ADX");
	vRSI = MapSN.Get(InfoMap, "RSI");
	oSlowK = MapSN.Get(InfoMap, "SlowK");
	oSlowD = MapSN.Get(InfoMap, "SlowD");
end;

// If UseFile is true, save the data to the file on the last bar.
if LastBarOnChart and BarStatus(1) = 2 and UseFile and WriteOk then begin
	Value1 = ADE.SaveMap(Class, GetSymbolName, ADE.BarInterval);
	WriteOk = false; // prevent repeated writes on new bars
end;

Plot1(vADX, "ADX");
Plot2(vRSI, "RSI");
Plot3(oSlowK, "SlowK");
Plot4(oSlowD, "SlowD");

409. How does ADE.OpenMap work?

Originally posted by progster
Does an initial OpenMap() call load from disk into memory all the information in the file, or does it just load the info corresponding to the bars on the calling chart?

IOW, suppose I’ve saved a huge set of data to an ADE disk file at some point in the past – will a chart (or Radar) with only a small number of bars (or for Radar, ‘Additional Bars’) that calls OpenMap() fetch all the disk data into memory, or just a small subset of it?

Originally posted by Bamboo
ADE.OpenMap only reads the data from disk if the map doesn’t currently contain any data (i.e. only the first time it is called).

The ADE.OpenMap function fetches all the data in the file, not just the bars in the current chart.


410. How do I pass the latest ‘tick’ between charts with ADE?

When you read data from ADE it will only bring in the latest closed bar. So, for instance, if you are working on a 5 minute chart and try to retrieve 15 minute data, ADE will only retrieve the OHLCV data for the previous 15 minute bar, not for the 15 minute bar currently forming. Whilst this makes perfect sense in backtesting (because otherwise you will be looking into the future) you may need to retrieve the latest ‘tick’ when working in real-time. To do this you need to replace the ADE.BarID call with 9999999.9999. This retrieves the very latest price that is held by ADE. But you must be careful. Doing this in backtesting means you are looking into the future.

As an example, in your Receiver code you would have…

If LastBarOnChart then MyBarID=9999999.9999 else MyBarID=ADE.BarID;
value1=ADE.GetOHLCV(Sym, Interval, MyBarID, MyOpen, MyHigh, MyLow, MyClose, MyVolume);

It is also important that both indicators (‘sender’ and ‘receiver’) have ‘Update value intra-bar’ enabled.

411. How do I import my own OHLCV data into TS?

There are several options for importing your own data depending on whether your data is time-stamped or not, and on whether it is in OHLCV format or a custom format.


412. I have an indicator that I wish to use with ADE. What can I do?

You have several options:

  1. A number of indicators have already been rewritten to work with ADE. Check Topic 490 for more details.
  2. You can post a request in the forums to convert the indicator.
  3. It is not always necessary to convert indicators. You can save the indicator’s results in the original chart and then share those results using ADE. This only becomes an issue if there are large numbers of indicators to share, or if you wish to optimise your indicator on a large range of values.
  4. If you wish to convert your indicator to use with ADE then there are some instructions in this thread. Once you have converted the indicator it would be kind if you would post your code in the forums to share with other TS users.


413. Synchronization issues. How do I get the ‘save’ indicator to run before the ‘plot’ indicator?

There are two areas where the order of calculation of your analysis techniques is important.

The first is when first opening your charts. If your ‘plot’ indicator runs before your ‘save’ indicator then you will get an ADE “No data available for Class ‘OHLCV’, symbol, timeframe” error. The only way to resolve this particular problem is to put all your ‘save’ indicators in one workspace and then make sure that workspace is opened and fully calculated before you open further workspaces that contain ‘plot’ indicators.

The second area is when you need one indicator to calculate first so that its value is immediately available to other indicators (rather than one tick later). There is no catch-all solution to this problem, but there is some research in the Shared Memory Synchronization Techniques.


414. When I reference a previous value of ADE data using [1] terminology I get incorrect results. How do I fix this?

I can retrieve ADE OHLCV data using the command…

Value1 = ADE.GetOHLCV(Sym, Interval, ADE.BarID, MyOpen, MyHigh, MyLow, MyClose, MyVolume);

But then when I try to reference previous values using, for example, MyClose[1] I am getting incorrect results.

MyClose[1] means the value of MyClose one bar ago. If you are on a 5 min chart then MyClose[1] means the value of MyClose 5 mins ago. But if you are retrieving, say, 15 min ADE data you are getting the value of MyClose 5 mins ago, not 15 mins ago.

To retrieve the value of MyClose on the previous 15 min chart you need to use the ADF.Close function…

MyClose_1 = ADF.Close(Class, Sym, Interval, ADE.BarID, 1);

The ‘1’ refers to one bar ago. Interval is the bar interval of the higher timeframe data – in this example ’15’. (The Class variable should be set to “OHLCV”.) Now, the variable MyClose_1 refers to the value of MyClose one bar ago on the higher timeframe chart.


415. How do I ‘trick’ ADE into sending the daily close price to an intraday chart when the intraday session closes before the daily session?
When you retrieve data from ADE you use the function ADE.BarID to specify the date and time of the data you require. ADE.BarID is just a number in the format date.time. Rather than using ADE.BarID you could call the function with date.1700 (replacing date with the EL date). Then ADE will look for data upto 1700. Have a look at the ADE.BarID function to see how it is constructed.

Of course, you have to be very careful with this method because you are ‘peeking’ into the future.

更新于 2020年4月10日

这篇文章对您有帮助吗?

相关的话题

留言评论