Channel Indicator |
Post Reply |
Author | |
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options
Quote Reply
Topic: Channel Indicator Posted: 11 Feb 2009 at 2:53pm |
That's great Peter!
Good to see some active members on this site discussing some ideas and code.
I used a bit of that code myself in the Trend Pivot indicator. I created the visual
backtest to see how effective entries and exits were. Might as well post it here
so people can see if that strategy might suit them. They can freely cut and paste
my visual backtest code and adapt it to their own indicators etc. to see how
effective they are.
{ Trend Pivot } [Description ="Averaged Weekly 50% Pivot"]method := inputma("Method",E);tp:= Input("Period",6,2);sigs:= input("Signals 1=on 0=off",1,0,1);wp:= input("Weekly Pivot 1=on 0=off",0,0,1);[target =price]m:= Month()<>Ref(Month(),-1);p:= ValueWhen(1,DayOfWeek()=1 or m,ref(HHV(H,5)+LLV(L,5),-1)/2);[linestyle =solid; color=orchid]if (wp,p,undefined); {weekly pivot point 50%}[linestyle =solid; color=medium slate blue]pa:= ma(ref(HHV(H,tp)+LLV(L,tp),-1)/2,tp,method); {pivot averaged}pa; SignalLong := if(sigs AND C>=pa AND hist(C,1)>hist(pa,1) AND hist(C,2)<hist(pa,2),1,0);SignalShort := if(sigs AND C<pa AND hist(C,1)<hist(pa,1) AND hist(C,2)>=hist(pa,2),1,0);SigLong := if(SignalLong,1,if(SignalShort,0,prev));SigShort := if(SignalShort,1,if(SignalLong,0,prev));[linestyle =marker; marker=long; name=""]If (SigLong and SigLong <> hist(SigLong,1),1,0);[linestyle =marker; marker=short; name=""]If (SigShort and SigShort <> hist(SigShort,1),1,0);[linestyle =pricecolor][color =rgb(98,217,98)] {lime green}If (C>=pa,1,0);[color =rgb(226,118,118)] {red}If (C<pa,1,0);LE:= If(SigLong and SigLong <> hist(SigLong,1), C, prev); { LE price save }SE:= If(SigShort and SigShort <> hist(SigShort,1), C, prev); { SE price save }LEp:= If(SigLong and SigLong <> hist(SigLong,1), round(((SE-LE)/SE)*100,2), undefined);SEp:= If(SigShort and SigShort <> hist(SigShort,1), round(((SE-LE)/LE)*100,2), undefined);[color =Forest Green][linestyle =Text; textalign=Above,Center]If (LEp>=0, "+" + LEp + "%", undefined);High ;[color =Forest Green][linestyle =Text; textalign=Below,Center]If (SEp>0, "+" + SEp + "%", undefined);Low ;[color =Crimson][linestyle =Text; textalign=Below,Center]If (SEp<0, " " + SEp + "%", undefined);Low ;[color =Crimson][linestyle =Text; textalign=Above,Center]If (LEp<0, " " + LEp + "%", undefined);High ;Edited by maximo - 12 Feb 2009 at 4:53pm |
|
peter1
Regular Joined: 27 Aug 2008 Location: Sydney Posts: 56 |
Post Options Quote Reply Posted: 08 Feb 2009 at 1:21pm |
Thanks for replying Max.
I have found some Metastock code of Jose Silva's that has been a good starting point. Pivots - Monthly { Message allows color selection b4 plotting } message:=Input("Plot on daily charts",0,0,0); { Month' start } m:=Month()<>Ref(Month(),-1); { Month's OHLC } Om:=ValueWhen(2,m,O); Hm:=ValueWhen(1,m,HighestSince(2,m,H)); Hm:=ValueWhen(1,Hm>0,Hm); Lm:=ValueWhen(1,m,LowestSince(2,m,L)); Lm:=ValueWhen(1,Lm>0,Lm); Cm:=ValueWhen(1,m,Ref(C,-1)); { Pivot levels } p1:=(Hm+Lm+Cm)/3+Hm-Lm; p2:=(Hm+Lm+Cm)/3*2-Lm; p3:=(Hm+Lm+Cm)/3*2-Hm; p4:=(Hm+Lm+Cm)/3-Hm+Lm; { Plot on daily chart } p1;p2;p3;p4 |
|
peter1
Regular Joined: 27 Aug 2008 Location: Sydney Posts: 56 |
Post Options Quote Reply Posted: 06 Feb 2009 at 12:37pm |
I would like some help in coding an indicator that finds the highest, lowest and midpoint value in the previous calendar year and draws horizontal lines across the following calendar year price chart. This is just the beginning of a set of different timeframe indicators that I can use on any chart of a lower time frame than the indicator.
Does anyone have any ideas to get me started? [Hi Maximo, PM'd you] |
|
Post Reply |
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |