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.

Inconsistence between tester messages and real messages
 Post subject: Inconsistence between tester messages and real messages Post rating: 0   New post Posted: Thu 26 Aug, 2010, 12:51 

User rating: 0
Joined: Wed 18 May, 2011, 11:25
Posts: 60
Location: DE
Hi,

i wondered why the tester made so many trades with my strategy (and he should do many trades),
but when i start the strategy on demo account, only 1 trade will start and nothing more.

the problem is the inconsistence of the IMessage's and thats terrible.

when using the tester, you can use message.getContent().contains("Order closed") to find out, that
an order was closed and reset variables etc. but with running strategy on demo, this message will
never appear. instead of, the message will look like:
Order FILLED at 1.26935 USD (#47103447 BUY 0.98104 mil. EUR/USD @ MKT) - Position #9864059

when i have a look at the state of this order: order.getState=FILLED, but the order should be "CLOSED"

similiar scenario when open an position:
message.getType=ORDER_SUBMIT_OK
order.getState=OPENED
Order FILLED at 1.2688 USD (#47103683 BUY 0.01 mil. EUR/USD @ MKT) - Position #9864196
message.getContent=null
message.getType=ORDER_FILL_OK
order.getState=FILLED

i think this is confusing, when i open an order, the state should be "open" until it will be closed, then the
state should be "closed". when state is "FILLED" i don't know if i opened or closed a trade.

which messages should i use to make sure to find all open and close messages to make my strategy running
on demo/real account like with the tester?


 
 Post subject: Re: Inconsistence between tester messages and real messages Post rating: 0   New post Posted: Mon 30 Aug, 2010, 09:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Tom299 wrote:
when using the tester, you can use message.getContent().contains("Order closed") to find out, that
an order was closed and reset variables etc. but with running strategy on demo, this message will
never appear. instead of, the message will look like:
Order FILLED at 1.26935 USD (#47103447 BUY 0.98104 mil. EUR/USD @ MKT) - Position #9864059

Do not use message.getContent(), use message.getType() == IMessage.Type.ORDER_CLOSE_OK instead
Tom299 wrote:
when i have a look at the state of this order: order.getState=FILLED, but the order should be "CLOSED"

It is possible when order is partially closed.
Tom299 wrote:
i think this is confusing, when i open an order, the state should be "open" until it will be closed, then the
state should be "closed". when state is "FILLED" i don't know if i opened or closed a trad

Order changes it's status from CREATED to OPENED when server sends back a responce about accepted order. For market orders it lasts only few seconds, for limit orders this status will be untill condition is reached. After money are bought or sold, order becomes FILLED. After you close the order it becomes CLOSED
Tom299 wrote:
which messages should i use to make sure to find all open and close messages to make my strategy running
on demo/real account like with the tester?

You should use IMessage.getType() to check what kind of message it is.


 

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