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.

Precise Take Profit per tick?
 Post subject: Precise Take Profit per tick? Post rating: 0   New post Posted: Tue 16 Jul, 2013, 08:51 

User rating: 1
Joined: Tue 18 Jun, 2013, 09:03
Posts: 14
Location: GermanyGermany
Hallo,
i have a question about the TakeProfit/StopLoss accuracy when submitting an Order with:

submitOrder(patternID, instrument, command, 0.01, 0, 0,history.getLastTick(instrument).getBid() - SL * instrument.getPipValue(), history.getLastTick(instrument).getBid() + TP * instrument.getPipValue()) ;

As illustrated in the picture, sometimes the Take Profit is missed although the a Tick would have validated the Filling.
(Small horizontal lines represent the Take Profit target - in the first case the StopLoss is hit, second shows proper behaviour)

Image

Would it increase the likelyhood to be properly executed if i manually check the ticks in onTick()?

Hope i made myself clear -

greetings and thanks in advance!


 
 Post subject: Re: Precise Take Profit per tick? Post rating: 0   New post Posted: Tue 16 Jul, 2013, 09:02 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
What do you mean by "missed"? In the given picture the take profit apparently was fired on the very candle which hit the price level that you have drawn on the chart.
Of course if you want to make sure for yourself that take profit works correctly, you can do this by double-checking the prices in the onTick.


 
 Post subject: Re: Precise Take Profit per tick? Post rating: 1   New post Posted: Tue 16 Jul, 2013, 12:34 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
For me the first order is closed on SL, and not on TP.
Why:
Although it seems that the candle's low is way below the TP level, there is no guarantee that the candle's high haven't reached the SL level sooner. And that is happened here (current price went above SL level before order could have been closed on TP).

There is no need to check current price against an order's TP and SL levels in the onTick() function to have properly executed TP and SL levels. If you submit an order with SL/TP (or add/modify them later), the system will close it at those levels.


 
 Post subject: Re: Precise Take Profit per tick? Post rating: 0   New post Posted: Tue 16 Jul, 2013, 12:44 

User rating: 1
Joined: Tue 18 Jun, 2013, 09:03
Posts: 14
Location: GermanyGermany
Thanks to both of you - i looked into the actual ticks and indeed for all the cases it simply was the case that the tick reaching the TP was later in time - (just a coincidence that this happened +20 times in a period of 1 month :? )

Answered -


 

Jump to:  

  © 1998-2026 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