[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EquisMetaStock Group] Need to write a simple cross over code and need help



PureBytes Links

Trading Reference Links



Hi Nagatron
 
 
The most effective way to learn the MetaStock Formula Language (in my opinion) is to work with it rather than read about it. The MFL section of the User Manual gives you most of the basics but your skills will develop more slowly if you don't practice creating your own code. I doubt that the Formula Primer has much to teach beyond the basics but some users do find it helpful.
 
Your entry formula can be written in a number of different ways - the style used isn't as important as the logical correctness. When combining AND and OR logical operators, as in these examples offering solutions to your question, it's important to get the operator precedence right. If in doubt use parentheses. As you get more familiar with the language you'll become more aware of the pitfalls and their solutions.
 
O>Mov(C,20,E) AND
Mov(C,20,E)>Mov(C,50,E) AND
V>Mov(V,30,E) AND
(Ref(L,-3)<Mov(C,20,E) OR  Ref(L,-5)<Mov(C,20,E));
 
M:=Mov(C,20,E);
O>M AND M>Mov(C,50,E) AND V>Mov(V,30,E) AND
(Ref(L,-3)<M OR Ref(L,-5)<M);
 
M:=Mov(C,20,E);
(O>M) * (M>Mov(C,50,E)) * (V>Mov(V,30,E)) *
(Ref(L,-3)<M OR Ref(L,-5)<M);
 
M:=Mov(C,20,E);
If(O>M AND M>Mov(C,50,E) AND V>Mov(V,30,E) AND
(Ref(L,-3)<M OR Ref(L,-5)<M),1,0);
 
 
Roy
 
 
 
----- Original Message -----
From: nagratron
Sent: Sunday, November 01, 2009 11:40 PM
Subject: [EquisMetaStock Group] Need to write a simple cross over code and need help

 

I'm reading the formula primer and it's pretty bad. Unclear. I need to write a pretty easy formula:

entry:

Open is > 20 EMA

20 EMA is > 50 EMA

Volume is > 30 EMA of volume
----------------------------------
low from 3 days ago is < 20 EMA
or
low from 5 days ago is < 20 EMA

exit:
20 EMA < 50 EMA

That's it. You should probably test this out yourself. It works way to well in bull markets. Thanks in advance!



__________ NOD32 4561 (20091031) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com


__._,_.___


Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___