logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Derek Worswick  
#1 Posted : Saturday, February 12, 2022 2:05:24 PM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 104

Hi Metastock

Would you plesae check the code below and correct if necssary

Hoping you can oblige

Best regards

Derek

Code:
{ Extreme Channel Shifted Version }
Daysback:= Input("Period for Liner Regression Line", 20,720,283);
shift:= Input("Look back period",0,600,0); 

x:= Cum(1); lastx:= LastValue( x ) - shift;   aa:=LastValue(Ref(LinearReg(C,Daysback),-Shift)-Ref(LinRegSlope(C,Daysback),-Shift)*Daysback); bb:= LastValue( Ref(LinRegSlope( C, Daysback ), -shift) ); 

y:= aa+bb*(x-(Lastx - DaysBack +1 ) );           LRLine:= ValueWhen(1,( x > (lastx-Daysback) AND (Cum(1)-1) < Lastx), y); restrictedLine:=Ref(Ref(LRline,-shift),shift)*ValueWhen(1,(shift+daysback),1); restrictedLine;       SD:=Input("Standard Error" ,1,6,2.618);

width:= LastValue( Ref(SD*STE(P, Daysback),-shift));

SDL:= If( x > (lastx - Daysback) AND (Cum(1)-1) < Lastx, y-width , 0) ;

SDU:= ValueWhen(1,( x > (lastx - Daysback) AND (Cum(1)-1) < Lastx) , y+width ); restrictedU:=Ref(Ref(SDU,-shift),shift)*ValueWhen(1,(shift+daysback),1); restrictedU;

SDL:= ValueWhen(1,( x > (lastx - Daysback) AND (Cum(1)-1) < Lastx), y-width ); restrictedL:=Ref(Ref(SDL,-shift),shift)*ValueWhen(1,(shift+daysback),1); restrictedL; 

{ ===== Standard Error" , 1.618  ====== }

SD:=Input("Standard Error" ,1,3, 1.618);

width:= LastValue( Ref(SD*STE(P, Daysback),-shift));

SDL:= If( x > (lastx - Daysback) AND (Cum(1)-1) < Lastx, y-width , 0) ;

SDU:= ValueWhen(1,( x > (lastx - Daysback) AND (Cum(1)-1) < Lastx) , y+width ); restrictedU:=Ref(Ref(SDU,-shift),shift)*ValueWhen(1,(shift+daysback),1); restrictedU;

SDL:= ValueWhen(1,( x > (lastx - Daysback) AND (Cum(1)-1) < Lastx), y-width ); restrictedL:=Ref(Ref(SDL,-shift),shift)*ValueWhen(1,(shift+daysback),1); restrictedL; 

{ ===== Standard Error" , 1..27  ====== }

SD:=Input("Standard Error" ,1,3, 1.27);

width:= LastValue( Ref(SD*STE(P, Daysback),-shift));

SDL:= If( x > (lastx - Daysback) AND (Cum(1)-1) < Lastx, y-width , 0) ;

SDU:= ValueWhen(1,( x > (lastx - Daysback) AND (Cum(1)-1) < Lastx) , y+width ); restrictedU:=Ref(Ref(SDU,-shift),shift)*ValueWhen(1,(shift+daysback),1); restrictedU;

SDL:= ValueWhen(1,( x > (lastx - Daysback) AND (Cum(1)-1) < Lastx), y-width ); restrictedL:=Ref(Ref(SDL,-shift),shift)*ValueWhen(1,(shift+daysback),1); restrictedL;

Users browsing this topic
Guest (Hidden)
Forum Jump  
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.