Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 03/08/26 18:50
zorro with ccxt?
by opm. 03/03/26 03:17
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (clint000, TipmyPip), 13,216 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Exiting a specific trade #446395
10/13/14 19:51
10/13/14 19:51
Joined: Sep 2014
Posts: 24
M
mustang Offline OP
Newbie
mustang  Offline OP
Newbie
M

Joined: Sep 2014
Posts: 24
------- The documentation below -------------
exitTrade (TRADE* trade, var price, int lots)
Exits a particular trade at market or at a given price limit.
Parameters:
algo Optional algorithm identifier of the trade, or 0 for the current Algo, or "*" for exiting all open trade positions with the current asset regardless of their identifiers.
trade The patricular trade to be closed.
-------------- My question below ------------
Could someone please post an example of code for achieving this?
I have multiple assets and I want to exit a specific asset under specific conditions. Example: Exit USD/JPY of size 1 but keep USD/JPY of size 2 open.

Last edited by mustang; 10/13/14 20:08.
Re: Exiting a specific trade [Re: mustang] #446413
10/14/14 13:28
10/14/14 13:28
Joined: Jul 2000
Posts: 28,083
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,083
Frankfurt
The simplest way is enumerating all open trades and closing the trades that fulfil the condition, like this:

Code:
for(open_trades) {
   if(TradeAsset == "USD/JPY" and TradeLots == 1)
      exitTrade(ThisTrade);
}


Re: Exiting a specific trade [Re: jcl] #446416
10/14/14 16:31
10/14/14 16:31
Joined: Sep 2014
Posts: 24
M
mustang Offline OP
Newbie
mustang  Offline OP
Newbie
M

Joined: Sep 2014
Posts: 24
Thank you very much JCL and Zorro team, I love the simplicity!


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1