Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Miftha Advance Scan & Indicator for Amibroker (AFL)
You can use this AFL in two ways. 1. Market scan for buy and sell signals and 2. as an indicator.
Screenshots
Similar Indicators / Formulas
Indicator / Formula
_SECTION_BEGIN("SectorRSI scan"); /* SectorRSI swing system ** goldfreaz - 5 May 2002 */ //myobj = CreateObject("MyAFLObject.Class1"); PositionSize=4000; // Mean RSI Nrsi=14;//Optimize("Nrsi",11,14,19,1); rr=13;//Optimize("rr",15,12,15,1); ss=2;//Optimize("ss",3,2,3,1); Wfactor=1;//Optimize("Wf",0.8,0.8,1.3,0.1); slpTsiD=6;//Optimize("slpTsiD",6,5,8,1); MeanRSI = Foreign("~SUMRSI","O",1) / Foreign("~SUMRSI","V",1); rrsi=RSI(Nrsi); ROCmean=ROC(EMA(meanrsi,4),2); ROCrsi=ROC(EMA(rrsi,4),2); both=Wfactor*ROCmean+ROCrsi; Tsi=50 * ( EMA( EMA( both ,rr ) ,ss) / EMA( EMA( abs( both ),rr ), ss) ); TsiBase=MA(Tsi,slpTsiD); Nx=1.77;//Optimize("Nx",5,1.6,1.9,.05); CurveTsi=Tsi-1.5*Ref(Tsi,-1)+.5*Ref(Tsi,-3); //CurveTsi=myobj.Curvature( Tsi, 3, Nx ); //CurveTsi=myobj.ECurve( Tsi, Nx ); wait=8;//Optimize("Wait",8,6,9,1); profitfactor=2.6;//Optimize("Pf",2.6,2.3,2.8,0.1); Patr=11;//Optimize("Patr",8,8,11,1); LossFactor=2.4;//Optimize("LF",1.5,1.2,2.8,0.2); PatrL=11;//Optimize("PatrL",11,10,13,1); CurveTsiCrit=3;//Optimize("CtsiC",5,2.7,3.2,.1); TsiCrit=-25;//Optimize("TsiC",-25,-26,-23,1); Buy = CurveTsi>CurveTsiCrit AND TsiBase<TsiCrit; ExRemSpan(Buy,wait); target=ProfitFactor*ATR(Patr); Loss=LossFactor*ATR(PatrL); ApplyStop(1,2,target,1); ApplyStop(2,2,Loss,0); Sell=Ref(Buy,-wait); Filter=1; Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); AddToComposite( Equity(1,-1), "~CompoEquity", "X",7); Rt=RSI( 9 ); Rmean=IIf(Rt>=1 AND Rt<=99,Rt,0); AddToComposite(Rmean,"~SUMRSI","X",7); AddToComposite(1,"~SUMRSI","V",7); AddColumn(Buy,"Buy"); AddColumn(Buy+target,"target"); AddColumn(CurveTsi,"CTsi"); MaxGraph=3; Graph0=MeanRSI; Graph0Color=14; Graph0Style=1; Graph1=rrsi; Graph1Color=5; Graph1Style=1; Graph2=Tsi; Graph2Color=2; Graph2Style=9; _SECTION_END(); _SECTION_BEGIN("Scan New High and New Low"); /* Scan New High and New Low Scan OR exploration which can find any futures OR stock that has reached Break New High AND New Low : User choose on "Scan by Day/Week/Month" option. 1. User input if scan by Day 2. User input if scan by Week (Default) 3. User input if scan by Month Created by TohMZ on June 15th, 2008 based on Ernest request */ //--User Input YMWD = ParamList("Choose scan by", "Day|Week|Month", 1); Wk = Param("Week High", 52, 1, 52); Mth = Param("Month High", 12, 1, 12); Days = Param("Day High", 260, 1, 260); if (YMWD == "Week") { x = Wk; Days = 5*wk; } else if (YMWD == "Month") { x = Mth; Days = 20*Mth; } else { x = Days; } Buy = High > Ref(HHV(High,Days),-1); Sell = Low < Ref(LLV(Low,Days),-1); Filter = (Buy OR Sell); AddTextColumn(FullName(), "Security", 1.0, colorDefault, colorDefault,200); AddTextColumn( WriteIf(Buy, "HIGH", WriteIf(Sell, "LOW", "")), "Break "+x+" "+YMWD+" ", 1.0, colorDefault, colorDefault,100); _SECTION_END(); _SECTION_BEGIN("MACDPrediction"); /*An MACD, Signal Cross is, in general, a bullish Signal. Since it comes with a significant delay, it would be important to anticipate this Cross. Some days before the Cross, we often see an MACD turning point. It is interesting to investigate the related conditions AND use them before the end of the session. The following AFL code will give the necessary next ROC for a higher MACD value.*/ //The probable Cross between MACD AND its Signal, by D. Tsokakis, Feb2005 SetBarsRequired(10000,0); function EMAn ( Cnext , r3) { return ( 2 * Cnext + ( r3 - 1 ) * EMA ( C , r3 ) ) / ( r3 + 1 ) ; } function MACDn ( Cnext , r1 , r2 ) { return EMAn ( Cnext ,r1 ) - EMAn ( Cnext , r2 ) ; } r1 = Param( "Fast avg", 12, 2, 200, 1 ); r2 = Param( "Slow avg", 26, 2, 200, 1 ); r3 = Param( "Signal avg", 9, 2, 200, 1 ); det = 500 ; perc = 25/100 ; Clast = SelectedValue ( C ) ; Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1,r2), ParamColor("MACD color", colorRed ), ParamStyle("MACD style") ); Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorBlue ), ParamStyle("Signal style") ); Plot( ml-sl, "MACD Histogram", IIf(ml-sl > 0,colorBrightGreen,colorRed ), styleNoTitle | ParamStyle("Histogram style",styleHistogram | styleNoLabel, maskHistogram )); det = 500 ; perc = 25/100 ; Clast = SelectedValue ( C ) ; Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD color", colorRed ), ParamStyle("MACD style") ); Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorBlue ), ParamStyle("Signal style") ); Plot( ml-sl, "MACD Histogram", IIf(ml-sl > 0,colorBrightGreen,colorRed ), styleNoTitle | ParamStyle("Histogram style",styleHistogram | styleNoLabel, maskHistogram )); MACDlast = SelectedValue(MACD()); Buy= Cross(MACD(12,26),Signal(12,26,9)); Sell = Cross( Signal(12, 26, 9), MACD(12,26) ); PlotShapes(IIf(Buy,shapeUpArrow,shapeNone) ,colorBrightGreen); PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed); SIGNALlast = SelectedValue ( Signal ( ) ); Title = Name ( ) + ", " + Date ( ) + ", MACD=" + WriteVal ( MACDlast )+ ",Signal=" + WriteVal ( SignalLAST ) +"\nThe nextMACD will be higher if the next ROC will be > "; Cnextmin = ( 1 - perc ) * Clast ;Cnextmax = ( 1 + perc ) * Clast ; step = ( Cnextmax - Cnextmin ) / det ; nextROC1 = -100 * perc ; nextROC2 = -100 * perc ; for ( Cnext = Cnextmin ; Cnext <= Cnextmax ; Cnext = Cnext + step ) { X = MACDn ( Cnext , 12 , 26 ) ; Y = EMA ( X , 9 ) ; MACDnext = SelectedValue ( X ); SIGNALnext = SelectedValue ( Y ); NextROC = 100 * ( -1 + Cnext / Clast ) ; NextROC0 = 100 * ( -1 + Cnext / Clast ) ; if ( macdnext < SignalLAST ) { NextROC1 = NextROC ; } if ( MACDnext < MACDlast ) { nextROC2 = nextROC0; } } Title = Title + WriteIf ( NextRoc2 >= 0.1 , "+" , "" ) + WriteVal ( NextROC2 ,1.2 ) + "%" + "\nThe nextMACD will be above the lastSIGNAL if the next ROC will be > " + WriteIf ( NextRoc1 >= 0.1 , "+" , "" ) + WriteVal ( nextROC1 , 1.2)+"%" ; Plot ( 0 ,"", colorBlack ,styleDashed ) ; _SECTION_END(); Filter = C <25 AND C >2 AND C> Ref(C,-1)AND Volume > 100000;// AND NOT (IndustryID() == 34 OR IndustryID() ==36); Result = WriteIf(Buy,"Buy","Sell"); AddTextColumn( WriteIf(Buy,"Buy", "Sell" ) ,"TRADE",5,IIf(Buy,colorYellow, colorWhite), IIf(Buy, colorDarkGreen, colorDarkRed) ); AddTextColumn(IndustryID(1) ," Industry Sector ", 25.0, colorWhite, colorBlue); AddColumn( Close, "Close", 1.2, IIf( ROC(C, 1 ) >= 0, colorDarkGreen,colorRed ),50 ); AddColumn(Ref(Close,-1),"Y-Close",1.2, IIf( ROC(Ref(C,-1),1)>=0,colorDarkGreen, colorRed ),50 ); AddColumn( Volume, "Volume", 10.0, IIf( ROC(V, 1 ) >= 0,colorDarkGreen, colorRed ) ); AddColumn( ROC( Close, 1 ), "ROC(1)", 1.2, IIf( ROC(C, 1 ) >= 0,colorDarkGreen, colorRed)); AddColumn(NextROC1,"NextROC",1.2,colorYellow,colorRed ); AddColumn(NextROC2,"NextROCO",1.2,colorWhite, colorBrown); /*The principle of the code is simple : We suppose that the next ROC changes from -25% to +25% AND we calculate the necessary ROC for a higher MACD. Example1 : On Oct29 [point P1] AMZN would have a higher MACD if the next ROC would be more than +1.30%. The next Day, Nov1, AMZN closed at +2.80% AND the MACD was higher indeed. It was known [AND almost safe] before the end of the Nov1 session, that AMZN was gaining more than +1.30%. Example2 : On Jan4 [point P2] the ^NDX needed a +2.70% to change the MACD downtrend. The most probable was to see lower MACD values...*/ _SECTION_BEGIN("Hilbert Study SCAN"); /* Hilbert Study */ EnableScript("VBScript"); value1=((H+L)/2) - Ref(((H+L)/2),-6); value2= Ref(value1,-3); value3=0.75*(value1-Ref(value1,-6)) + 0.25*(Ref(value1,-2)-Ref(value1,-4)); <% value1 = AFL("Value1") value2 = AFL("Value2") value3 = AFL("Value3") Close = AFL("Close") inphase = Close quad = inphase Call Setup() function Setup() for i = 1 to Ubound(Close) inphase(i) = 0.33 * value2(i) + (0.67 * inphase(i-1) ) quad(i) = 0.20 * value3(i) + ( 0.8 * quad(i-1) ) next End function AFL.Var("inphase") = inphase AFL.Var("quad") = quad %> p1 = atan( abs(quad+Ref(quad,-1) ) / abs(inphase+Ref(inphase,-1) ) ) * 360 /3.1416; phase = IIf(inphase<0 AND quad>0, 180-p1, IIf(inphase<0 AND quad<0, 180+p1, IIf(inphase>0 AND quad<0, 360-p1,p1))); dp = IIf(Ref(phase,-1)<90 AND phase>270, 360+Ref(phase,-1)-phase,Ref(phase,-1)-phase); dp2 = IIf(dp < 1, 1, IIf(dp > 60, 60, dp)); Graph1 = dp2; HilbertCyclePeriod1a = dp2; value = dp2; HCycleCount1a= IIf(Sum(value,6)>=360 AND Sum(value,5)<360 ,6,0) + IIf(Sum(value,7)>=360 AND Sum(value,6)<360 ,7,0) + IIf(Sum(value,8)>=360 AND Sum(value,7)<360 ,8,0) + IIf(Sum(value,9)>=360 AND Sum(value,8)<360 ,9,0) + IIf(Sum(value,10)>=360 AND Sum(value,9)<360 ,10,0) + IIf(Sum(value,11)>=360 AND Sum(value,10)<360 ,11,0) + IIf(Sum(value,12)>=360 AND Sum(value,11)<360 ,12,0) + IIf(Sum(value,13)>=360 AND Sum(value,12)<360 ,13,0) + IIf(Sum(value,14)>=360 AND Sum(value,13)<360 ,14,0) + IIf(Sum(value,15)>=360 AND Sum(value,14)<360 ,15,0); HCycleCount2a = IIf(Sum(value,16)>=360 AND Sum(value,15)<360 ,16,0) + IIf(Sum(value,17)>=360 AND Sum(value,16)<360 ,17,0) + IIf(Sum(value,18)>=360 AND Sum(value,17)<360 ,18,0) + IIf(Sum(value,19)>=360 AND Sum(value,18)<360 ,19,0) + IIf(Sum(value,20)>=360 AND Sum(value,19)<360 ,20,0) + IIf(Sum(value,21)>=360 AND Sum(value,20)<360 ,21,0) + IIf(Sum(value,22)>=360 AND Sum(value,21)<360 ,22,0) + IIf(Sum(value,23)>=360 AND Sum(value,22)<360 ,23,0) + IIf(Sum(value,24)>=360 AND Sum(value,23)<360 ,24,0) + IIf(Sum(value,25)>=360 AND Sum(value,24)<360 ,25,0); HCyclecount3a = IIf(Sum(value,26)>=360 AND Sum(value,25)<360 ,26,0) + IIf(Sum(value,27)>=360 AND Sum(value,26)<360 ,27,0) + IIf(Sum(value,28)>=360 AND Sum(value,27)<360 ,28,0) + IIf(Sum(value,29)>=360 AND Sum(value,28)<360 ,29,0) + IIf(Sum(value,30)>=360 AND Sum(value,29)<360 ,30,0) + IIf(Sum(value,31)>=360 AND Sum(value,30)<360 ,31,0) + IIf(Sum(value,32)>=360 AND Sum(value,31)<360 ,32,0) + IIf(Sum(value,33)>=360 AND Sum(value,32)<360 ,33,0) + IIf(Sum(value,34)>=360 AND Sum(value,33)<360 ,34,0) + IIf(Sum(value,35)>=360 AND Sum(value,34)<360 ,35,0); c1= HCycleCount1a + HCycleCount2a + HCycleCount3a; /* graph0 = HCycleCount1a; graph1 = HCyclecount2a; Graph2 = HCyclecount3a; Graph0Style=Graph1Style=Graph2Style=5; */ <% c1 = AFL("c1") c2 = c1 c3 = c1 for i = 1 to Ubound(c1) if c1(i) = 0 then c2(i) = c2(i-1) else c2(i) = c1(i) c3(i) = 0.25*c2(i) + 0.75*c3(i-1) next AFL.Var("quad") = c1 %> GraphXSpace = 1; /* playing a little here with moving averages, the Hilbert curve using Amibroker seems a lot more jagged than the one produced using Metastock. I do not understand this difference but using a moving average produces a curve that is closer to Metastocks results than the one that I produced as an interpetation. */ fast = 2/(2+1); slow = 2/(30+1); dir=abs(Close-Ref(Close,-5)); vol=Sum(abs(Close-Ref(Close,-1)),5); ER=dir/vol; sc =( ER*(fast-slow)+slow)^2; Graph0 = c1; Graph1 = AMA( c1, sc ); Graph2 = EMA(c1,9); Graph0Style=Graph1Style=Graph2Style=4; /* Squelch here is used as 15 instead of 20 on the site */ Squelch = 15; var1 = Graph2; Buy = IIf(var1 < Squelch , 0 , 1); Sell = IIf( var1 < Squelch , 1, 0 ); Buy = ExRem(Buy,Sell); Sell = ExRem(Sell,Buy); /* Exploration code */ /* filter is setup so that you can test any particular date and see the followup performance. Just make sure that that date is at least 3 * first days in the past from the current date, otherwise the future references will produce the wrong information or no information useful */ Filter = Buy==1; first=1; /* First is the number of days for each ROC interval for reviewing performance */ NumColumns = 7; Column0 = C; Column0Format = 1.2; Column0Name = "Close"; Column1 = Ref(C, 1+first); Column1Name = "Close+i "; Column1Format = 1.2; Column2 = Ref(C,1+first*2); Column2Name = "Close+i*2 "; Column2Format = 1.2; Column3 = Ref(C,1+first*3); Column3Name = "Close+i*3 "; Column3Format = 1.2; Column4= Ref(C,first*1+1) - C; Column4Name="ROC+i"; Column4Format = 1.2; Column5= Ref(C,first*2+1) - C; Column5Name="ROC+2i"; Column5Format = 1.2; Column6= Ref(C,first*3+1) - C; Column6Name="ROC+3i"; Column6Format = 1.2; /* End of Exploration Code. */ _SECTION_END(); _SECTION_BEGIN("guru commentay 2"); /* Project: AmiBroker ** File: Dinapoli.afl ** Title: Dinapoli Guru Commentary (Trading with DiNapoli Levels,chapter 5) ** Date: Dec 8th, 2003 ** Written by: Grayesso (grayesso dog rambler dot ru) */ /* MACD (fa,sa,sig) , where: fa - fast avg., sa - slow avg., sig - signal (it is necessary to install in preferences [Preferences - Indicators]) */ fa = Prefs( 11 ); sa = Prefs( 12 ); sig = Prefs( 13 ); /* Stochastic (range, Ksmooth, Dsmooth) range - to install in preferences [Preferences - Indicators]*/ range = Prefs(14); /* Attention!!! Ksmooth and Dsmooth - to install here and now, in preferences uselessly to change */ Ksmooth=3; Dsmooth=3; Buy=Cross(StochK (range,Ksmooth), StochD(range,Ksmooth,Dsmooth)) AND (MACD(fa,sa)>Signal(fa,sa,sig)) OR Cross(MACD(fa,sa),Signal(fa,sa,sig)) ; Sell = Cross(StochD(range,Ksmooth,Dsmooth), StochK(range,Ksmooth)) AND (MACD(fa,sa)< Signal (fa,sa,sig)) OR Cross(Signal(fa,sa,sig),MACD(fa,sa)); "\n Review of " + FullName() + " (" + Name() + ")" + "\n as of " + Date(); "\n MACD: (" + Prefs(11)+","+Prefs(12)+","+Prefs(13)+")"; " Stochastic: (" + Prefs(14)+","+Ksmooth+","+Dsmooth+")"; "\n Current Statistics :\n"; " Close: " + WriteVal(Close); " Change: " + WriteVal(Close - Ref( Close, -1 ) ) ; "\n MACD Value: " + WriteVal(MACD(fa,sa)); " Signal Line: " + WriteVal(Signal(fa,sa,sig)); "\n Stochastic %K "+WriteVal (StochK(range,Ksmooth)); " Stochastic %D "+WriteVal (StochD(range,Ksmooth, Dsmooth )); _SECTION_END(); _SECTION_BEGIN("Gann Five Day"); /* Elliott Oscillator Indicator*/ var0=MA(Avg,5)-MA(Avg,34); Graph0=var0; Graph0Style=6; Graph1=0; Graph1Color=5; Fivelow= ( Ref(L,-3)<Ref(L,-4) AND Ref(L,-4)<Ref(L,-5) AND Ref(L,-2)<Ref(L,-3))AND (Ref(L,-1)<Ref(L,-2)) AND (L<Ref(L,-1)); var1= ((MA(var0,5)>0 AND MA(C,3)<MA(C,10)) AND LinRegSlope(C, 38)>.25) AND (Fivelow OR (Ref(C,-2)==Inside() AND Ref(L,-1)<Ref(L,-2)AND L<Ref(L,-1)) OR (Ref(L,-3)<Ref(L,-4)AND Ref(C,-1)==Inside()AND L<Ref(L,-1)) OR (Ref(L,-2)<Ref(L,-3))AND (Ref(L,-1)<Ref(L,-2)AND Inside())); Buy=var1; Sell=0; Filter=Buy; Filter= (Buy==1) ; NumColumns = 7; Column0 =Ref(C+0.065,-1); Column0Format = 1.2; Column0Name = "Trigger Price"; Column1 = C; Column1Name = "Close "; Column1Format = 1.2; Column2 = MA(V,17); Column2Name = "17 Ma Vol "; Column2Format = 1.0; Column3 = MA(C,17)/MA(C,50); Column3Name = "% 17/50 "; Column3Format = 1.2; Column3Format = 1.2; Column4= MA(C,17); Column4Name="17 C ma"; Column4Format = 1.2; Column4= MA(C,50); Column4Name="50 C ma"; Column4Format = 1.2; Column5=var0; Column5Name="Elliott Ocs"; Column5Format=1.2; Column6=LinRegSlope(var0,5); Column6Name="LRS Elliott"; Column6Format=1.2; /* End of Exploration Code. */ _SECTION_END(); _SECTION_BEGIN("Ema scan"); /* EMA offset bands ver 1_2 I'd guess this is NOT much different to bbands except you can contol the per % offset and the periods ema to off set*/ per=.10;//Percent placement periods=20;//time periods /*********************************/ emaverage= EMA(C,periods); bandsAdjust=emaverage*per; upperband=emaverage+bandsAdjust; Lowerband=emaverage-bandsAdjust; Plot(EMA(C,periods),"ema",5,1); Plot(C,"EMA",15,64);// plots the close with candles Plot(upperband,"upperband",3,1);// upperband Plot(Lowerband,"lowerband",4,1);//lowerband bCond1=Ref(Cross(C,Lowerband),-1) AND C > lowerband ; bCond2= C > EMAverage ;// the "or" gets me into up trends bCond3= C > EMA(C,65);// trend Buy = bcond1 AND bCond3 OR bCond2; scond1= Ref( Cross(emaverage,C),-1)AND C < emaverage;// close days under ema scond2=C < Lowerband;//failed trade drops below lowerband Sell = scond1 OR scond2; Buy = ExRem( Buy, Sell );// removes buy/sell arrows Sell = ExRem( Sell, Buy ); _SECTION_END(); _SECTION_BEGIN("DSE scan"); NumColumns =12; /*Closing Price Reversals Automatic Analysis by Larry Lovrencic*/ CPRbuy=O<(L+0.2*(H-L)) AND C>(H-0.2*(H-L)) AND H<Ref(H,-1) AND L<Ref(L,-1) AND C>Ref(C,-1); CPRsell=O>(L+0.8*(H-L)) AND C<(H-0.8*(H-L)) AND H>Ref(H,-1) AND L>Ref(L,-1) AND C<Ref(C,-1); Column0 = CPRbuy; Column0Name = "Closing Price Reversal BUY"; Column1= CPRsell; Column1Name= "Closing Price Reversal SELL"; /*Hook Reversals Automatic Analysis by Larry Lovrencic*/ HRbuy=O<(L+0.2*(H-L)) AND C>(H-0.2*(H-L)) AND H<Ref(H,-1) AND L>Ref(L,-1); HRsell=O>(L+0.8*(H-L)) AND C<(H-0.8*(H-L)) AND H<Ref(H,-1) AND L>Ref(L,-1); Column2 = HRbuy; Column2Name = "Hook Reversal BUY"; Column3= HRsell; Column3Name= "Hook Reversal SELL"; /*Island Reversals Automatic Analysis by Larry Lovrencic*/ IRbuy=Ref(L,-2)>Ref(H,-1) AND L>Ref(H,-1); IRsell=Ref(H,-2)<Ref(L,-1) AND H<Ref(L,-1); Column4 = IRbuy; Column4Name = "Island Reversal BUY"; Column5= IRsell; Column5Name= "Island Reversal SELL"; /*Key Reversals Automatic Analysis by Larry Lovrencic*/ KRbuy=O<Ref(C,-1) AND L<Ref(L,-1) AND C>Ref(H,-1); KRsell=O>Ref(C,-1) AND H>Ref(H,-1) AND C<Ref(L,-1); Column6 = KRbuy; Column6Name = "Key Reversal BUY"; Column7= KRsell; Column7Name= "Key Reversal SELL"; /*Open/Close Reversals Automatic Analysis by Larry Lovrencic*/ OCRbuy=O<(L+0.2*(H-L)) AND C>(H-0.2*(H-L)) AND H<Ref(H,-1) AND L<Ref(L,-1) AND C<Ref(C,-1); OCRsell=O>(L+0.8*(H-L)) AND C<(H-0.8*(H-L)) AND H>Ref(H,-1) AND L>Ref(L,-1) AND C>Ref(C,-1); Column8 = OCRbuy; Column8Name = "Open Close Reversal BUY"; Column9= OCRsell; Column9Name= "Open Close Reversal SELL"; /*Pivot Point Reversals Automatic Analysis by Larry Lovrencic*/ PPRbuy=Ref(L,-1)<Ref(L,-2) AND Ref(L,-1)<L AND C>Ref(H,-1); PPRsell=Ref(H,-1)>Ref(H,-2) AND Ref(H,-1)>H AND C<Ref(L,-1); Column10 = PPRbuy; Column10Name = "Pivot Point Reversal BUY"; Column11= PPRsell; Column11Name= "Pivot Point Reversal SELL"; Buy=CPRbuy OR HRbuy OR IRbuy OR KRbuy OR OCRbuy OR PPRbuy; Sell=CPRsell OR HRsell OR IRsell OR KRsell OR OCRsell OR PPRsell; Filter= CPRbuy OR CPRsell OR HRbuy OR HRsell OR IRbuy OR IRsell OR KRbuy OR KRsell OR OCRbuy OR OCRsell OR PPRbuy OR PPRsell; _SECTION_END(); _SECTION_BEGIN("Divergences scan"); MaxGraph=5; /*BULLISH STOCHASTIC DIVERGENCE, DD==30*/ ST33=StochD(); TR1=LLVBars(ST33,4); TR2=IIf(ST33<30 AND TR1>0 AND Ref(TR1,-1)==0,Ref(ST33,-1),0); TRC=IIf(TR2>0,C,0); vs=ValueWhen(tr2, Ref(st33,-1), 1); dvs=vs-Ref(vs,-1); vc=ValueWhen(trc, LLV(C,3), 1); dvc=vc-Ref(vc,-1); diver=IIf(dvs>0 AND dvc<0,30,0); DAS=BarsSince(Ref(TR2,-1)>0); DD=IIf(DAS<20 AND C>=Ref(C,-1),DIVER,0); Graph0=DD; Graph0BarColor=4; STBULL=DD==30; /*BULLISH RELATIVE SLOPE DIVERGENCE, DDDR==20*/ D1=10; KUP=EMA((H+L+C)/3,D1)+EMA(H-L,D1); KDOWN=EMA((H+L+C)/3,D1)-EMA(H-L,D1); K=EMA((H+L+C)/3,D1); S1=2*(K-Ref(K,-1))/(K+Ref(K,-1)); T33=10+100*EMA(S1,3); R1=LLVBars(T33,4); R2=IIf(T33<9 AND R1>0 AND Ref(R1,-1)==0,Ref(T33,-1),0); RC=IIf(R2>0,C,0); vsR=ValueWhen(r2, Ref(t33,-1), 1); dvsR=vsR-Ref(vsR,-1); vcR=ValueWhen(rc, LLV(C,3), 1); dvcR=vcR-Ref(vcR,-1); diverR=IIf(dvsR>0 AND dvcR<0,20,0); DASR=BarsSince(Ref(R2,-1)>0); dddR=IIf(DASR<20 ,DIVERR,0); Graph1=DDDR; Graph1BarColor=7; RSBULL=DDDR==20; /*BEARISH STOCHASTIC DIVERGENCE, BDDD==90*/ BTR1=HHVBars(ST33,4); BTR2=IIf(ST33>70 AND BTR1>0 AND Ref(BTR1,-1)==0,Ref(ST33,-1),0); BTRC=IIf(BTR2>0,C,0); Bvs=ValueWhen(Btr2, Ref(st33,-1), 1); Bdvs=Bvs-Ref(Bvs,-1); Bvc=ValueWhen(Btrc, HHV(H,3), 1); Bdvc=Bvc-Ref(Bvc,-1); Bdiver=IIf(Bdvs<0 AND Bdvc>0,90,0); BDAS=BarsSince(Ref(BTR2,-1)>0); Bddd=IIf(BDAS<20 AND C<=Ref(C,-1),BDIVER,0); Graph2=BDDD; Graph2BarColor=4; STBEAR=BDDD==90; /*BEARISH RELATIVE SLOPE DIVERGENCE, EDDDR==80*/ ER1=HHVBars(T33,4); ER2=IIf(T33>11 AND ER1>0 AND Ref(ER1,-1)==0,Ref(T33,-1),0); ERC=IIf(ER2>0,C,0); EvsR=ValueWhen(Er2, Ref(t33,-1), 1); EdvsR=EvsR-Ref(EvsR,-1); EvcR=ValueWhen(Erc, HHV(H,3), 1); EdvcR=EvcR-Ref(EvcR,-1); EdiverR=IIf(EdvsR<0 AND EdvcR>0,80,0); EDASR=BarsSince(Ref(ER2,-1)>0); EdddR=IIf(EDASR<20,EDIVERR,0); Graph3=EDDDR; Graph3Style=2; Graph3BarColor=7; Graph4=45; Graph4Style=8; RSBEAR=EDDDR==80; Filter= STBULL OR STBEAR OR RSBULL OR RSBEAR; NumColumns=4; Column0=RSBEAR; Column0Name="RS BEAR"; Column1=STBEAR; Column1Name="ST BEAR"; Column2=RSBULL; Column2Name="RS BULL"; Column3= STBULL; Column3Name="ST BULL"; Column0Format=1.0;Column1Format=1.0; Column2Format=1.0;Column3Format=1.0; Cover=RSBULL; Buy=STBULL; Short=RSBEAR; Sell=STBEAR; /*The only purpose of BUY, SELL, SHORT and COVER is to see the indicating arrows and are not suggestions to take some action. */ _SECTION_END(); _SECTION_BEGIN("Demand Index"); /* Demand Index */ /* Steve Wiser at slwiserr@erols.com */ /* Exploration, System and indicator */ GraphMax=9; A=(H+L+2*C); B=EMA((HHV(H,2)-LLV(L,2)),19); BuyP= /*{BuyPower}*/ V/EMA(V,19) * ((A>=Ref(A,-1)) +(A<Ref(A,-1)) / exp((0.375 * (A+Ref(A,-1)) /B ) *(Ref(A,-1)-A) / A)); SellP = /*{SellPressure}*/ V/EMA(V,19) * ((A<=Ref(A,-1)) + (A>Ref(A,-1)) / exp((0.375 * (A+Ref(A,-1)) / B ) * (A-Ref(A,-1)) / Ref(A,-1))); mabp=EMA(BuyP,19); masp=EMA(SellP,19); /*{smooth Selling Pressure}*/ divsor=IIf(mabp>masp,mabp,masp); /*{BP:SP ratio}*/ divend=IIf(mabp<masp,mabp,masp); /*{biggest=divisor}*/ var2=1-(divend/divsor); /*{adjust ratio to plot in}*/ var3=IIf( (masp>mabp) , -var2 , var2 ) ; /*{range -100 to 100}*/ var4=var3*100; Graph1 = var4; Graph1Style=5; var5=MA(var4,30); Graph2=var5;; Graph2Style=5; Graph2Color=6; /* Zero Line */ Graph0=0; Buy=Cross(var4,var5); /* originally var5 was a zero */ Sell=Cross(0,var4); Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); Short=Sell; Cover=Buy; Filter= (Buy == 1 OR Sell == 1) ; NumColumns = 7; Column0 = IIf(Buy == 1, 1, IIf(Sell == 1, -1, 0 ) ); Column0Format = 1.0; Column0Name = "B/S"; Column1 = C; Column1Name = "Close "; Column1Format = 1.2; Column2 = MA(V,17); Column2Name = "17 Ma Vol "; Column2Format = 1.0; Column3 = MA(C,17)/MA(C,50); Column3Name = "% 17/50 "; Column3Format = 1.2; Column3Format = 1.2; Column4= MA(C,17); Column4Name="17 C ma"; Column4Format = 1.2; Column4= MA(C,50); Column4Name="50 C ma"; Column4Format = 1.2; Column5=ROC(var4,2); Column5Name="ROC DI"; Column5Format=1.2; Column6=Cum(1); Column6Name = "#Bars"; Column6Format = 1.0; /* End of Exploration Code. */ _SECTION_END(); /* Coppock Trade Signal v1.1 (01/28/09) The Coppock formula was introduced in Barron's in 1962, devised by a San Antonio, TX-based technician, economist and investment advisor named Edwin Sedgwick Coppock. Since then, the Coppock oscillator has been adopted and adapted by technicians around the world. The Coppock curve is a long-term price momentum indicator used primarily to recognize major bottoms in the stock market. It is calculated as a 10-month weighted moving average of the sum of the 14-month rate of change and the 11-month rate of change for the index. A buy signal is formed when there is an upturn in the curve after an extreme low in the curve. A sell signal is formed when there is a higher peak in stock prices but a lower peak in the Coppock curve. These are the basic signals, more signals and interpretations are seen at more advanced levels. AFL Author: rcef88 goriamtrader[at]yahoo.com EliteVest, Public Mutual Bhd */ _SECTION_BEGIN("Coppock Trade Signal v1.1"); //PARAMETERS: ROC1Periods =Param("ROC1 periods",14,2,200,1,0); ROC2Periods =Param("ROC2 periods",11,2,200,1,0); WMAPeriods =Param("WMA periods",10,2,200,1,0); CoppockCurve =ParamToggle("Use Coppock curve","No|Yes",0); CoppockBar =ParamToggle("Use Coppock bar","No|Yes",1); ColBull =ParamColor("Bull color",colorBlue); ColBear =ParamColor("Bear color",colorRed); UseTradeSignal =ParamToggle("Use trade signal","No|Yes",1); CoppockFilter =Param("Coppock filter",20,2,200,1,0); ColBuy =ParamColor("Buy color",colorBrightGreen); ColSell =ParamColor("Sell color",colorDarkRed); ColBg =ParamToggle("Show background color","No|Yes",1); //MAIN: Coppock=WMA((ROC(C,ROC1Periods)+ROC(C,ROC2Periods)),WMAPeriods); InitialCalculationLength=Max(ROC1Periods,ROC2Periods)+WMAPeriods; for(i=0;i<BarCount;i++) { if(i<InitialCalculationLength) //initial zero { Coppock[i]=0.0; if(UseTradeSignal){Buy=0; Sell=0;} } } LastCoppock1=Ref(Coppock,-1); LastCoppock2=Ref(Coppock,-2); TradeStatus=IIf(Coppock>0,IIf(Coppock>LastCoppock1,ColBull,IIf(Coppock<LastCoppock1,ColBear,IIf(Coppock==LastCoppock1 && LastCoppock1>LastCoppock2,ColBull,ColBear))), IIf(Coppock>LastCoppock1,ColBull,IIf(Coppock<LastCoppock1,ColBear,IIf(Coppock==LastCoppock1 && LastCoppock1>LastCoppock2,ColBull,ColBear)))); StyleTitle=IIf(CoppockCurve && CoppockBar,styleNoTitle,0); StyleLabel=IIf(CoppockCurve && CoppockBar,styleNoLabel,0); if(CoppockCurve) Plot(Coppock,"Coppock"+_PARAM_VALUES(),TradeStatus,styleLine|styleThick|StyleTitle|StyleLabel); if(CoppockBar) Plot(Coppock,"Coppock"+_PARAM_VALUES(),TradeStatus,styleHistogram|styleThick); if(UseTradeSignal) { CoppockIsBuy=TradeStatus==ColBull; CoppockIsSell=TradeStatus==ColBear; CoppockBuyValue=ValueWhen(CoppockIsBuy,Coppock,1); CoppockSellValue=ValueWhen(CoppockIsSell,Coppock,1); Buy=!Ref(CoppockIsBuy,-1) && Coppock<0 && CoppockIsBuy && abs(CoppockBuyValue)>=CoppockFilter; Sell=!Ref(CoppockIsSell,-1) && Coppock>0 && CoppockIsSell && abs(CoppockSellValue)>=CoppockFilter; PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),ColBuy,0,Coppock,0); PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),ColSell,0,Coppock,0); } if(ColBg) SetChartBkGradientFill(ParamColor("BgTop",colorBlack),ParamColor("BgBottom",colorBlack)); _SECTION_END(); _SECTION_BEGIN("10% percent scan"); EnableScript("VBScript"); hh = HHV( Close, 250 ); // buy when prices reaches a new high Buy = Close == HHV( Close, 250 ); // ensure that sell is an array, // sell = 0 would set the type to number Sell = Buy; <% Close = AFL("close") Buy = AFL( "buy" ) Sell = AFL("sell") ' this variable holds last buying price ' if it is zero it means that no trade is Open lastbuyprice = 0 ' iterate along the array for i = 0 to UBound( Close ) Sell( i ) = 0 ' Remove Buy signals if trade was already initiated if( lastbuyprice > 0 ) then Buy( i ) = 0 end if ' if there is no Open trade AND Buy Signal occurs ' get the buying price if ( lastbuyprice = 0 ) AND (Buy( i ) = 1) then lastbuyprice = Close( i ) end if ' if trade is Open AND Sell condition is valid ' generate Sell Signal ' AND Close the trade if (lastbuyprice >0 ) AND ( Close( i ) > ( 1.1 * lastbuyprice ) ) then Sell( i ) = 1 lastbuyprice = 0 end if next AFL("buy") = Buy AFL("sell") = Sell %> Buy = Buy; _SECTION_END(); _SECTION_BEGIN("@buy and sell scan1"); /*ADX system goldfreaz - 18 April 2002 Buy: slope ADX > slope ADX threshold and ADX > ADX threshold + ADX histeresis and PDI > ADX + DI histeresis and slope PDI - slope MDI > slope DI threshold and PDI > ADX Sell: {ADX > ADX threshold - ADX histeresis and PDI < ADX - DI histeresis} or MDI > PDI + DI histeresis with optimization */ // ADX and PDI/MDI have different smoothing constants // smoothing defined as a exponential daily average, not Wilder's nonsense Aperiod=11; Bperiod=13; ADXthreshold=18; dadxthr=0.5; slpadxD=18; slpadxthr=0.35; dPM=3.5; slppmD=3; slpPMthr=-0.65; //Aperiod=Optimize("Aperiod",13,11,15,1); //Bperiod=Optimize("Bperiod",14,13,17,1); //ADXthreshold=Optimize("ADXthreshold",17,16,18,0.25); //dadxthr=Optimize("dADXthr",0.25,0,1.5,0.25); //slpadxD=Optimize("slpadxD",12,18,22,1); //slpadxthr=Optimize("slpadxthr",0.35,0.2,0.5,0.05); //dPM=Optimize("dPM",1,3.5,4,0.2); //slppmD=Optimize("slppmD",3,2,4,1); //slpPMthr=Optimize("slpPMthr",-0.65,-1,-0.5,0.05); Ppdi=PDI(Bperiod); Mmdi=MDI(Bperiod); dx=100*abs(Ppdi-Mmdi)/(Ppdi+Mmdi); Aadx=EMA(dx,Aperiod); slpadx=(Aadx-Ref(MA(Aadx,slpadxD),-1))/slpadxD; slpPM=(Ppdi-Ref(EMA(Ppdi,slppmD),-1)-Mmdi+Ref(EMA(Mmdi,slppmD),-1))/slppmD; Buy =slpadx>slpadxthr AND Aadx>ADXthreshold+dadxthr AND Ppdi>Mmdi+dPM AND slpPM>slpPMthr AND Ppdi>Aadx; Sell=(Aadx>ADXthreshold-dadxthr AND Ppdi<Aadx-dPM) OR Mmdi>Ppdi+dPM; Filter=Buy OR Sell; Sell=ExRem(Sell,Buy); Buy=ExRem(Buy,Sell); AddColumn(Buy,"Buy"); AddColumn(Sell,"sell"); AddColumn(Aadx,"Aadx"); AddColumn(slpPM,"slpPM"); AddColumn(BuyPrice,"BuyPrice"); AddColumn(SellPrice,"SellPrice"); _SECTION_END();
9 comments
Leave Comment
Please login here to leave a comment.
Back
nice afl.thanks a lot
Thanks a lot
But can you tell how to use it as scan because if start to scan it will not continue
my email
hbozaid@gmail.com
The administrator is too liberal in giving this indicator free. Awesome indicator, the price reversals are almost always shown perfect. Though the buy and sell arrows are helping out, I use the indicator for better judgement. Look at the indicator line taking higher lows before the actual price reversal. This behaviour is seen at every price reversal…. truly awesome.
Hi Everybody, Anyone know What does the term “~SUMRSI” means?
It in this code: MeanRSI = Foreign(“~SUMRSI”,“O”,1) / Foreign(“~SUMRSI”,“V”,1);
Thank in advance!
It’s a composite symbol.
Thank Admin for your information, but when I debug, the MeanRSI is Null and nothing appears on the chart (as I know it is graph0).
Could you tell me how to fix it?
I studied some information about composite symbol, but this concept is not much document and not clearly about SUMRSI symbol. Could you explain more detail about it? thank you so much.
It looks like you need to run the formula as an exploration first to build the composite before your apply it.
Thank admin. It worked as follow your guidance when I separated RSISector Scan Section from the original code.
Hi I had a problem with RSISector Scan Section. the MeanRSI and Tsi is Empty and not display on chart. Can you help me to fix it?