logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
molfetta  
#1 Posted : Thursday, July 26, 2007 4:13:21 AM(UTC)
molfetta

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/20/2007(UTC)
Posts: 5

Hi everybody,

I'd like to build an indicator that makes the subtraction among two already plotted indicators. For example, if I have a 21 and a 15-day moving averages, I'd like to be able to select the minuend and the subtrahend and then plot the difference using the indicator.

I could write it in a non flexible way. I mean, considering the 2 moving averages: mov(c,21,s) - mov(c,15,s). But, as I told, this is not flexible and will work for the those moving averages only.

Can anyone help me?

Thanks in advance

Marco

oztrader  
#2 Posted : Thursday, July 26, 2007 6:36:56 AM(UTC)
oztrader

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

Marco,

What are the variables you require in the MA's?

oztrader

wabbit  
#3 Posted : Thursday, July 26, 2007 6:38:50 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Marco

You cannot dynamically or programmatically select plotted functions, but you might like to try creating another indicator where you use the Input() function to achieve a similar result:

Code:

{user data}
prd1:=Input("MA1 periods",1,500,21);
prd2:=Input("MA2 periods",1,500,15);
data:=Input("Data: 1-O 2-H 3-L 4-C 5-MP 6-Typ",1,6,4);
data:=If(data=1,O,If(data=2,H,If(data=3,L,If(data=4,C,If(data=5,MP(),Typical())))));

{indicators}
ma1:=mov(data,prd1,e);
ma2:=mov(data,prd2,e);

diff:=ma1-ma2;

{plot/return}
0;
diff;




Hope this helps

wabbit [:D]

molfetta  
#4 Posted : Thursday, July 26, 2007 9:02:14 AM(UTC)
molfetta

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/20/2007(UTC)
Posts: 5

Thanks to all of you!

Special thanks to Wabbit. I have a couple of things to show you based on the cycle theory. The only problem is that I don't speak English, so first of all I have to think how to explain it. It takes time......

For Oztrader: the varialbles could be the "price field" and the "lenght". But the problem is not this. I'd like it to work, for example, for 2 different momentum or other indicators without writing it down everytime......

Best Regards

Marco

Users browsing this topic
Guest (Hidden)
Similar Topics
normalizing and subtraction volume (Formula Assistance)
by magiclaas 10/3/2014 4:25:09 PM(UTC)
Subtraction (Basic Coding Techniques)
by marco_1971 1/9/2014 8:42:43 AM(UTC)
subtraction of two normalized index (MetaStock)
by magiclaas 12/3/2013 2:46:23 PM(UTC)
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.