MACD And Stochastic: A Double-Cross Strategy

#41
Just a Try

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
////////////////////////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("Slow Stochastic");
periods = Param( "Periods", 14, 1, 200, 1 );
Ksmooth = Param( "%K avg", 4, 1, 200, 1 );
Dsmooth = Param( "%D avg", 4, 1, 200, 1 );
_SECTION_END();
////////////////////////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("MACD");
r1 = Param( "Fast avg", 5, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
_SECTION_END();
///////////////////////////////////////////////////////////////////////////////////////////////////
Buy = (StochK( periods , Ksmooth ) > StochD( periods , Ksmooth, DSmooth )) AND MACD(5,26) > Signal(5,26,9);
Sell = Signal(5, 26, 9)> MACD(5,26) AND StochD( periods , Ksmooth, DSmooth ) > StochK( periods , Ksmooth );

Filter=Buy OR Sell;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorBlue, 0,Low, Offset=-20);
PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-20);
 

Mr.G

Well-Known Member
#42
I never wasted time or money on amibroker, anyways lots of thanks to you my friend. I use odin for my charting purposes.
 

mastermind007

Well-Known Member
#46
I never wasted time or money on amibroker, anyways lots of thanks to you my friend. I use odin for my charting purposes.
Download a free one. ODIN has not even enrolled in Kindergarden of Charting.
 

Mr.G

Well-Known Member
#47
Download a free one. ODIN has not even enrolled in Kindergarden of Charting.
I am a fundamental investor my friend, I have little need for charts. I just want to extinguish my curiosity for TA. I will make paper trades. I'm being attracted towards using 3-15 crossover on the weekly charts. :?
 

Similar threads