Rank: Newbie
Groups: Registered, Registered Users Joined: 3/3/2006(UTC) Posts: 1
|
Im stuck!
I have developed a number of 'marketbased' indicators by calling an index into the formula - for example for a binary for showing when an index close is higher than its moving average:
SP:=Security("C\\Metastock Data..............\\.SPX",C);
SP>Mov(SP,15,E)
creates a simple binary which can be used in explorations etc
However, its seems impossible to do the same with indicators such as ATR(periods) that do not specify a price array. Hence, ATR used in an exploration simply returns the ATR of a particular stock but not of the index being called. Same for the trend indicator (ADX) that again does not specify a price array. Does anybody have a work around for this other than highlighting a plot and using the p variable (too slow)? Would you perhaps need to write the full version of the ATR indicator calling on the various price arrays?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Wallara
Wouldn't this work? Or have I misunderstood your question?
SP:=Security("C\\Metastock Data..............\\.SPX",RSI(C,14));
SP>Mov(SP,15,E);
The data array used with the Security() function can be almost anything you like - it doesnt have to be a price does as far as I'm aware.
Roy
MetaStock Tips & Tools
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
I've found that Security("Symbol",indicator formula) sometimes gives unreliable results.
I prefer to reference the security's raw data, and then construct the indicator from the ground up if possible:
[code:1:6260f0c93a]
===========
ATR formula
===========
---8<---------------------------
pds:=Input("ATR smoothing periods",1,2600,14);
plot:=Input("ATR smoothing: [1]MetaStock, [2]EMA",1,2,1);
{ Data arrays }
xClose:=Security("C\\Metastock Data\\...\\.SPX",C);
xHi:=Security("C\\Metastock Data\\...\\.SPX",H);
xLo:=Security("C\\Metastock Data\\...\\.SPX",L);
xClose1:=ValueWhen(2,1,xClose);
{ True Range }
TrueRange:=Max(xHi-xLo,
Max(Abs(xClose1-xHi),Abs(xClose1-xLo)));
{ MetaStock ATR smoothing }
ATRmetaStock:=Mov(TrueRange,pds*2-1,E);
{ EMA ATR smoothing }
ATRema:=Mov(TrueRange,pds,E);
{ Plot in own window }
If(plot=1,ATRmetaStock,ATRema)
---8<---------------------------
[/code:1:6260f0c93a]
jose '-)
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/7/2005(UTC) Posts: 1,346
|
my folder paths seem to differ somewhat..... xClose:=Security("C[color=red:5a1827a430]:[/color]\\Metastock Data\\reuters BM Data\\.SPX",C); is needed as oposed to xClose:=Security("C\\Metastock Data\\reuters BM Data\\.SPX",C); ...... a slight [color=red:5a1827a430]:[/color] difference but the only way mine will work..... h
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.