Gamestudio Links
Zorro Links
Newest Posts
Removing outliers from files
by AndrewAMD. 12/02/26 15:26
SGT_FW
by Aku_Aku. 11/30/26 08:19
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (Quad), 6,074 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 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,150
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,150
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