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.

MQL 4/5 iTime analog
 Post subject: MQL 4/5 iTime analog Post rating: 0   New post Posted: Thu 11 Aug, 2011, 04:50 

User rating: 0
Joined: Sat 06 Aug, 2011, 23:17
Posts: 27
Location: Russian Federation,
Hellow eweryone!

In MQL have function iTime https://docs.mql4.com/series/itime

***
datetime iTime (string symbol, int timeframe, int shift)
Returns Time value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.
For the current chart, the information about bars open times is in the predefined array named Time[].
Parameters:
symbol      -      Symbol the data of which should be used to calculate indicator. NULL means the current symbol.
timeframe      -      Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
shift      -      Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Sample:

  Print("Current bar for USDCHF H1: ",iTime("USDCHF",PERIOD_H1,i),", ",  iOpen("USDCHF",PERIOD_H1,i),", ",
                                      iHigh("USDCHF",PERIOD_H1,i),", ",  iLow("USDCHF",PERIOD_H1,i),", ",
                                      iClose("USDCHF",PERIOD_H1,i),", ", iVolume("USDCHF",PERIOD_H1,i));


I need analog iTime function for JForex, for example getBarStart https://www.dukascopy.com/client/javadoc ... od,%20long)

Thanks for help!


 
 Post subject: Re: MQL 4/5 iTime analog Post rating: 0   New post Posted: Thu 11 Aug, 2011, 09:35 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Consider using getBar method:
IBar bar = getBar(instrument, period, OfferSide.BID, shift);
long time = bar.getTime();


 

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