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

[amibroker] Re: Apply Stop Code Not Working



PureBytes Links

Trading Reference Links

Many thanks Steve - that did the trick - really nice when things work 
as planned (always operator error in my case !!) 

Didn't realize that stop was "difference" as opposed to static value.

Can't say enough good things about the AMI program which I've used 
for a couple of years now and also many helpful people on this board 
who take the time to lend a hand when needed.


Best Regards,

Dean H. 



--- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@xxxx> wrote:
> Hi,
> 
> I think the amount of your stop should be the difference between 
the high 
> before your short signal and the price you shorted at. I would try 
changing 
> this line
> 
> StopExit = ValueWhen(Short,Ref(H,-1));
> 
> to this
> 
> StopExit = ValueWhen(Short,Ref(H,-1)) - ShortPrice;
> 
> Steve
> 
> ----- Original Message ----- 
> From: "Dean Hodgins" <deanhodgins@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, June 09, 2005 11:24 PM
> Subject: [amibroker] Apply Stop Code Not Working
> 
> 
> >
> > I've put together a trading system that backtests reasonable well 
but
> > can't get this last piece of the puzzle despite many hours.
> >
> > Here's some sample code that should do what I want. The short sale
> > should exit if/when the price of any subsequent bar goes above 
the high
> > of the bar preceeding the trade signal bar. Sounds straight 
forward but
> > no luck with results.
> >
> > When you run this code on hourly charts ( say STTS for June 9 ) 
the
> > trade remains open at day's end. When I filter the results
> > the "StopExit" returns the correct value but the ApplyStop line 
of code
> > doesn't take me out of the trade as intended at that level.
> >
> > I've turned off all the stop settings in AA and specified short 
sales
> > only.
> >
> > As always any kind help from some AFL brains would be really 
helpful.
> >
> >
> > Filter = Cross ( MA(C,9), MA(C,5) );
> >
> > Short = Cross ( MA(C,9), MA(C,5) );
> > Cover = Cross ( MA(C,5), MA(C,9) );
> >
> > StopExit = ValueWhen(Short,Ref(H,-1));
> >
> > ApplyStop(stopTypeLoss,stopModePoint,StopExit,1,False,1);
> >
> > AddColumn(C,"Close  ",1.2);
> > AddColumn(StopExit,"StopExit ",1.2);
> >
> >
> >
> >
> >
> > Please note that this group is for discussion between users only.
> >
> > To get support from AmiBroker please send an e-mail directly to
> > SUPPORT {at} amibroker.com
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/