|
4 registered members (TipmyPip, AndrewAMD, Grant, 1 invisible),
3,514
guests, and 8
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: PnL calculation
[Re: Purri]
#423642
06/02/13 15:51
06/02/13 15:51
|
Joined: Jul 2000
Posts: 28,110 Frankfurt
jcl

Chief Engineer
|

Chief Engineer
Joined: Jul 2000
Posts: 28,110
Frankfurt
|
Ok, here's the function:
function convertProfit(string Rate)
{
char OldAsset[40];
strcpy(OldAsset,Asset); // store original asset
if(!asset(Rate)) return;
var Price = price();
asset(OldAsset);
if(Price > 0.)
PIPCost = PIP*LotAmount/Price;
}
In your run function, call convertProfit("EUR/USD"); when your account currency is EUR and the counter currency is USD. - No, forward peeking is something quite different. What you're doing here is training the strategy to trade more often in the months with better exchange rate. But there's most likely no correlation between your trade signals and the exchange rate, so you'll get distorted parameters and less profit in real trading. At least that's what I suspect. I don't think that many people simulate a strategy this way, so there are no experiences how this really affects the profit, and my objections are purely theoretical. Just try it! You can easily check the result of your method with walk forward analysis f.i. with the strategies from workshop 5, 6, or 7, or with your own strategies. Let me know how it worked.
|
|
|
Re: PnL calculation
[Re: jcl]
#423654
06/02/13 17:12
06/02/13 17:12
|
Joined: May 2013
Posts: 15
Purri
OP
Newbie
|
OP
Newbie
Joined: May 2013
Posts: 15
|
Thanks for the function. I did plot pipcost on a eur/usd chart and it works.
But i dont yet understand how often i need to call this. Do i have to call this function on each run() call? Or does Zorro remember it throughout the rest of the simulation if i set it once?
I dont know, to me this just makes sense. If i make a trade today, my pnl will be with current rates. When i look back in 5 years time, this fact will not have changed, regardless of what the exchange rates will be in 5 years. And since a simulation should be as close to reality as possible, i would then, if i had to do a simulation of this trade, of course simulate the rates from today, because that is just what happened. If i would use rates from 2018 to convert pnl, the outcome would be different to what actually did take place in the past, thus lessening the quality of the simulation. But lets just disagree..
Last edited by Purri; 06/02/13 17:14.
|
|
|
|