Hi.
i am trying to use correlation function
to see the result between nikkei and s&p.
the problem is that there's some difference of holidays between japan and US,
so if i plot nikkei and s&p on one chart,
there shows up a blank day.(as i pointed it in the attached picture)
and then suddenly correlation between them becomes 0.
i used 'correlation(c of data1, c of data2,50)' code for this.
i tried some language to fix this, but my knowledge wans't enough.
can someone help me out here?
Regards.
correlation function problem
-
- Posts: 742
- Joined: 09 Apr 2010
- Location: Texas
- Has thanked: 483 times
- Been thanked: 274 times
- Contact:
Re: correlation function problem
I've done similar correlation studies and I simply write something like:
That way any blank days (holidays) are skipped.
Code: Select all
If data 1 <> 0 and data2 <> 0 then begin
That way any blank days (holidays) are skipped.
Re: correlation function problem
@sptrader
thanks for reply.
but doesn't work that way.
i tried to plot "1" if there's any blank day, and plot "0" with no blank day
with this codes
" if c of data1<>0 and c of data2<>0 then val1=0 else val1=1;
plot1(val1); "
but it doesn't work.
anyway thanks for your reply.
thanks for reply.
but doesn't work that way.
i tried to plot "1" if there's any blank day, and plot "0" with no blank day
with this codes
" if c of data1<>0 and c of data2<>0 then val1=0 else val1=1;
plot1(val1); "
but it doesn't work.
anyway thanks for your reply.
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: correlation function problem
Hello rokanten,
I would recommend you to compile your own combined holiday list in QuoteManager *using one of the existing ones, that is not necessary for you), so you will see bars on your charts only when there are no holidays both in US and Japan, and there will be no calculation on the data 2 when there is a holiday on data 1 or vice versa, however this would affect all other charts, so that solution may not be a good one for you.
The other variant i can think of is to add a filter to your script not to calculate the script on particular dates, so it won't give you 0 result.
Both my suggestions are based on idea to skip calculation of the script on particular dates. If this is not what you looking for, please let me know.
I would recommend you to compile your own combined holiday list in QuoteManager *using one of the existing ones, that is not necessary for you), so you will see bars on your charts only when there are no holidays both in US and Japan, and there will be no calculation on the data 2 when there is a holiday on data 1 or vice versa, however this would affect all other charts, so that solution may not be a good one for you.
The other variant i can think of is to add a filter to your script not to calculate the script on particular dates, so it won't give you 0 result.
Both my suggestions are based on idea to skip calculation of the script on particular dates. If this is not what you looking for, please let me know.
Re: correlation function problem
@Andrew MultiCharts
thanks for your suggestions.
but both of them are not the way i wanted.
the first one would be missing data, and the second one would be exhausting work.
thanks anyway.
thanks for your suggestions.
but both of them are not the way i wanted.
the first one would be missing data, and the second one would be exhausting work.
thanks anyway.
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: correlation function problem
As for the second option, it should not be that hard:
Code: Select all
If date <> X or date <> Y or date <> Z or date <> ... then begin
*your script*
end;