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

[amibroker] SetOption("MaxOpenPositions",1) but "short" still cancels "long"



PureBytes Links

Trading Reference Links

Hello, 

I use AB 4.70.5 RT with ESignal plugin (forex data).

In backtester settings and in the specific chart code 
I set the number of max. positions to "1": 
-> SetOption("MaxOpenPositions",1).

After the trading system triggered once "Buy" and openes 
a "long" position, all following "buy" signals are ignored,
as long as the applystop function HAS closed the position
(with profit or loss). This works fine as lomg as the 
becktester is set to "Long" in the field "Positions" and the
trading system (code) is set to only trigger "buy" signals.

After I set backtester to "Long and short" and enabled the 
according code in the chart to trigger "buy" AND "short"
signals, the "SetOption("MaxOpenPositions",1)" seems not 
to work properly anymore, because the tradingsystem
accepts e.g. "short" orders, while a "long" position is 
still open (was not closed by applystop yet).

What am I doing wrong ?

Thanks for any help in advance.

Regards
Robert

Code:

//////////////////////////////////////////////
// EURUSD system
SetOption("MaxOpenPositions",1);
PositionSize = 100000;
Buy = condition1;
Short = condition2;==54 OR Minute()==59);
Sell = C>100000; 
Cover = C>100000; 
ApplyStop(stopTypeLoss,stopModePoint,0.0020,1,False,2); 
ApplyStop(stopTypeProfit,stopModePoint,0.0020,1,False,2); 
Equity(1,-1);
Plot(Close,"EURUSD",color=10,128);
AlertIf(Buy,"EXEC...","Buy",1);
AlertIf(Buy,"EXEC...","Short",3);
//////////////////////////////////////////////

   






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/DldnlA/9M2KAA/U1CZAA/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/