Thanks DdlV!
But again I have this issue of different results with and without a TMF that should not change anything but only writing TradeProfit to the log. I tried it with Zorro 1.36.4 on 2 different PCs (one real, one VPS) with 2 different OS's (Windows 10 Home and Windows Server 12) and get the same results. I hope anyone, best jcl, can retrace this fact because its very confusing for me.
The code:
int TradeLong() {
if (TradeIsNewBar) // not printing every tick only once per bar
print(TO_LOG,"\nTradeProfit: %.2f",(var)TradeProfit);
}
function run()
{
set(PLOTNOW+LOGFILE+TICKS);
vars Price = series(price());
vars Trend = series(LowPass(Price,500));
Stop = 4*ATR(100);
TakeProfit = 10*PIP;
if(valley(Trend) && NumOpenLong == 0)
enterLong();
}
In this version without using the TMF I get always following result:
Annual +23% +93p
If you look at the 1st trade:
[EUR/USD::L5601] Long 1@1.3771 Risk 9$ p at 06:00
[757: Wed 17.02.10 07:00] +0 -2 0/1
[758: Wed 17.02.10 08:00] +0 +0 1/0
[EUR/USD::L5601] Target 1@1.3781: +0.82 at 08:05
It is not exciting, the trade behaves like expected, Zorro exits reaching the TakeProfit at 1.3781 after 10 PIPs.
Now I change:
-- enterLong();
++ enterLong(TradeLong);
a) In most cases, I get the following results:
Annual Loss: -29p
Let's now Look at its 1st trade (the other trades behave analogously):
[EUR/USD::L5601] Long 1@1.3771 Risk 9$ p at 06:00
TradeProfit: 0.05
[EUR/USD::L5601] Exit 1@1.3772: +0.05 at 06:00
I don't know why Zorro exits at 1.3772 while TakeProfit = 10*PIP and in this case this event would be logged as "Target" not as "Exit".
b) Sometimes (but very seldom), if I change:
-- enterLong();
++ enterLong(TradeLong);
in SED, click 'Save' and 'Test' without restart of Zorro:
Annual +23% +93p (same as without TMF), but then take a look at the logged trades:
e.g. 1st trade:
[EUR/USD::L5601] Long 870351@1.3771 Risk 8000543$ p at 06:00
[757: Wed 17.02.10 07:00] +0 -1356395 0/1
[758: Wed 17.02.10 08:00] +0 +326559 1/0
[EUR/USD::L5601] Target 870351@1.3781: +713160$ at 08:05
Funny!
The other trades behave the same way and TradeProfit is not written to Log.