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

[amibroker] MACDxPriceOSC With MAEMA Filter



PureBytes Links

Trading Reference Links



Ok, Im Happier with this revision. It gives a little more room to
move.
(Also, Im not sure why I had NOT in the Buy/Sell Filters
before).
To Adjust Prediction curve lookback Use Parameters Dialog
(CTRL-R).
*NOTE* 
Adjust LBUP/LBDown OR LBBoth.

// MAcross, EMAcross
Prediction curves, by Dimitris Tsokakis, July 2003
// MACD OSC cross, By Dennis aka theoldchartreader@xxxxxxxxx
// Integration By Michael.S.G.
LBU =
Param("LookBack
Up",1,0,BarCount,1);
LBD =
Param("LookBack
Down",1,0,BarCount,1);
B   =
Param("LookBack
Both",0,0,BarCount,1);
//Plot(C,"Close",5,8);
K=30;EMAk=EMA(C,k);//
Plot(EMAk,"EMAk",1,8);
p=20;EMAp=EMA(C,p);//
Plot(EMAp,"EMAp",2,8);
EMAcrossClose=((p+1)*(k-1)*EMAk-(k+1)*(p-1)*EMAp)/(2*(k-p));
//Plot(EMAcrossClose,"EMAcrossClose",4,8);
MAcrossClose=(p*(k-1)*MA(C,k-1)-k*(p-1)*MA(C,p-1))/(k-p);
//Plot(MAcrossClose,"MAcrossClose",2,8);
//GraphXSpace=5;
UTrend = EMAcrossClose <
Ref(EMAcrossClose,
-(LBU+b)) AND MAcrossClose <
Ref(MAcrossClose,
-(LBU+b));
DTrend = EMAcrossClose >
Ref(EMAcrossClose,
-(LBD+b)) AND MAcrossClose >
Ref(MAcrossClose,
-(LBD+b));
t1 =
OscP(
3,
6
);
Cond1a=
Cross
(t1,MACD());
Cond1b=
MACD()>-1
AND
MACD()<0;
Cond1= Cond1a AND Cond1b;
Cond2 = MACD()>Signal()-.5;
Buy = Cond1 AND Cond2 AND UTrend;
Sell=Cross(0,t1) AND DTrend;
Color = IIf(O > C, colorBlack, colorRed);
Plot( Close, "Price", color, styleCandle );
PlotForeign( GetBaseIndex(), GetBaseIndex(), colorLightGrey ); 
PlotShapes( shapeDownArrow * Sell, colorRed );
PlotShapes( shapeUpArrow * Buy, colorGreen );
ZColor = IIf(UTrend, colorAqua, IIf(DTrend,colorYellow,colorLightGrey));
Plot( Close, "Trend", ZColor, 3);







Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.




// MAcross, EMAcross Prediction curves, by Dimitris Tsokakis, July 2003
// MACD OSC cross, By Dennis aka theoldchartreader@xxxxxxxxx
// Integration By Michael.S.G.

LBU = Param("LookBack Up",1,0,BarCount,1);
LBD = Param("LookBack Down",1,0,BarCount,1);
B   = Param("LookBack Both",0,0,BarCount,1);

//Plot(C,"Close",5,8);
K=30;EMAk=EMA(C,k);// Plot(EMAk,"EMAk",1,8);
p=20;EMAp=EMA(C,p);// Plot(EMAp,"EMAp",2,8);
EMAcrossClose=((p+1)*(k-1)*EMAk-(k+1)*(p-1)*EMAp)/(2*(k-p));
//Plot(EMAcrossClose,"EMAcrossClose",4,8);
MAcrossClose=(p*(k-1)*MA(C,k-1)-k*(p-1)*MA(C,p-1))/(k-p);
//Plot(MAcrossClose,"MAcrossClose",2,8);
//GraphXSpace=5;

UTrend = EMAcrossClose < Ref(EMAcrossClose, -(LBU+b)) AND MAcrossClose < Ref(MAcrossClose, -(LBU+b));
DTrend = EMAcrossClose > Ref(EMAcrossClose, -(LBD+b)) AND MAcrossClose > Ref(MAcrossClose, -(LBD+b));

t1 = OscP( 3, 6 );
Cond1a= Cross (t1,MACD());
Cond1b= MACD()>-1 AND MACD()<0;
Cond1= Cond1a AND Cond1b;
Cond2 = MACD()>Signal()-.5;
Buy = Cond1 AND Cond2 AND UTrend;
Sell=Cross(0,t1) AND DTrend;

Color = IIf(O > C, colorBlack, colorRed);
Plot( Close, "Price", color, styleCandle );
PlotForeign( GetBaseIndex(), GetBaseIndex(), colorLightGrey ); 

PlotShapes( shapeDownArrow * Sell, colorRed );
PlotShapes( shapeUpArrow * Buy, colorGreen );

ZColor = IIf(UTrend, colorAqua, IIf(DTrend,colorYellow,colorLightGrey));

Plot( Close, "Trend", ZColor, 3);