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.

Takeprofit order or manually close order
 Post subject: Takeprofit order or manually close order Post rating: 0   New post Posted: Sat 28 Aug, 2010, 19:01 

User rating: 0
Joined: Wed 04 Aug, 2010, 22:41
Posts: 4
During development I have used two different methods to close a position but I get different results.

Method 1. close a position using the system takeProfit defined when the position is opened
engine.submitOrder(label, instrument, orderCmd, amount, price, slippage, stop, takeProfit);

Method 2. close a position manually within the onTick() method (when certain price level is reached) using
this.order.close();


However even when I use the same takeprofit price level the positions are closed at different locations - see attached file showing the two methods and the close positions.


Attachments:
File comment: Screenshots of trades
pic1.jpg [227.8 KiB]
Downloaded 479 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.
 
 Post subject: Re: Takeprofit order or manually close order Post rating: 0   New post Posted: Mon 30 Aug, 2010, 09:06 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hello,
please specify, which offer side are you using.


 
 Post subject: Re: Takeprofit order or manually close order Post rating: 0   New post Posted: Mon 30 Aug, 2010, 11:03 

User rating: 0
Joined: Wed 04 Aug, 2010, 22:41
Posts: 4
bid side


 
 Post subject: Re: Takeprofit order or manually close order Post rating: 0   New post Posted: Tue 31 Aug, 2010, 14:05 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Sell trades are opened by BID price and closed by ASK price. ASK is higher than BID on the chart. On your picture in the places where BID price reaches your level, order wasn't closed because ASK price didn't reach your level price. When you close orders in onTick you can control yourself what side BID or ASK to use.


 

Jump to:  

cron
  © 1998-2025 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