Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (PeroPero, 1 invisible), 858 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
TradeBarClose with LifeTime #486054
06/05/22 15:26
06/05/22 15:26
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
This code:
Code
...LifeTime=3;  if (tod()==1300) enterShort();..
will generate this log :
[5237: Fri 22-06-03 13:00] (1.07165)
[EUR/USD::S23753] Short 1@1.07165 x at 13:00:00

[5238: Fri 22-06-03 13:30] 11.16 -1.31 59/49 (1.07295)
[5239: Fri 22-06-03 14:00] 9.65 -2.82 59/49 (1.07445)
[5240: Fri 22-06-03 14:30] 11.04 -1.43 59/49 (1.07305)

[EUR/USD::S23753] Expired 1@1.07305: -1.44 at 15:00:00

[5241: Fri 22-06-03 15:00] 11.03 0 59/49 (1.07230)
..

Exit happens at 1430 at the closing price of 1.07305 of bar 5240.... Yet, TradeBarClose is 5241 for this trade.


Last edited by Zheka; 06/05/22 15:27.
Re: TradeBarClose with LifeTime [Re: Zheka] #486055
06/05/22 16:01
06/05/22 16:01
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
In addition, the TradePriceClose is different from the 'ask' even when all costs are set to 0.

[5237: Fri 22-06-03 13:00] 1.07320/1.07395\1.07040/1.07165 -0.0
[EUR/USD::S23753] Short 1@1.07165 x Bid 1.07165 at 13:00:00 (local 09:00)
Com 0000 Mrg 0.54 Net 0

[5238: Fri 22-06-03 13:30] 11.16 -1.31 59/49 1.07165/1.07385\1.07145/1.07295 -0.0
[5239: Fri 22-06-03 14:00] 9.65 -2.82 59/49 1.07295/1.07520\1.07250/1.07445 -0.0
[5240: Fri 22-06-03 14:30] 11.04 -1.43 59/49 1.07445/1.07485\1.07300/1.07305 -0.0

[EUR/USD::S23753] Expired 1@1.07305: -1.44 at 15:00:00
Opn 1.07165 Cls 1.07309 Spr 0.0 Slp 0.00 Rol 0.00 Com -0.00 Lif 4 Net -1

[5241: Fri 22-06-03 15:00] 11.03 0 59/49 1.07305/1.07365\1.07155/1.07230 -0.0

This is not related to LifeTime and happens similarly for Longs and Shorts, i.e. TradePriceClose>bar close price regardless of direction.

Last edited by Zheka; 06/05/22 16:03.
Re: TradeBarClose with LifeTime [Re: Zheka] #486056
06/05/22 16:10
06/05/22 16:10
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
When Spread is set:

[5237: Fri 22-06-03 13:00] 1.07320/1.07395\1.07040/1.07165 -0.00004
[EUR/USD::S23753] Short 1@1.07165 x Bid 1.07161 at 13:00:00 (local 09:00)
Com 0.0536 Mrg 0.54 Net 0

[5238: Fri 22-06-03 13:30] 1.11 -1.40 58/50 1.07165/1.07385\1.07145/1.07295 -0.00004
[5239: Fri 22-06-03 14:00] -0.40 -2.91 58/50 1.07295/1.07520\1.07250/1.07445 -0.00004
[5240: Fri 22-06-03 14:30] 0.99 -1.52 58/50 1.07445/1.07485\1.07300/1.07305 -0.00004

[EUR/USD::S23753] Expired 1@1.07305: -1.53 at 15:00:00
Opn 1.07165 Cls 1.07309 Spr 0.00004 Slp 0.00 Rol 0.00 Com 0.05 Lif 4 Net -1

[5241: Fri 22-06-03 15:00] 0.98 0 58/50 1.07305/1.07365\1.07155/1.07230 -0.00004

TradeClosePrice is bigger than the 'Ask' price.

Last edited by Zheka; 06/05/22 16:10.
Re: TradeBarClose with LifeTime [Re: Zheka] #486058
06/06/22 07:31
06/06/22 07:31
Joined: Apr 2008
Posts: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
Austria
2 hopefully helpful pieces of info:

- Short trades close at the ask, not the bid. So your setting spread to whatever value cannot have an effect.

- Lifetime lets the trade exit at next open, not at current close. So you were probably comparing the wrong prices.

Still, I cannot see how that exit price comes together, unless that was live. Then ask the broker. Otherwise, if you think something is wrong with it, contact support with the script and data for reproducing it, and we'll help.

And finally please post topics to the suited forum. This makes life easier. Questions go in the starting forum, bug reports in the bugs forum, neither of them belongs in the future forum.

Re: TradeBarClose with LifeTime [Re: Zheka] #486061
06/06/22 09:41
06/06/22 09:41
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
I mentioned "even when costs are set to 0" just to say that Spread is forced to 0, and it could not have been somehow 'mistakenly' used in calculating the exit price ( even if it shouldn't for short trades anyway).

The difference between TradePriceClose=1.07309 and close/open=1.07305(ask) is exactly the spread from the asset list file.
Quote
Lifetime lets the trade exit at next open, not at current close. So you were possibly comparing the wrong prices.
- Logs are exactly to avoid 'possibility' and ensure 'certainty'. But my OP was not about the price; it was about the TradeBarClose.
With LifeTime, you get:
Quote
[5240: Fri 22-06-03 14:30] 11.04 -1.43 59/49 (1.07305)

[EUR/USD::S23753] Expired 1@1.07305: -1.44 at 15:00:00 < -in live, it will exit at 1430+...but TradeBarClose=5241.

[5241: Fri 22-06-03 15:00] 11.03 0 59/49 (1.07230)..
With if (tod()==1430) exitShort(); you get:
Quote
[5240: Fri 22-06-03 14:30] 11.04 -1.43 59/49 (1.07305)

[EUR/USD::S23753] Expired 1@1.07305: -1.44 at 14:30:00 <- same as above.... but TradeBarClose=5240.

[5241: Fri 22-06-03 15:00] 11.03 0 59/49 (1.07230).
In reality, its exactly same moment in time ( tick at or after 1430) and the same exit price, yet 2 different treatments (in TradeBarClose).

Re: TradeBarClose with LifeTime [Re: Zheka] #486064
06/06/22 17:33
06/06/22 17:33
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
I posted here because it is supposedly a place for the 'beta' versions feedback. Ok - will be more deliberate in choosing threads.

Anyhow, I found the reason for the weird trade close price to be Detrend=TRADES. All ok with prices.

This leaves then the OP and the post above related to TradeBarClose with LifeTime.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1