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

Re: [amibroker] Re: Different exits for different entries + equity management



PureBytes Links

Trading Reference Links

Hi again (sorry for all the messages),

I tried to use sigscalein but it isn't a big success yet.  With the code below, the system buys 50% on the first signal (which is ok), but ignores the next one.  I'd like to be able to buy 50% on March 3 (with a rule planning to sell three days later) and buy another 50% on March 4 (with another exit rule) but even after looking in the manual and trying everything I could I didn't find how to do it.

Same problem with trying to change the margin for each trade.  I know how to set the margin for the overall system, but I'd like to change how much margin and equity I use with each trade.

Anyone would be kind enough to help me with that?  Thank you very much.   Please note that I first asked about this on May 6 (#
123500) so I did a lot of work by myself; but now I just don't know how to go futher.

Thank you very much,

Louis

SetPositionSize( 50, spsPercentOfEquity );
SetOption("MaxOpenPositions", 2 );

Buy1 = ( rule1 );

//Buy1 = ExRem ( Buy1, 3 );
//Sell1 = Ref ( Buy1, -3 );
Sell1 = BarsSince(Buy1) == 3;
InTrade1 = Flip( Buy1, Sell1 );
DoScaleIn1 = ExRem( InTrade1, Sell1 );

Buy2 =  rule2   ;
//Buy2 = ExRem( Buy2, 5 );
//Sell2 = Ref ( Buy2, -5 );
Sell2 = BarsSince(Buy2) == 5;
InTrade2 = Flip( Buy2, Sell2 );
DoScaleIn2 = ExRem( InTrade2, Sell2 );

Buy3 =  rule3 ;
//Buy3 = ExRem ( Buy3, 2 );
//Sell3 = Ref ( Buy3, -2 );
Sell3 = BarsSince(Buy3) == 2;
InTrade3 = Flip( Buy3, Sell3 );
DoScaleIn3 = ExRem( InTrade3, Sell3 );

Buy4 =  rule4 ;
//Buy4 = ExRem ( Buy4, 1 );
//Sell4 = Ref ( Buy4, -1 );
Sell4 = BarsSince(Buy4) == 1;
InTrade4 = Flip( Buy4, Sell4 );
DoScaleIn4 = ExRem( InTrade4, Sell4 );

Buy = (Buy1 + sigScaleIn*doscalein1) OR  (Buy2 + sigScaleIn*doscalein2) OR  (Buy3 + sigScaleIn*doscalein3) OR  (Buy4 + sigScaleIn*doscalein4);
Sell = Sell1 OR Sell2 OR Sell3 OR Sell4;


2008/5/13 Louis Préfontaine <rockprog80@xxxxxxxxx>:
Hi there,

Here is what I managed to achieve:

SetPositionSize( 50, spsPercentOfEquity );
SetOption("MaxOpenPositions", 2 );

Buy1 = rule1;
Sell1 = BarsSince(Buy1) == 3;


Buy2 = rule2 ;
Sell2 = BarsSince(Buy2) == 5;

Buy3 =  rule3 ;
Sell3 = BarsSince(Buy3) == 2;

Buy4 =  rule4;
Sell4 = BarsSince(Buy4) == 1;

Buy = Buy1 OR Buy2 OR Buy3 OR Buy4 ;
Sell = Sell1 OR Sell2 OR Sell3 OR Sell4;


Two problems remain:

1) I'd like to establish a margin of 100 for rule 1 and 2, a margin of 50 for rule 3 and a margin of 33 for rule 4.  Don't know how to do it;
2) Some of my signals cross each other; I want each signal to buy 50% of the equity leaving the other 50% "ready" for another signal while the first signal is still open...  Right now with that code I only get the first signal and the second one is ignored.  E.g.  If Buy2 enters a position on May 5 and there is a signal on May 6, May 6 signal will get ignored.  What I want is 50% on May 5 and if a signal comes on May 6 I want another 50%.  Is this possible?

Thanks again,

Louis






2008/5/13 Louis Préfontaine <rockprog80@xxxxxxxxx>:

Hi again,

Ok here is what I am trying to do.  I'll try to add as much details as I can.

There is three different conditions on which I want to react differently.

Condition 1) I buy the stock with full margin and full power and exits after 10 days;
Condition 2) I buy the stock with no margin and exits after 10 days;
Condition 3) I buy the stock with no margin and with less than 50% of my equity and exits after 5 days.

I am looking for a code to do this.  It does not look that complicated, but I don't know how to do it.

If someone has any idea...

Thanks,

Louis



2008/5/13 louisprefontaine <rockprog80@xxxxxxxxx>:

Anyone?

Thanks,

Louis

--- In amibroker@xxxxxxxxxxxxxxx, "Louis Préfontaine" <rockprog80@xxx>
wrote:


>
> Hi,
>
> I am looking for a way to set different sell signals depending on
particular
> buy signals. E.G. For cond1 I want a particular sell, and for cond2
> another particular sell.
>
> Also, I'd like to set a different equity management for each condition.
> E.g. For cond1 I want to use 50 margin, for cond2 33 margin and for
cond 3
> 100 margin, etc.
>
> Anyone can help me with that?
>
> Thanks,
>
> Louis
>




__._,_.___

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___