Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

IS there a tool that can close all positions when profit up to some equity 1%,or 500 USD?
 Post subject: IS there a tool that can close all positions when profit up to some equity 1%,or 500 USD? Post rating: 0   New post Posted: Thu 18 Dec, 2014, 08:02 
User avatar

User rating: 0
Joined: Fri 29 Mar, 2013, 17:33
Posts: 9
IS there a tool that can close all positions when profit up to some equity 1%,or 500 USD?
DUKASCOPY system has a function that can close all positiongs when loss down to some equity ,but not has a function to profit of equity...


ANYbody ,can have this kind of tool sharing with us ?

thank you very much!!


 
 Post subject: Re: IS there a tool that can close all positions when profit up to some equity 1%,or 500 USD? Post rating: 0   New post Posted: Mon 22 Dec, 2014, 09:42 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please consider the following code:
List<IOrder> orders = engine.getOrders();
double profitLoss = 0;

for(IOrder order : orders) {
    profitLoss = order.getProfitLossInUSD();
}

if(takeProfit < profitLoss) {
    for(IOrder order : orders) {
        order.close();
    }
}


 
 Post subject: Re: IS there a tool that can close all positions when profit up to some equity 1%,or 500 USD? Post rating: 0   New post Posted: Mon 04 May, 2015, 15:32 
User avatar

User rating: 0
Joined: Tue 13 May, 2014, 17:51
Posts: 1
Location: United KingdomUnited Kingdom
In VisualJForex include the following blocks:

Image

You will find the "Equity" variable in VisualJForex in the left panel under "Account".

The program above assumes starting equity is 50000.
Strategy stops when equity is 500 above or below 50000.


Attachments:
EquityTakeProfit.PNG [52.69 KiB]
Downloaded 261 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 

Jump to:  

cron
  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com