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

[amibroker] MA Plurality indicator (custom)



PureBytes Links

Trading Reference Links


My own creation. When red line touches bottom green line, that's a 
buy signal. When red line touches upper red line, that's a sell or 
short signal. Enjoy! I won't be reading comments posted here. ~Bman

/* Moving Average Plurality */
// Use with T3 to verify T3 moves
// use an oscillator such as IFT of RSI or Slow Stochastic alongside 
this

varPeriod1 = Param("per1",10,1,100,1);
varPeriod2 = Param("per2",50,1,100,1);
varPeriod3 = Param("per3",100,1,500,5);
varPeriod4 = Param("per4",200,1,500,5);
varPeriod5 = Param("per5",5,1,100,1);
varClose = (H+L+O+C)/4;
varMA1 = MA(varClose,varPeriod1);
varMA2 = MA(varClose,varPeriod2);
varMA3 = MA(varClose,varPeriod3);
varMA4 = MA(varClose,varPeriod4);
varMA5 = MA(varClose,varPeriod5);

varContract1 = IIf((varMA2-varMA1)<(Ref(varMA2,-1)-Ref(varMA1,-
1)),8,0);
varExpand1 = IIf((varMA2-varMA1)>(Ref(varMA2,-1)-Ref(varMA1,-1)),-
8,0);

varContract2 = IIf((varMA4-varMA2)<(Ref(varMA4,-1)-Ref(varMA2,-
1)),10,0);
varExpand2 = IIf((varMA4-varMA2)>(Ref(varMA4,-1)-Ref(varMA2,-1)),-
10,0);

varContract3 = IIf((varMA2-C)<(Ref(varMA2,-1)-Ref(C,-1)),1,0);
varExpand3 = IIf((varMA2-C)>(Ref(varMA2,-1)-Ref(C,-1)),-1,0);

varContract4 = IIf((varMA4-C)<(Ref(varMA4,-1)-Ref(C,-1)),5,0);
varExpand4 = IIf((varMA4-C)>(Ref(varMA4,-1)-Ref(C,-1)),-5,0);

varContract5 = IIf((varMA1-C)<(Ref(varMA1,-1)-Ref(C,-1)),1,0);
varExpand5 = IIf((varMA1-C)>(Ref(varMA1,-1)-Ref(C,-1)),-1,0);

varContract6 = IIf((varMA5-C)<(Ref(varMA5,-1)-Ref(C,-1)),1,0);
varExpand6 = IIf((varMA5-C)>(Ref(varMA5,-1)-Ref(C,-1)),-1,0);

varUptrend1 = IIf(varMA1>varMA2,1,0);
varDowntrend1 = IIf(varMA1<varMA2,-1,0);

varUptrend2 = IIf(varMA2>varMA4,1,0);
varDowntrend2 = IIf(varMA2<varMA4,-1,0);

varUptrend3 = IIf(C>varMA2,5,0);
varDowntrend3 = IIf(C<varMA2,-5,0);

varUptrend4 = IIf(C>varMA4,7,0);
varDowntrend4 = IIf(C<varMA4,-7,0);

varUptrend5 = IIf(C>varMA1,1,0);
varDowntrend5 = IIf(C<varMA1,-1,0);

varUptrend6 = IIf(C>varMA5,1,0);
varDowntrend6 = IIf(C<varMA5,-1,0);

//VarPriceSum = IIf(C>Ref(C,-1),20,IIf(C<Ref(C,-1),-20,0));
VarHLSum = IIf(H>Ref(H,-1),20,IIf(L<Ref(L,-1),-20,0));
VarExtremeMove = IIf(C>1.02*Ref(C,-1),20,IIf(C<0.98*Ref(C,-1),-20,0));

// Summation
varPlot = 
varContract1 + 
varExpand1 +
varUptrend1 +
varDowntrend1 +
varContract2 + 
varExpand2 +
varUptrend2 +
varDowntrend2 +
varContract3 + 
varExpand3 +
varUptrend3 +
varDowntrend3 +
varContract4 + 
varExpand4 +
varUptrend4 +
varDowntrend4 +
varContract5 + 
varExpand5 +
varUptrend5 +
varDowntrend5 +
varContract6 + 
varExpand6 +
varUptrend6 +
varDowntrend6;

VarPlot1 = Wilders(varPlot,3);
VarPlot1 = Wilders(VarPlot1,4);

VarPlot2 = WMA(varPlot,5);
VarPlot2 = WMA(VarPlot2,20);

//Plot(VarPlot1,"",colorBlue,styleThick);

// Plot Colored Line
Plot(VarPlot2,"",colorBlack,styleDots);
Graph0BarColor=IIf(VarPlot2>Ref(VarPlot2,-2),colorYellow,colorBlack);

VarPlot3 = VarPlot + VarHLSum + VarExtremeMove;
VarPlot3 = WMA(varPlot3,2);
//Plot(VarPlot3,"",colorWhite,styleLine);
VarPlot3 = Wilders(VarPlot3,2);

Plot(VarPlot3,"",colorRed,styleThick);

//Plot((VarPlot3+VarPlot1)/2,"",colorWhite,styleThick);

GraphXSpace=8;

Title = "MA Plurality";

VarLowExtreme = LLV(VarPlot3,20);
Plot(VarLowExtreme,"",colorDarkGreen,styleLine);

VarLowExtreme2 = LLV(VarPlot3,100);
Plot(VarLowExtreme2,"",colorDarkGreen,styleDots);

VarHighExtreme = HHV(VarPlot3,20);
Plot(VarHighExtreme,"",colorDarkRed,styleLine);

VarHighExtreme2 = HHV(VarPlot3,100);
Plot(VarHighExtreme2,"",colorDarkRed,styleDots);





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/