Erroneous spread of candles after using FOREIGN function to combine scrips

Hi there,
I have combined multiple i.e. 5 scrips using FOREIGN function as follows _

O1 = Foreign( S1 , "O" );
.
.

O5 = Foreign( S5 , "O" );

then

O123 = O1 + O2 + O3 + O4 + O5;    //Open value of combination of all scrips

Same way for other symbols I calculated their O,H,L,C values & stored in O123, H123, L123, C123.

Now I am plotting the candle chart using_

PlotOHLC( O123, H123, L123, C123, "" + Name(), colorWhite, styleCandle | styleNoLabel );

I am able to get the chart, but the problem is 'The spread of any individual candle is huge, which is not real spread.'
e.g. Final value of O123, H123, L123, C123 is in 1800 range. But the spread I am getting for 1-min candle is 100-150. i.e. movement in 1 minute is showing as 100-150 points for 1800 current price.
It is happening for the spread of all candles in the chart.

Screenshot with erroneous spread -

Erroneous

Please guide me to correct this error and plot the combined graph correctly.
Thank you.

There seems nothing wrong unless your understanding of the word spread is different.

IF you are going to Add the O,H,L,C values of 5 symbols and the total is around 1800, there can easily be a H - L of 150.
Whats wrong in that ?
A statistical spread can be arrived it using many different methods

A ratio plot, for example, of two symbols is S2/S1, or many would be S3/S1, S4/S1 etc

If you are simply summing up values, you should revisit that part of your logic.

1 Like

Hi @travick,
Thanks for the reply.
You are correct that 150-200 movement is possible, but it cannot be possible in 1-min candle.
I have observed the live chart also. It moves 10-25 points in any individual 1-min candle.
And in my chart, it is the thing happening. Hence I need to correct it.

Do one thing, why don't you take one specific candle, then for each individual bar, post the OHLC values here for all the 5 symbols.
that's the only way to contest.

Secondly, by using the word spread, you are still not clear. From what I see, you are just adding each OHLC of 5 symbols.

2 Likes

HI @travick,
Thanks for the reply.
I tried your trick. It helped me find the problem. In individual candle also, the problem persists.
I investigated & actually the problem is from data vendor. Many people are complaining about it.
(By spread I mean Difference between H & L.)