Hello again,
I posted this question sometime ago and I had some help regarding
the creation of ratios in Amibroker. What I need to do is to create
a simple ratio between two stocks and to be able to apply various
indicators on this "new" security. For example, I need to create a
ratio between ORCL and MSFT (ORCL/MSFT). I coded it as follows:
OM=Open/Foreign("MSFT","Close");
HM=High/Foreign("MSFT","Close");
LM=Low/Foreign("MSFT","Close");
CM=Close/Foreign("MSFT","Close");
PlotOHLC(OM,HM,LM,CM,"SRatio",colorRed, styleCandle);
I apply this forula to the ORCL chart and it creates the ratio in a
new panel. So far, so good! That's exactly what I want. But with
this, I cannot apply indicators on this ratio. And that's what I
need to do!
So I did as follows:
OM=Open/Foreign("MSFT","Close");
HM=High/Foreign("MSFT","Close");
LM=Low/Foreign("MSFT","Close");
CM=Close/Foreign("MSFT","Close");
PlotOHLC(OM,HM,LM,CM,"SRatio",colorRed, styleCandle);
AddToComposite(CM,"~Satio","C",1+2+8+16);
AddToComposite(HM,"~Satio","H",1+2+8+16);
AddToComposite(LM,"~Satio","L",1+2+8+16);
AddToComposite(OM,"~Satio","O",1+2+8+16);
Now as I understand this (please feel free to correct me as I am a
newbie in Amibroker), the first five lines create the new security
and plots it. The last four lines basically creates a new composite
(~Satio) which I can find in the symbol bar and apply it to new
templates.
However, it seems to work fine for the first security that I apply
on; but for the second security it doesn't refresh. I need to
refresh this new composite with each new stock that I open; but that
doesn't seem to be the case. I open the first stock "ORCL"; then
apply this new formula which creates and displays the ratio in a new
pane; then in the symbol field I put in the new composite (~Satio)
which then replaces ORCL with this nex composite. Now I change the
stock to "CSCO" and now ~Satio doesn't update!!
Can anybody help me in this regard??? All I need to do is to create
a ratio between two stocks; plot it and then apply indicators on
this composite.
Any help would be highly appreciated.
Thanks again in advance for your help.
Regards,
S.