Cycle indicator {double smoothed stochastic 10 period} {denominators defined to eliminate divide by zero errors} Period:= 10; denom1:= If(HHV(H,Period)-LLV(L,Period)>0, HHV(H,Period)-LLV(L,Period), 1); P1:= Mov(((C-LLV(L,Period))/ denom1)*100,3,E); denom2 := If(HHV(P1,Period)-LLV(P1,Period)>0, HHV(P1,Period)-LLV(P1,Period), 1); Mov(((P1-LLV(P1,Period))/denom2)*100,3,E) from Bill Irwin DOUBLE STOCHASTICS EXPERT Basically, what I am trying to program the Expert to do is: ==BUY== IF THE CURRENT VALUE OF THE DBLSTOCH IS LESS THAN 40 AND GREATER THAN THE PREVIOUS DAYS VALUE THEN PAINT ONLY THIS BAR AS A BUY. (i.e.. the dblstoch is below 40 and has just turned up.) ==SELL== IF THE CURRENT VALUE OF THE DBLSTOCH IS MORE THAN 70 AND LESS THAN THE PREVIOUS DAYS VALUE THEN PAINT ONLY THIS BAR AS A SELL. (i.e.. the dblstoch is above 70 and has just turned down.) ======== Buy Highlight: P1:=Mov(((C-LLV(L,10))/(HHV(H,10)-LLV(L,10)))*100,3,E); dblSto10:= Mov(((P1-LLV(P1,10))/(HHV(P1,10)-LLV(P1,10)))*100,3,E); buy:=dblSto10<40 AND dblSto10>Ref(dblSto10,-1) AND Ref(dblSto10,-1)<Ref(dblSto10,-2); buy ======== Sell Highlight: P1:=Mov(((C-LLV(L,10))/(HHV(H,10)-LLV(L,10)))*100,3,E); dblSto10:= Mov(((P1-LLV(P1,10))/(HHV(P1,10)-LLV(P1,10)))*100,3,E); sell:=dblSto10>70 AND dblSto10<Ref(dblSto10,-1) AND Ref(dblSto10,-1)>Ref(dblSto10,-2); sell ========= from iamken PIVOT PRICE INDICTOR {The calculation for the new day are calculated from the High (H), low (L) and close (C) of the previous day.} {P = Pivot Price} (H + L + C)/3; {R1 = 1st Resistance} (2*((H + L + C)/3))-L; {S1 = 1st Support} (2*((H + L + C)/3))-H; {R2 = 2nd Resistance } (((H + L + C)/3)-((2*((H + L + C)/3))-H))+((2*((H + L + C)/3))-L); {S2 = 2nd Support} ((H + L + C)/3)-(((2*((H + L + C)/3))-L)-((2*((H + L + C)/3))-H)) Lonnie Lepp TEST OF INDICATORS BASED ON OTHER INDICATORS Now, you can create an Exploration with INDICATOR4 as one
of the columns and quickly see the equity performance across your
portfolio of stocks. Then, you can change "Length:=17;" to 18 or 20
in INDICATOR1, and run the exploration again to get the results for
that value. You can repeat this for as many values as you like. (I
copy the exploration results into Excel to do my summary
statistics). ShortTime := 25; MediumTime := 75; LongTime := 200; ShortMA := Mov(CLOSE, ShortTime, S); MediumMA := Mov(CLOSE, MediumTime, S); LongMA := Mov(CLOSE, LongTime, S); ShortMA; MediumMA; LongMA; Next is _Triple MA Crossovers: Sma := FmlVar("_Triple MA","ShortMA"); Mma := FmlVar("_Triple MA","MediumMA"); Lma := FmlVar("_Triple MA","LongMA"); LongSignal := Cross(Sma, Mma) AND Lma > Mma; ShortSignal := Cross(Mma, Sma) AND Lma < Mma; Then comes _Triple MA Positions: BuyLong := FmlVar("_Triple MA Crossovers", "LongSignal"); SellShort := FmlVar("_Triple MA Crossovers", "ShortSignal"); If( BarsSince(Ref(BuyLong,-1)) <= BarsSince(Ref(SellShort,-1)), +1, If( BarsSince(Ref(SellShort,-1)) <= BarsSince(Ref(BuyLong,-1)), -1,0) ); And lastly, _Triple MA Equity: Cum( If(Fml("_Triple MA Crossovers")=1, OPEN-Ref(OPEN,-1), If(Fml("_Triple MA Crossovers")=-1, -1*OPEN-Ref(OPEN,-1),0 ) ) ) I've plotted the _Triple MA and set the 3 colours and saved that as a template. Plotting the Positions indicator produces a horizontal line at 1 when I'm long, -1 when short and zero when out. That's as I think it should be. The Equity indicator, when applied to the price bars, produces a stepping pattern that's horizontal until it steps vertically up or down to another location, then horizontal again. This doesn't seem right to me. The Exploration: ColA: FmlVar("_Triple MA","ShortMA") ColB: FmlVar("_Triple MA","MediumMA") ColC: FmlVar("_Triple MA","LongMA") ColD: ((HHV(C,250)-LLV(C,250))/LLV(C,250))*100 ColE: Fml("_Triple MA Equity") Filter: colD > 100 AND colD < 300 AND CLOSE > 5.00 Running this Exploration on the TSE produces a report where ColE ranges from -1331.80 to 17.95. Does this mean that, using this Triple MA indicator, and buying/selling when the crossovers hit, the best stock earned $17.95 over the history (5 years) and the worst stock lost $1,331.80? from Bill Irwin |