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.

How to use IMessage.Reason
 Post subject: How to use IMessage.Reason Post rating: 0   New post Posted: Mon 17 Sep, 2012, 14:17 

User rating: 0
Joined: Mon 17 Sep, 2012, 14:05
Posts: 25
I'd like to check onMessage whether a position was closed by this reason: ORDER_CLOSED_BY_TP.

Thus far, I programmed this using the onMessage method:

public void onMessage(IMessage message) throws JFException {
...
Set reasons = message.getReasons();

if (reasons.contains(IMessage.Reason.ORDER_CLOSED_BY_TP)){
console.getOut().println("Reason is correct!");
}
...
}

Unfortunately, it doesn't work.

How do I check on the reason properly?

Please advise.

Thanks in advance.

Daniel


 
 Post subject: Re: How to use IMessage.Reason Post rating: 0   New post Posted: Mon 17 Sep, 2012, 14:54 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See:
https://www.dukascopy.com/wiki/#Set_Stop_Loss_price/Detect_close_by_Stop_Loss


 
 Post subject: Re: How to use IMessage.Reason Post rating: 0   New post Posted: Thu 11 Oct, 2012, 08:26 

User rating: 0
Joined: Mon 17 Sep, 2012, 14:05
Posts: 25
If anyone else has problems with this, I solved it with this here:

if (message.getReasons().contains(IMessage.Reason.ORDER_CLOSED_BY_TP))

In the onMessage method, part: switch(message.getType()), case ORDER_CLOSE_OK :


 

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