Gamestudio Links
Zorro Links
Newest Posts
folder management functions
by 7th_zorro. 04/16/24 13:19
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, Aku_Aku, VoroneTZ, 11honza11), 376 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Changing a particular trade to phantom #485169
01/31/22 11:05
01/31/22 11:05
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
A system generated X trades across different assets and at the end of the run() I want to turn some of them Phantom (say, because the exposure to a particular asset would be above acceptable).

What would be the way of doing this in a for(open_trades) loop?


Re: Changing a particular trade to phantom [Re: Zheka] #485170
01/31/22 11:47
01/31/22 11:47
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Calling the broker and begging him to cancel the over-exposed trade?

Re: Changing a particular trade to phantom [Re: Zheka] #485173
01/31/22 12:19
01/31/22 12:19
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
soooo funny...

There are no 'overexposed' trades placed...yet...There could be some over-exposure, IF newly generated trades are placed - so I want to turn some of them phantom.

Regardless of a reason: what's the way to change a pending trade to phantom?

Re: Changing a particular trade to phantom [Re: Zheka] #485176
01/31/22 19:19
01/31/22 19:19
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline
Serious User
DdlV  Offline
Serious User
D

Joined: Jun 2013
Posts: 1,609
Hi @Zheka,

I guess it depends on what you actually mean by "generated", "pending", "placed", etc.

It sounds like you're in a single Bar, correct? (I.e., you're not trying to do this on a later Bar after the trades were long ago entered & filled?)

So, don't enter a trade until you know whether you want it to be real or phantom.

Accumulate your "generated", "pending", desired trades in an array, and at the end of the run() spin through the array entering real or phantom as needed to "place" them correctly?

HTH.

Re: Changing a particular trade to phantom [Re: Zheka] #485180
02/01/22 12:31
02/01/22 12:31
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
A "pending" trade is a "pending" trade. And there is a clear advantage of having "risk mngt" as a separate module, usable on top of any other existing system without having to modify it with parallel "order accumulation/ tracking mechanism"/arrays, etc.

The solution is simple : (ThisTrade->flags) |=TR_PHANTOM , but a "higher level interface" for doing this, e.g. via tradeUpdate(), would not harm.

Re: Changing a particular trade to phantom [Re: Zheka] #485182
02/01/22 15:16
02/01/22 15:16
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
If the trade is still pending, exit it and open a phantom trade instead.

Re: Changing a particular trade to phantom [Re: Zheka] #485184
02/01/22 15:41
02/01/22 15:41
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Why "exit - re-open", if simple setting of a flag works just fine?

Re: Changing a particular trade to phantom [Re: Zheka] #485192
02/02/22 10:23
02/02/22 10:23
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Because I don't know if it works just fine, or will keep working just fine.

Re: Changing a particular trade to phantom [Re: Zheka] #485194
02/02/22 12:03
02/02/22 12:03
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Exiting / re-opening the trade with ALL the exact same parameters (except phantomness) is cumbersome.

Please provide a way of accomplishing this via tradeUpdate() (e.g with negative NewLots) or some other simple way.

Last edited by Zheka; 02/03/22 01:12.

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