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.

Bar index by opened order
 Post subject: Bar index by opened order Post rating: 0   New post Posted: Tue 16 Sep, 2014, 16:19 
User avatar

User rating: 0
Joined: Sun 09 Mar, 2014, 23:09
Posts: 4
Location: Latvia, Riga
Hello!

I need to get volumes of the bar on which order was opened after some time.
How it possible to realize?

I can get bar volumes by providing shift:
         IBar bar;
         bar = history.getBar(Symbol, Period, orderCmd, shift); 
         result=bar.getVolume(); 

And I can get order ID by label.

Help me plz to create a function which returns bar volumes for bar on which order was opened providing just order label and period.

Thank You


 
 Post subject: Re: Bar index by opened order Post rating: 0   New post Posted: Wed 17 Sep, 2014, 08:02 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Try something like this:
long time = history.getBarStart(Period.ONE_MIN, order.getCreationTime());
List<IBar> bar = history.getBars(order.getInstrument(), Period.ONE_MIN, OfferSide.BID, Filter.NO_FILTER, 1, time, 0);


 

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