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

Re: [amibroker] Re: Stop and reverse trading AFL question



PureBytes Links

Trading Reference Links

maybe you could use Equity(1) and applystop
Here is something from teh help files on Equity
Using Equity( 1 ) evaluates stops and writes BACK 
signals to sell/cover arrays. Equity(1) also removes 
all extra signals. 

Depending on kind of the stop various values
are written back to sell/cover array to enable you
to distinguish if given signal was generated by regular
rule or by stop. 

1 - regular exit
2 - max. loss
3 - profit target
4 - trailing
5 - n-bar stop
6 - ruin stop 


... your rules...
ApplyStop( stopTypeTrail, stopModePercent, 10, True );
Equity( 1 );
WriteIf( sell == 1, "Regular exit",
WriteIf( sell == 4, "Trailing stop", "" ) );

maybe just have 
Short = Sell==4 or sell==2;



On Sun, 09 Jan 2005 22:44:07 -0000, The Webmaster
<maintainer_wiz@xxxxxxxxx> wrote:
> 
> 
> Not really.
> 
> I pretty much only want to be long in this system, but will only
> become short IF I get stopped out at some price x.
> 
> In this situation, I sell 2 contracts....one to cover my long and
> the remaining one to make me short 1 contract.
> 
> I tried using your suggestion, but I'm now getting too many sells.
> I only want to be short if I get stopped out of my original long
> position.  And I want to cover the short position 5 bars later at
> the close.  Any suggestions for how to do this?  Thanks.
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> > I presume you want to trade long and short
> > Just define your buy and sell as normal for long and then use
> > Short=Sell;
> > Cover=Buy;
> >
> >
> > On Sun, 09 Jan 2005 21:21:35 -0000, The Webmaster
> > <maintainer_wiz@xxxx> wrote:
> > >
> > >
> > > Hi All:
> > >
> > > Just bought AB and am getting adjusted to AFL programming(was a
> long
> > > time Easy Language programmer from way back when).
> > >
> > > Here's my question:
> > >
> > > How would I code a "stop and reverse" trade entry based on my
> > > initial position being long one SP contract, then getting stopped
> > > out at price x by selling two contracts at that price, so that
> now
> > > I'm net short one contract at stop price x?
> > >
> > > What would the "Sell = " code look like?
> > >
> > > Thanks,
> > > -Craig
> > >
> > >
> > > Check AmiBroker web page at:
> > > http://www.amibroker.com/
> > >
> > > Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Cheers
> > Graham
> > http://e-wire.net.au/~eb_kavan/
> 
> 
> Check AmiBroker web page at:
> http://www.amibroker.com/
> 
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
> 
> 
> 
> 
> 


-- 
Cheers
Graham
http://e-wire.net.au/~eb_kavan/


------------------------ 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
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

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/