- Katılım
- 23 Eki 2020
- Mesajlar
- 1,826
In Dr Alexander Elder's book "Entries and Exits", he discusses "The Impulse System". When MACD Histogram and EMA are both rising, the price bar is coloured green. When they are falling, the price bar is coloured red. When they diverge, the price bar is blue. When green, go long or stand aside. When red, go short or stand aside. When blue, go long or short. A man named John Bruns programmed the Impulse System for several popular software packages. Question: is there an addon available for Metastock Pro 9.2? Or, can this be programmed by me within the existing software?
| ||
| ||
|
Kod:
======================
Elder's Impulse system
======================
---8<------------------------------------------
{ Dr Elder's Impulse system interpretation v1.1
Plot signals on own window below daily chart.
http://www.elder.com/MetaStock/Impulse.htm
http://www.metastocktools.com }
{ Variables user-input }
pdsNoEntry:=Input("No entry x periods from last exit",0,21,5);
pdsW:=Input("Weekly EMA periods",1,520,13)*5;
pdsD:=Input("Daily EMA periods",1,252,13);
pdsShort:=Input("Shorter MACD periods",
1,252,12);
pdsLong:=Input("Longer MACD periods",2,2520,26);
pdsSignal:=Input("MACD trigger signal periods",
2,252,9);
tradeDelay:=0;
{ Indicators }
EmaW:=Mov(C,pdsW,E);
EmaD:=Mov(C,pdsD,E);
Mac:=Mov(C,pdsShort,E)-Mov(C,pdsLong,E);
MacTrig:=Mov(Mac,pdsSignal,E);
Hist:=Mac-MacTrig;
{ System logic }
Out:={EmaW<Ref(EmaW,-1)
AND }EmaD<Ref(EmaD,-1)
AND Hist<Ref(Hist,-1);
In1:=EmaW>Ref(EmaW,-1)
AND EmaD>Ref(EmaD,-1)
AND Hist>Ref(Hist,-1);
In:=In1 AND BarsSince(Out)>pdsNoEntry;
{ System signals }
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=Ref(BarsSince(Init OR In)
<BarsSince(Init OR Out)+InInit,-tradeDelay);
signals:=(InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2));
{ Plot }
0;signals
Source / From: | |