Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (henrybane), 1,246 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Partially close trades in TMF #487902
11/06/23 15:16
11/06/23 15:16
Joined: Jan 2022
Posts: 58
N
NorbertSz Offline OP
Junior Member
NorbertSz  Offline OP
Junior Member
N

Joined: Jan 2022
Posts: 58
Hello,

I want to close half of the trade at a certain price. I tried to accomplish that with a trade management function; when the conditions are met, I tried modifying the TradeLots, and also tried
Code
exitTrade(ThisTrade, 0, TradeLots/2);

but neither worked for me. I am aware of the following documentation comment...
Quote
TMFs can open new trades with enterLong/Short. However be careful when assigning them the same TMF: mistakes in entry conditions can lead to an endless loop of entering new trades. Exit a trade by returning 1, rather than calling exitTrade.

... but if I return 1, the whole trade closes. Do you have any idea?

Re: Partially close trades in TMF [Re: NorbertSz] #487903
11/06/23 16:39
11/06/23 16:39
Joined: Jan 2022
Posts: 58
N
NorbertSz Offline OP
Junior Member
NorbertSz  Offline OP
Junior Member
N

Joined: Jan 2022
Posts: 58
Ouch.

Quote
Trade size given by an integer number of lots (default = 1; max = LotLimit). [...] Since it's the minimum, the trade size can never be less than 1 lot (see remarks). [...].


I am coming from the MT4 world, where Lots can be "microlot". The reason I could not close partially by modifying TradeLots is because I tried to change to 0.5. For further readers: also check the Hedge mode.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1