Foreign symbol data padding, was: No data days problem

Hello Friends
excuse if i have problem in my english writing
i use _extra file symbols to input my extra needed information in my symbols.
in days that _extra files is empty , my histogram give a bad and fake signal.
how i can remove it?

if i want to explane more :
for example in original symbol i have data on 21/4/2018
and in _extra file i dont have any data for 21/4/2018
and in my histogram that given form _extra file a very long histogram shows ...
i dont want show that fake histogram

i try to say my purpose with pictures
thanks for help

Do verify that you have posted the pictures because nothing is seen yet.

1 Like

excuse me. see this pictures:
0001 ![0002|474x500]

0002

in pictures we see that in main file we have data for 2018/04/21
and in _extra file we dont have data for 2018/04/21
and this problem make fake long histogram in my indicator
thanks for help...

You don't say all the details so a lot of guessing work is required to find out what you mean. (See How to ask a good question)

So let the guessing begin:

I guess that lower pane that you show is created using formula that uses Foreign function to refer to your "_extra" symbol while selected symbol is your "main" one that actually has data for 2018/04/21

If the above is true, then you should read the documentation on Foreign function http://www.amibroker.com/f?foreign including the comment that says:

Foreign function synchronizes the data file you are referencing with the currently selected symbol.

Synchronization makes sure that EACH bar of FOREIGN data matches exactly with each bar of currently selected symbol.

So if DateNum() function returns 990503 for given bar then Close array represents the CLOSE of currently selected symbol at May 3, 1999 and Foreign("SYMBOL", "C") represents close of foreign symbol at May 3, 1999 TOO.

This is absolutely necessary because otherwise you won't be able to do ANY meaningful operations involving both selected symbol and foreign symbol. This also needed for the display so when you mark the quote with vertical line it will always match the date displayed regardless if you use Foreign or not. Please note that if you have data holes in currently selected symbol then in order to synchronize bars Foreign function will remove bars that exist in Foreign symbol but do not exist in currently selected symbol.

2 Likes

this is code for histogram:
myVal = Foreign(Name()+"_extra","L");
dynamic_color = IIf( myVal > 0, colorGreen, colorRed );
Plot( myVal, "Taghsimi", dynamic_color , styleHistogram | styleThick);

thanks
whith this code problem solved:

myVal = Foreign(Name()+"_extra","L",0);
dynamic_color = IIf( myVal > 0, colorGreen, colorRed );
Plot( myVal, "Taghsimi", dynamic_color , styleHistogram | styleThick);

thank you very much :smiling_face_with_three_hearts: