--------------------------------------------------------------------------------
volatility based system + SAR code
--------------------------------------------------------------------------------
{
This system code is using volatility to both time the entry of a position
and to determine the amount of extra points that should be added to a
limit type order. I thought just for fun, I have found when I'm wrong I'm
usually really wrong so I added some SAR code that was provided to
me by Rich Estrem my partner in the Market Profile Indicator. Which
can be seen at <A HREF="http://www.markbrown.com/estrem.html">MB</A>
Sorry for the spam but we didn't get a review in S&C, like some. But we
are furnishing code here that shows promise and the price is right.
? ? Mark
}
{This could be run on a five minute chart with close all trades
at eod and mm of 1-3 pts and pt of 2-5 pts.}
input:V1(10),V2(9),AL(5),sar_pts(4);
vars: Vola_average(0), ?Vola_trend(0),p1(0),p2(0),extra(0);
P1=Volatility(V1);
P2=average(P1,V2);
if p1>=1.5 then extra=1.20;
if p1<=1.5 then extra=.50;
Vola_average=average(P1,V2);
if Vola_average>Vola_average[1] and P1>Vola_average then
?Vola_trend=1
else if Vola_average<Vola_average[1] and P1<Vola_average then
?Vola_trend=-1
else
?Vola_trend=Vola_trend[1];
?if Vola_trend<0 and Vola_trend[1]>=0
?then begin if c crosses below average(c,AL) then begin
? ? ? ? ? ? ? value1=c - extra;
? ? ? ? ? ?sell tomorrow at value1 Limit;
end;end;
? ? if Vola_trend<0 and Vola_trend[1]>=0 ?{Corrected this line of code ; -}
? ? ? ? ?then begin if c crosses above average(c,AL) then begin
? ? ? ? ? ? value2=c + extra;
? ? ? ? ?buy tomorrow at value2 Limit;
end;end;
if MarketPosition=1 then sell("Ssar") at EntryPrice(0)-sar_pts stop;
if MarketPosition=-1 then buy("Bsar") at EntryPrice(0)+sar_pts stop;
(Edited by willie at 1:59 pm op 4,okt. 2004)