PureBytes Links
Trading Reference Links
|
Something I threw together this morning... seems to work well, though
haven't backtested it yet. It's similar to T3 in many ways, but built
differently. The plurality method of weighing different "situations"
is something I picked up from Tom DeMark.
If you improve upon it, please post your code. Too many variations to
play with for one person. 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 = 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),40,IIf(C<0.98*Ref(C,-1),-40,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,60);
Plot(VarPlot1,"",colorWhite,styleLine);
Plot(VarPlot2,"",colorRed,styleLine);
VarPlot3 = VarPlot + VarHLSum + VarExtremeMove;
VarPlot3 = Wilders(varPlot3,2);
VarPlot3 = Wilders(VarPlot3,3);
Plot(VarPlot3,"",colorYellow,styleLine);
GraphXSpace=8;
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/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/
|