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

[amibroker] Re: sigscalein positionsize problem



PureBytes Links

Trading Reference Links

Hi Ed,

thanks for your response and sorry for my late answering.
I´ll try out your example as a basis for scaling-in and 
will tell if it worked out.

Regards and thanks again
robert


--- In amibroker@xxxxxxxxxxxxxxx, "Edward Pottasch" <empottasch@xxx> 
wrote:
>
> hi,
> 
> I didn't look at your code in detail but I can give an example of 
code I have written for scaling out 3 contracts for future trading.
> 
> Using the following setings:
> 
> SetOption("CommissionMode", 3);
> SetOption("CommissionAmount", 2.40);
> SetOption("FuturesMode",True);
> NumContracts = 3;
> 
> you can then tell the backtester to enter 3 contracts on an extry 
signal using:
> 
> SetPositionSize( 3, spsShares ); 
> 
> then when you scale out from this position of 3 contracts, 1 
contract at a time you use:
> 
> SetPositionSize( 1, spsShares * ( Buy == sigScaleOut OR Short == 
sigScaleOut ) );
> 
> I assume a similar construction can be used when scaling in. See 
the help for SetPositionSize,
> 
> rgds, Ed
> 
> 
> 
> 
>   ----- Original Message ----- 
>   From: nightscalper 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Tuesday, October 16, 2007 3:05 AM
>   Subject: [amibroker] sigscalein positionsize problem
> 
> 
>   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/