SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Strategies & Market Trends : Technical Analysis - Beginners

 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext  
To: jolox who wrote (11649)3/4/2001 10:49:20 AM
From: TechTrader42  Read Replies (2) of 12039
 
It's difficult in QP2, because you have to set the period for the peaks and troughs, and there isn't a good way to do that.

But you could try the scan below. It's for 61.8% retracements over various periods, and it can easily be changed to get 38.2% and 50% retracements.

This line looks for 61.8% retracements:

if (close(0)<=(1+percentage)*sixoneeight and
close(0)>=(1-percentage)*sixoneeight) then

Change it to this, for example, for 38.2:

if (close(0)<=(1+percentage)*threeeighttwo and
close(0)>=(1-percentage)*threeeighttwo) then

This is the whole scan, which is flawed because of the
problem of finding peaks and troughs, but you could use it
for a start.

// input="8080.lst";
output="retrace.lst";
float trendpeak,trendtrough,sixoneeight,threeeighttwo,
fifty,twelve,eightyseven,period,percentage;

period:=8; // SET PERIOD FOR PEAK AND TROUGH OF TREND
percentage:=.03; // SET PERCENTAGE FOR HOW NEAR
// YOU WANT PRICE TO RETRACEMENT

trendpeak:=max(0,-(period-1),hi);
trendtrough:=min(0,-(period-1),lo);
sixoneeight:=(.382*(trendpeak-trendtrough))+trendtrough;
threeeighttwo:=(.618*(trendpeak-trendtrough))+trendtrough;
fifty:=(.5*(trendpeak-trendtrough))+trendtrough;

if (close(0)<=(1+percentage)*sixoneeight and
close(0)>=(1-percentage)*sixoneeight) then
println symbol:-6, "Period: ", period:-4,
"Close: ", close(0):6:2,
" ", "61.8%: ", sixoneeight:6:2,
" ", "50%: ", fifty:6:2,
" ", "38.2%: ", threeeighttwo:6:2,
" ", "Trough: ", trendtrough:6:2,
" ", "Peak: ", trendpeak:6:2;
endif;

period:=16; // SET PERIOD FOR PEAK AND TROUGH OF TREND

trendpeak:=max(0,-(period-1),hi);
trendtrough:=min(0,-(period-1),lo);
sixoneeight:=(.382*(trendpeak-trendtrough))+trendtrough;
threeeighttwo:=(.618*(trendpeak-trendtrough))+trendtrough;
fifty:=(.5*(trendpeak-trendtrough))+trendtrough;

if (close(0)<=(1+percentage)*sixoneeight and
close(0)>=(1-percentage)*sixoneeight) then
println symbol:-6, "Period: ", period:-4,
"Close: ", close(0):6:2,
" ", "61.8%: ", sixoneeight:6:2,
" ", "50%: ", fifty:6:2,
" ", "38.2%: ", threeeighttwo:6:2,
" ", "Trough: ", trendtrough:6:2,
" ", "Peak: ", trendpeak:6:2;
endif;

period:=32; // SET PERIOD FOR PEAK AND TROUGH OF TREND

trendpeak:=max(0,-(period-1),hi);
trendtrough:=min(0,-(period-1),lo);
sixoneeight:=(.382*(trendpeak-trendtrough))+trendtrough;
threeeighttwo:=(.618*(trendpeak-trendtrough))+trendtrough;
fifty:=(.5*(trendpeak-trendtrough))+trendtrough;

if (close(0)<=(1+percentage)*sixoneeight and
close(0)>=(1-percentage)*sixoneeight) then
println symbol:-6, "Period: ", period:-4,
"Close: ", close(0):6:2,
" ", "61.8%: ", sixoneeight:6:2,
" ", "50%: ", fifty:6:2,
" ", "38.2%: ", threeeighttwo:6:2,
" ", "Trough: ", trendtrough:6:2,
" ", "Peak: ", trendpeak:6:2;
endif;

period:=64; // SET PERIOD FOR PEAK AND TROUGH OF TREND

trendpeak:=max(0,-(period-1),hi);
trendtrough:=min(0,-(period-1),lo);
sixoneeight:=(.382*(trendpeak-trendtrough))+trendtrough;
threeeighttwo:=(.618*(trendpeak-trendtrough))+trendtrough;
fifty:=(.5*(trendpeak-trendtrough))+trendtrough;

if (close(0)<=(1+percentage)*sixoneeight and
close(0)>=(1-percentage)*sixoneeight) then
println symbol:-6, "Period: ", period:-4,
"Close: ", close(0):6:2,
" ", "61.8%: ", sixoneeight:6:2,
" ", "50%: ", fifty:6:2,
" ", "38.2%: ", threeeighttwo:6:2,
" ", "Trough: ", trendtrough:6:2,
" ", "Peak: ", trendpeak:6:2;
endif;

period:=128; // SET PERIOD FOR PEAK AND TROUGH OF TREND

trendpeak:=max(0,-(period-1),hi);
trendtrough:=min(0,-(period-1),lo);
sixoneeight:=(.382*(trendpeak-trendtrough))+trendtrough;
threeeighttwo:=(.618*(trendpeak-trendtrough))+trendtrough;
fifty:=(.5*(trendpeak-trendtrough))+trendtrough;

if (close(0)<=(1+percentage)*sixoneeight and
close(0)>=(1-percentage)*sixoneeight) then
println symbol:-6, "Period: ", period:-4,
"Close: ", close(0):6:2,
" ", "61.8%: ", sixoneeight:6:2,
" ", "50%: ", fifty:6:2,
" ", "38.2%: ", threeeighttwo:6:2,
" ", "Trough: ", trendtrough:6:2,
" ", "Peak: ", trendpeak:6:2;
endif;
Report TOU ViolationShare This Post
 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext