Amibroker AFL code for StochD_StochK Single

MarketSecrets - Learn To Trade Like a Pro

Amibroker AFL code for StochD_StochK Single:

Script:

//——————————————————————————
//
// Formula Name: StochD_StochK Single.afl
// Author: www.marketsecrets.in
//
//——————————————————————————

 

STK=Optimize (“StK” , 14, 2, 18, 2);
STD=Optimize (“StD” ,14, 2, 18, 2);
pds = Optimize(“pds”, 9,2,18,2);


STK=LastValue(STK);
STD=LastValue(STD);
pds = LastValue(pds);

Sell= Cross (EMA (StochD (STD),pds),EMA( StochK (STK),pds));
Buy= Cross (EMA(StochK (STK),pds),EMA( StochD (STD),pds));
Cover = Cross (EMA(StochK (STK),pds),EMA( StochD (STD),pds));
Short = Cross (EMA (StochD (STD),pds),EMA( StochK (STK),pds));

Filter=Buy OR Sell OR Short OR Cover;

Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); Short=ExRem(Short,Cover); Cover=ExRem(Cover,Short);
NumColumns = 2;
Column0 = EMA( StochK (STK),pds);
Column1 = EMA (StochD (STD),pds);

AddColumn(Buy,”Buy”); AddColumn(Sell,”sell”); AddColumn(Short,”short”); AddColumn(Cover,”cover”);

Graph0 = EMA( StochK (STK),pds);
Graph1 = EMA (StochD (STD),pds);
Graph2 = (EMA( StochK (STK),pds) – EMA (StochD (STD),pds))*2;
Graph2Style = 2;
Graph2Color =1;


Title=Name()+” ” +”StD% Cross StK%” + ” ” +”%K=”+WriteVal(Graph0,FORMAT=1.1)+”, %D=”+
WriteVal(Graph1,FORMAT=1.1)+
WriteIf(Graph0>Graph1,” LONG position”,” “)+
WriteIf(Graph1>Graph0,” SHORT position”,””)+”; “+ ” Delta” + ” “+WriteVal((Graph2/2),FORMAT=1.1)+”%”;

 

Download File

error: Content is protected !!