ATR with foreign - different values with different symbol in focus


Came across a weird occurrence that I have not been able to get my head around.
I am using the ATR formula on Foreign symbol for one of my tests and noticed a difference when a different chart is loaded.

Formula below:


nATR = ATR(10);
printf("\nATR :"+nATR);

Now when I am looking through the charts, when the right symbol is in focus and when a different symbol is in focus, the ATR values are showing up differently. [Attached screenshot]
ATR with correct symbol :
ATR - with correct symbol

ATR with different symbol :
ATR with different symbol

Any clues on why this may be happening?

Siddhant Kankani

In case the reading in the interpretation window is not clear,

First image, ATR shows as 35.35
Second image, ATR shows as 34.94

The only change is the symbol in focus.


Normally this is cause by missing data in one of the symbols.

Read carefully the help ... (also search the forum for pad align)

Thanks @awilson. This makes sense.
Any way to avoid / go around this so that I can get the right data points (Corresponding to the original symbol)?

I am using Amibroker to also generate symbols for various other tickers hence would like to see if there is a way around this.


Essentially, I am looking at if pad and align can be done from the symbol in focus(on the chart) to the symbol that is being referenced via Foreign.

Hi Experts,

Any thoughts around this, please.

Siddhant Kankani

Why are you using Foreign in first place? If you have data holes and you are interested to get data from particular symbol without padding, just select that symbol. The symbol you are interested in should be SELECTED symbol.
You can see TWO or MORE charts in parallel with DIFFERENT symbols selected. Use Window->Tile command to tile multiple windows and display charts for different symbols at once.

Hi @Tomasz

I have a strategy that runs through 35 different tickers and creates signals for them. My thought was instead of having 35 charts open, it would make sense to utilize Foreign and run it from a single chart.

The single chart also acts as a dashboard where information from all the symbols are displayed in the UI.

If there is a better way of doing the same, would be glad to try it out.

Siddhant Kankani

Using Foreign is the worst approach to this goal.

Preferred solution is to run in Analysis (which is intended for multi-symbol runs) or (if you need charts) use multiple charts.

Interesting. Thanks for the guidance Tomasz.

So my objective is two fold:

  1. Run the code on 'x' number of symbols and get the output (The output is a CSV file that is generated as and when a trigger happens)
  2. Show a dashboard of current positions

With your suggested way of doing this, I will be running the scan for the last 1 bar on the 'x' symbols as my filters and as earlier set Static Variables from which the dashboard can be created.

Is this an accurate thought?
Many thanks again for the help.

Siddhant Kankani

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.