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.

onTick: Calling actual Market price and Depth. Help, please.
 Post subject: onTick: Calling actual Market price and Depth. Help, please. Post rating: 0   New post Posted: Wed 23 May, 2018, 20:28 

User rating: 4
Joined: Wed 23 May, 2018, 20:08
Posts: 44
Location: FinlandFinland
Hello,

Can someone show me how to call total market depth for the newest BID & ASK tick, please? With tick.getAsk() I get totally unrelevant price, that is not actual. The tick.getAsk() also gives me ticks even if the market is not moving anywhere on the chart. Can someone please show me how I get the newest tick.getAsk() & tick.getBid and also the total bid and ask for current tick, please?

Super Thank you in advance!


 
 Post subject: Re: onTick: Calling actual Market price and Depth. Help, please. Post rating: 0   New post Posted: Thu 24 May, 2018, 15:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hello,

You can do it in this way:
    public void onTick(Instrument instrument, ITick tick) throws JFException {
        if (instrument != this.instrument) {
            return;
        }
        console.getOut().printf("Ask: %f, Bid: %f, ask volume: %f, bid volume: %f \n",
                tick.getAsk(), tick.getBid(), tick.getAskVolume(), tick.getBidVolume());             
    }


 

Jump to:  

  © 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