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

[amibroker] sigscalein positionsize problem



PureBytes Links

Trading Reference Links

Hi to all,

may I ask for your help with the following code.

The positionsize does not behave as it should.
I am trying to buy "100" at first occurence of buy 
signal and when scalein condition appears (drawdown), 
I want to buy "100000", but backtester does set 
positionsize sometimes right and sometimes not, 
e.g. it buys "100000", even if it´s the first occurence 
of buy signal, or buys "100", even if it´s a scalein 
signal. But sometime backtester does it correct. I 
just don´t get it. Initial equity in backtestersettings
is 1,000,000, so this should be no problem. 

Thanks for any help finding what is wrong with the code.

Regards
robert


******************************************************************

Plot(Close,"",colorwhite,132);

Buy = Buycondition;
Sell = C<0;

ApplyStop(stopTypeProfit,stopModePoint,0.0030,1,False,1); 
ApplyStop(stopTypeLoss,stopModePoint,0.0080,1,False,1);

e = Equity(1);  

PyramidThreshold = 0.1; 
PcntProfit = 100*(e-ValueWhen(Buy,e))/ValueWhen(Buy,e); 
InTrade = Flip(Buy,Sell); 
DoScaleIn = ExRem(InTrade AND PcntProfit<-PyramidThreshold,Sell);
Buy = Buy + sigScaleIn * DoScaleIn;

PositionSize = IIf(DoScaleIn,100000,100);

******************************************************************





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/