0 registered members (),
677
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
TradeProfit while TradeIsClosed
#454908
09/28/15 23:06
09/28/15 23:06
|
Joined: Dec 2013
Posts: 568 Fuerth, DE
Sphin
OP
User
|
OP
User
Joined: Dec 2013
Posts: 568
Fuerth, DE
|
I've seen other codes in here where it should work, but:
int TradeLong() {
if (TradeIsClosed) {
print(TO_LOG,"\nTradeProfit: %.2f",TradeProfit);
}
}
...
enterLong(TradeLong);
...
produces:
[668: Mon 06.01.14 15:45] +1 +0 2/0
TradeProfit: 0.00
[EUR/USD::L6502] Target 1@1.3639: +0.89 at 15:47
Is it normal that TradeProfit is no more available when the trade is closed? Thanks, Sphin
|
|
|
Re: TradeProfit while TradeIsClosed
[Re: jcl]
#454925
09/29/15 14:37
09/29/15 14:37
|
Joined: Dec 2013
Posts: 568 Fuerth, DE
Sphin
OP
User
|
OP
User
Joined: Dec 2013
Posts: 568
Fuerth, DE
|
It's a bit crazy. If I'm right, the use of the TMF should not change anything concerning trading bevaviour, or does it? I thought to use it for documentation purposes only. But if I take the simple script
int TradeLong() {
if (TradeIsClosed) {
print(TO_LOG,"\nTradeProfit: %.2f",TradeProfit);
}
}
function run()
{
set(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(TradeLong);
}
and run it with "enterLong(TradeLong)" and then compare it with "enterLong()" without the TMF, the behaviour of the script changes and it does really strange things when using the TMF. BTW: TakeProfit seems to be necessary to provoke the printing of TradeProfit to the Log.
|
|
|
Re: TradeProfit while TradeIsClosed
[Re: jcl]
#454994
10/01/15 12:59
10/01/15 12:59
|
Joined: Dec 2013
Posts: 568 Fuerth, DE
Sphin
OP
User
|
OP
User
Joined: Dec 2013
Posts: 568
Fuerth, DE
|
That's strange. For comparism reason I added to my script:
LookBack=200;
StartDate = 2009;
EndDate = 2015;
From the select box I choose EUR/USD and ran one test with enterLong(TradeLong); and Zorro said: Annual +20% +122p and then I ran one test with enterLong(); and Zorro said: Annual +5% +31p In my opinion this is a difference. My Zorro version is 1.34.1.
|
|
|
Re: TradeProfit while TradeIsClosed
[Re: Sphin]
#455089
10/08/15 20:47
10/08/15 20:47
|
Joined: Dec 2013
Posts: 568 Fuerth, DE
Sphin
OP
User
|
OP
User
Joined: Dec 2013
Posts: 568
Fuerth, DE
|
From the manual: TradeProft: The current profit or loss of the trade in units of the account currency, including costs such as spread, rollover, slippage, and commission. In this context your statement The profit of trades is only known _after_ they are really closed confuses me a little because I unterstand the manual's "current" as if TradeProfit shows the actual profit of a trade at any time during the trade. What is right? And concerning Update: I just notice a bug in your printf statement - you're printing a float instead of a var. I think I tried to print a var. From the manual: For printing float variables with the %f placeholder, typecast them to (var). Should I better use
print(TO_LOG,"\nTradeProfit: %.2f",(var)TradeProfit);
if TradeProfit is a float?
|
|
|
|