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 : TA-Quotes Plus

 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext  
To: Jeff Grover who wrote (7144)10/11/1998 8:53:00 PM
From: Bob Jagow  Read Replies (1) of 11149
 
I understand the need to sync, Jeff, and suppose that 100 days should give the crossing that I believe is required to effect that on nearly all occasions.
My intention was as per my #7137 "pick a hi/low with max/min and set SIP [and firstday] to that value".
Would that be wrong or imprudent?

Bob

What I couldn't understand was that triggering on the flipday matched MSWIN's on one side of the trade but not the other [admittedly a single example].
Agree with your comment that "When it doesn't hit it right on, it is almost always a single day early, not entirely a bad place to receive a signal."
---------------------
input = "30k+vol.lst";
output = "sar.lst";
float accdelta, accfac, SIP, SAR, SARp, xprice;
integer j, count, buysell,firstday, flipday;
accdelta := .02;
accfac := accdelta;
count := -100;
buysell := 0; // 1-long, 0-short
firstday := 1;
SAR := high(count);
SARp := SAR;
SIP := SAR;
xprice := high(count);

for j = count-1 to 0 step 1 do
if( buysell = 0 ) then // short position
if( firstday = 1 ) then
SAR := SIP;
firstday := 0;
else
if( low(j) < xprice ) then
xprice := low(j);
if( accfac < .2 ) then accfac := accfac + accdelta; endif;
endif;
SAR := SARp - accfac * abs(xprice - SARp);
endif;

if( SAR <= high(j) or SAR <= high(j-1) ) then
if( high(j) >= high(j-1)) then SAR := high(j);
else SAR := high(j-1); endif;
buysell := 1;
flipday:= j;
accfac := accdelta;
SIP := xprice;
firstday := 1;
endif;
endif;

if( buysell = 1 ) then // long position
if( firstday = 1 ) then
SAR := SIP;
firstday := 0;
else
if( high(j) > xprice ) then
xprice := high(j);
if( accfac < .2 ) then accfac := accfac + accdelta; endif;
endif;
SAR := SARp + accfac * abs(xprice - SARp);
endif;

if( SAR >= low(j) or SAR >= low(j-1) ) then
if( low(j) <= low(j-1)) then SAR := low(j);
else SAR := low(j-1); endif;
buysell := 0;
flipday:= j;
accfac := accdelta;
SIP := xprice;
firstday := 1;
endif;
endif;

SARp := SAR;
next j;

if buysell = 0 then println symbol," Buy on ",
date(flipday),",",close(flipday):6:3; endif;
if buysell = 1 then println symbol," Sell on ",
date(flipday),",",close(flipday):6:3; endif;
Report TOU ViolationShare This Post
 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext