PureBytes Links
Trading Reference Links
|
Hi,
maybe you like my code below. It also includes Stopp and take profit
optimizing.
_SECTION_BEGIN("System parameters");
Digits = Param("Digits",4,0,4,1);
Digits_value =
IIf(Digits == 0,0,
IIf(Digits == 1,0.1,
IIf(Digits == 2,0.01,
IIf(Digits == 3,0.001,
IIf(Digits == 4,0.0001,-1e10)))));
default_stop = Param("Default stop",5,5,100,1)*Digits_value;
default_profit = Param("Default profit",10,10,100,1)*Digits_value;
PointValue = Param("Point value",10000,1,10000,1);
PositionSize = MarginDeposit = 1;
Equity(1);
_SECTION_END();
//forex
stop_amount = Optimize("Stop loss",default_stop,
5*digits_value,20*digits_value,1*digits_value);
ApplyStop(
stopTypeLoss,stopModePoint,stop_amount,
exitatstop=1, volatile = False, ReEntryDelay = 0 ) ;
profit_amount = stop_amount = Optimize("Take profit",default_profit,
10*digits_value,50*digits_value,1*digits_value);
ApplyStop(stopTypeProfit,stopModePoint,profit_amount,
exitatstop=1, volatile = False, ReEntryDelay = 0 );
Regards
Thomas
www.tradingbasis.com
----- Original Message -----
From: "Alan" <firehorse888uk@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, June 05, 2005 4:53 PM
Subject: [amibroker] Puzzling forex trade size
> Hi,
>
> I've got this code at the start to set my trade size.
>
> MarginDeposit = 1; // 100:1 leverage
> TickSize = 0.01; // for JPY Currencies
> TickSize = 0.0001;
> PointValue = 1/TickSize; //this adjusts profit so for 1 pip = $1 (tick
> sizes: 0.01 for yen AND 0.0001 for others)
> SetPositionSize(1,spsShares);
>
> On most trades, the trade size is 1, how I expect.
>
> However, some trades are a fractional size like 0.7 or 0.3
>
> It doesn't how much equity I have 1,000 or 1,000,000. The trade size is
> still 0.7 or 0.3 for those particular trades.
>
> When I change to SetPositionSize(10,spsShares); very few of the share
> sizes are 10, most are values under 10.
>
> This is a very puzzling symptom as I thought that if you have enough
> money, you should be able to set the share size you want.
>
> Has anyone else come across this before?
>
> Alan
>
>
>
> 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
>
>
>
>
>
>
>
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
------------------------ Yahoo! Groups Sponsor --------------------~-->
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/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/
|