Skip to content

Instantly share code, notes, and snippets.

@marketcalls
Created April 22, 2021 17:07
Show Gist options
  • Save marketcalls/f2cdac12804e5ee9099e6994b5160c6a to your computer and use it in GitHub Desktop.
Save marketcalls/f2cdac12804e5ee9099e6994b5160c6a to your computer and use it in GitHub Desktop.
Simple Stochastic Crossover System
//Coded for Amibroker AFL Collection
//Coder : Rajandran R
//Website : www.marketcalls.in and www.algomojo.com
_SECTION_BEGIN("Stochastic Crossover System");
range = Param("Range",14,1,50,1);
ksmooth = Param("KSmooth",3,1,50,1);
dsmooth = Param("DSmooth",3,1,50,1);
toggle = ParamToggle("Remove Excessive Signals","Enable|Disable");
sk = StochK(range,ksmooth);
sd = StochD(range,ksmooth,dsmooth);
Buy=Cross(sk,sd) AND sk <25 AND sd <25;
Sell=Cross(sd,sk) AND sk > 80 AND sd > 80;
if(toggle)
{
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
}
Short=Sell;
Cover=Buy;
Plot( sd, _DEFAULT_NAME(), colorRed , ParamStyle("Style") );
Plot( sk, _DEFAULT_NAME(), colorBlue , ParamStyle("Style") );
PlotShapes( IIf(Buy, shapeUpArrow,0) , colorGreen ,0,sd,-10);
PlotShapes( IIf(Sell, shapeDownArrow,0) , colorRed ,0, sd,-10);
_SECTION_END();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment