meta stock formulas for darvas box

#1
Here are two MetaStock formulas available on the internet. Please note, I didn't write the MetaStock code but I'm posting it here (along with attributions to their original URLs) for those that are interested:


Darvas Box I (http://trader.online.pl/MSZ/e-w-Darvas_Box.html)
LowL:=If(Low=LLV(Low,5),Low,If(Ref(Low,-1)=LLV(Low,5),Ref(Low,-1), If(Ref(Low,-2)=LLV(Low,5),Ref(Low,-2),If(Ref(Low,-3)=LLV(Low,5),Ref(Low,-3), If(Ref(Low,-4)=LLV(Low,5),Ref(Low,-4),0)))));
NewH:=ValueWhen(1,High>Ref(HHV(High,5),-1),High);
box1:=HHV(High,3)<HHV(High,4);
box2:=ValueWhen(1,BarsSince(High>Ref(HHV(High,5),-1))=3 AND box1=true,NewH);
box3:=ValueWhen(1,BarsSince(High>Ref(HHV(High,5),-1))=3 AND box1=true,LowL);
TopBox:=box2;
BottomBox:=box3;
TopBox;
BottomBox;


Darvas Box II (http://trader.online.pl/MSZ/e-w-Darvas_Box_II.html)
Ht:=If(Cross(HHV(H,4)=Ref(H,-3),.9)=1,Ref(H,-3),PREV);
Top:=If(Ht>Ref(Ht,-1),Ht,PREV);
Lt:=If(Cross(HHV(H,4)=Ref(H,-3),.9)=1,L,PREV);
Bot:=If(Lt<Ref(Lt,-1),Lt,PREV);
Top;
Bot
 

Similar threads