input:m(3,3,10,1),n(3,3,10,1);
hh1:=hhv(h,m);
ll1:=llv(l,m);
hh2:=if(c<ref(ll1,1),hh1,0);
hh:=VALUEWHEN(hh2<>0,hh2);
ll2:=if(c>ref(hh1,1),ll1,0);
ll:=VALUEWHEN(ll2<>0,ll2);
hhcon:=ref(c,1)<ref(hh,1) and c>hh;
llcon:=ref(c,1)>ref(ll,1) and c<ll;
hlsig:=VALUEWHEN(hhcon or llcon,if(hhcon,1,0));
stophl:if(hlsig=1,ll,hh),colorred,linethick2;
if cross(c,stophl) then begin
sellshort(1,0,marketr);
buy(holding=0,1,marketr);
end
if cross(stophl,c) then begin
sell(1,0,marketr);
buyshort(holding=0,1,marketr);
end
http://www.weistock.com/bbs/dispbbs.asp?boardid=16&Id=55132
這個是金字塔編程教材