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

[amibroker] Moving Average Plurality indicator



PureBytes Links

Trading Reference Links

This is one I created that I've been tinkering with for some time... 
got any ideas to make it better? Send me an email...

Thanks!

~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 = 10; //Param("per1",10,1,100,1);
varPeriod2 = 50; //Param("per2",50,1,100,1);
varPeriod3 = 100; //Param("per3",100,1,500,5);
varPeriod4 = 200; //Param("per4",200,1,500,5);
varPeriod5 = 5; //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);

VC1 = Param("VC1",27,1,100,1);
VC2 = Param("VC2",10,1,10,1);
VC3 = Param("VC3",50,1,50,1);
VU1 = Param("VU1",9,1,50,1);
VU2 = Param("VU2",3,1,50,1);

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

varContract2 = IIf((varMA4-varMA2)<(Ref(varMA4,-1)-Ref(varMA2,-
1)),VC2,0);
varExpand2 = IIf((varMA4-varMA2)>(Ref(varMA4,-1)-Ref(varMA2,-1)),-
VC2,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)),VC3,0);
varExpand4 = IIf((varMA4-C)>(Ref(varMA4,-1)-Ref(C,-1)),-VC3,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,VU1,0);
varDowntrend3 = IIf(C<varMA2,-VU1,0);

varUptrend4 = IIf(C>varMA4,VU2,0);
varDowntrend4 = IIf(C<varMA4,-VU2,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 --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/