PureBytes Links
Trading Reference Links
|
Hi all, have been coding attempts to allow backtesting forex and have
reached a point that I can't seem to move past.
In theory it seems simple enough:
- standard contract = 100,000xCCY1
- a one point move in CCY2 is worth 10xCCY2 (or 1000xCCY2 if CCY2 is JPY..)
- ticksize is 0.0001 (or 0.01 if CCY2 is JPY..)
- margin is 2% of CCY2
My code follows. I suspect it's not right but it gives pretty close
results to hand tests. Except for JPY which is never picked up by AA
(even if trades are picked up by Exploration).
I'm going nuts here people - any feedback appreciated.
BTW I also have questions about Forex conversions to base currency but
Marcin has promised a KB article soon. :-)
Regards, GRANT
*<code>*
if ( StrRight( Name (), 3 ) == "JPY" ) {
TickSize = 0.01;
PointValue = 1000;
} else {
TickSize = 0.0001;
PointValue = 100000;
}
// FOREX settings
SetOption( "FuturesMode", True); // use margin
deposit and point value in calculations
RoundLotSize = 1; // whole contracts only
lotSize = 100000; // full contract
100,000 base currency
MarginDeposit = lotSize * 0.02; // margin 2% of
position value
contracts = 1; // contracts to
acquire
SetPositionSize( contracts, spsShares ); // spsShares = size
expressed in shares/contracts
*</code>*
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/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/
|