[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Can anyone help me Sort this out....



PureBytes Links

Trading Reference Links

Try this.

I call this 'Optimal Stop'.

It takes the best of a stop based on the best of standard deviation 
or average true range.

Larry Lovrencic

//OPTIMAL STOPS FORWARD
//by Larry Lovrencic 
//First Pacific Securities
//Institutional FX
//www.firstpacific.net

MaxGraph=6;

sdls=((Ref(Low,-1))-(2*(Ref(StDev(Low,5),-1))));
sdss=((Ref(High,-1))+(2*(Ref(StDev(High,5),-1))));

Graph0 =Close;
sdhhvl =HHV(sdls,7);
sdllvs=LLV(sdss,7);

Graph0Style=128;
Graph0Color=22;

Graph1Style=4+8+16+512;
Graph1Color=5;
Graph2Style=4+8+16+512;
Graph2Color=4;
GraphXSpace = 5;

atrls=(Ref(C,-1)- (1.5*(Ref(ATR(5),-1))));
atrss=(Ref(C,-1)+(1.5*(Ref(ATR(5),-1))));

atrhhvl=HHV(atrls, 7);
atrllvs=LLV(atrss, 7);

fn1=(Low-(2*(StDev(Low,5))));
fn2=(High+(2*(StDev(High,5))));
fn3=HHV(fn1,7);
fn4=LLV(fn2,7);
fn5=(C- (1.5*(ATR(5))));
fn6=(C+(1.5*(ATR(5))));
fn7=HHV(fn5, 7);
fn8=LLV(fn6, 7);
fn9=Min( fn3, fn7 ); 
fn10= Max( fn4, fn8 );

Graph1 = Min( sdhhvl, atrhhvl ); 
Graph2 = Max( sdllvs, atrllvs );

PlotShapes( IIf( (Graph1>L) AND (L<Ref(L,-1)), 
shapeHollowSmallCircle, shapeNone ), colorBlue, 0, Low);
PlotShapes( IIf( (Graph2<H) AND (H>Ref(H,-1)), 
shapeHollowSmallCircle+shapePositionAbove, shapeNone ), colorGold, 0, 
High);

ch= (Close-(Ref(Close,-1)));
chpct=ch/Ref(C,-1)*100;

Title = Date()+"  "+Name()+" Optimal Stops Fwd" +"\nO"+WriteVal
(O,format=1.2)+" H"+WriteVal(H,format=1.2)+" L"+WriteVal(L,format=1.2)
+" C"+WriteVal(C,format=1.2)+ "  Change=" + WriteVal(ch,format=1.2)+" 
("+WriteVal(chpct,format=1.2)+"%)"+ "\nLong Stop was-" + WriteVal
(Graph1,format=1.2) + "-Short Stop was-" + WriteVal( 
Graph2,format=1.2 )+"\nOptimal Stops for Tomorrow " + "- Long Stop 
will be-" + WriteVal(fn9,format=1.2) + "-Short Stop will be-" + 
WriteVal( fn10,format=1.2 ) ;

--- In amibroker@xxxxxxxxxxxxxxx, "traderix2003" <d.adam@xxxx> wrote:
> Hi, IŽd like to use the historical volatility to place my stops.
> Has somebody a formula or system using the HV?? perhaps with a MA 
of 
> this HV?  
> Thxs. Traderix



Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
     amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/