Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by M_D. 04/26/24 20:22
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 841 guests, and 3 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
Changing a particular trade to phantom #485169
01/31/22 11:05
01/31/22 11:05
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
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,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
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: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
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,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
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,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
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