PureBytes Links
Trading Reference Links
|
Hi - I was wondering if anyone could explain this
to me:
Im using the following code
stop=IIf(<FONT
color=#ff0000>Buy,stoplong,<FONT
color=#0000ff>IIf(Short<FONT
size=2>,stopshort,0)); // stoplong and stopshort are
values calculated by a trailing stop jscrip I found on the site
PointValue = <FONT
color=#800080>1;
RoundLotSize=<FONT
color=#800080>1;
risk=100; //fixed value in $ per position
NumContracts = IIf(risk/stop><FONT
color=#800080>1,round(risk/stop),<FONT
color=#800080>0);
MarginDeposit=<FONT
color=#800080>1;
PositionSize<FONT
size=2> = NumContracts * <FONT
color=#ff0000>MarginDeposit;
Now, my problem is the following. When I run an explore,
numcontracts works fine and I get the numbers Im expecting. However, when I
backtest, I get exponential results. Fr the first position of any instrument I
get 1e006, the rest are zero. Position value comes out at 0.
How are contracts and position value calculated? If I
know this I can amend my code ...
Thanks
Andy
Yahoo! Groups Sponsor
ADVERTISEMENT
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|