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

[amibroker] Wrong interpretation of first sigScaleOut?



PureBytes Links

Trading Reference Links

Hi AB experts,

I observed a strange behaviour in the backtester when using the
special constants sigScaleIn and sigScaleOut.

According to the manual, "AB treats first sigScaleIn as buy anyway"
when buy variable is set to sigScaleIn instead of True for the
position opening. From that, my conclusion would be that if I set the
variable "Buy = sigScaleOut" before the position is opened (means I
have zero shares and no "buy = true" signal before), the signal should
be ignored by the backtester because I cannot reduce my not opened
position size if I make only long trades. But, with the following code:

//--- cut here ---

Sell = 0;

BarInRange = Status("barinrange");

MonthBegin = (Month() != Ref( Month(), -1 )) AND BarInRange; 

FirstPurchase = Cum( MonthBegin ) == 1; 

Buy = IIf( FirstPurchase, 1,  // buy on begin of month 
           IIf( MonthBegin, sigScaleIn, // each month begin increase
           sigScaleOut ) ); // other days decrease position

Filter = 1 ;

AddColumn( IIf( Buy == True, Asc("B"), 
           IIf( Buy == sigScaleOut, Asc("O"),
           IIf( Buy == sigScaleIn, Asc("I"), Asc(" " )))), "Signal",
formatChar );

//--- cut here ---

you can see that the backtester will do a buy on the first bar (which
is a sigScaleOut signal if it does not on the begin of a month). Then,
on the second bar the backtester sells the open position.

You can also test the behaviour with a more simple script:
buy = sigScaleOut;
sell = 0;

For me it looks quite strange ... why does backtester do a buy and
herewith increase the position when the command is to decrease?

Note: In the backtester settings you must set Reporting to "detailed
log" to see what happens ...

Any ideas are welcome!

Thanks,
Markus




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
 
Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/