com.jfx
Class MT4

java.lang.Object
  extended by com.jfx.MT4
Direct Known Subclasses:
Strategy

public class MT4
extends java.lang.Object


Constructor Summary
MT4()
           
 
Method Summary
 double accountBalance()
          Returns balance value of the current account (the amount of money on the account).
 java.lang.String accountCompany()
          Returns the brokerage company name where the current account was registered.
 double accountCredit()
          Returns credit value of the current account.
 java.lang.String accountCurrency()
          Returns currency name of the current account.
 double accountEquity()
          Returns equity value of the current account.
 double accountFreeMargin()
          Returns free margin value of the current account.
 double accountMargin()
          Returns margin value of the current account.
 java.lang.String accountName()
          Returns the current account name.
 int accountNumber()
          Returns the number of the current account
 double accountProfit()
          Returns profit value of the current account.
 int accountStopoutLevel()
          Returns the value of the Stop Out level.
 int accountStopoutMode()
          Returns the calculation mode for the Stop Out level.
 void comment(java.lang.String comments)
          The function outputs the comment defined by the user in the left top corner of the chart.
 int day()
          Returns the current day of the month, i.e., the day of month of the last known server time.
 int dayOfWeek()
          Returns the current zero-based day of the week (0-Sunday,1,2,3,4,5,6) of the last known server time.
 int dayOfYear()
          Returns the current day of the year (1 means 1 January,..,365(6) does 31 December), i.e., the day of year of the last known server time.
 int getLastError()
          The function returns the last occurred error, then the value of special last_error variable where the last error code is stored will be zeroized.
 StrategyRunner getStrategyRunner()
           
 int getTickCount()
          The GetTickCount() function retrieves the number of milliseconds that have elapsed since the system was started.
 int hour()
          Returns the hour (0,1,2,..23) of the last known server time by the moment of the program start (this value will not change within the time of the program execution).
 double iAC(java.lang.String symbol, Timeframe timeframe, int shift)
          Calculates the Bill Williams' Accelerator/Decelerator oscillator.
 double iAD(java.lang.String symbol, Timeframe timeframe, int shift)
          Calculates the Accumulation/Distribution indicator and returns its value.
 double iADX(java.lang.String symbol, Timeframe timeframe, int period, AppliedPrice appliedPrice, ADXIndicatorLines mode, int shift)
          Calculates the Movement directional index and returns its value.
 double iAlligator(java.lang.String symbol, Timeframe timeframe, int jawPeriod, int jawShift, int teethPeriod, int teethShift, int lipsPeriod, int lipsShift, MovingAverageMethod maMethod, AppliedPrice appliedPrice, GatorMode mode, int shift)
          Calculates the Bill Williams' Alligator and returns its value.
 double iAO(java.lang.String symbol, Timeframe timeframe, int shift)
          Calculates the Bill Williams' Awesome oscillator and returns its value.
 double iATR(java.lang.String symbol, Timeframe timeframe, int period, int shift)
          Calculates the Indicator of the average true range and returns its value.
 double iBands(java.lang.String symbol, Timeframe timeframe, int period, int deviation, int bandsShift, AppliedPrice appliedPrice, BandsIndicatorLines mode, int shift)
          Calculates the Movement directional index and returns its value.
 int iBars(java.lang.String symbol, Timeframe timeframe)
          Returns the number of bars on the specified chart.
 int iBarShift(java.lang.String symbol, Timeframe timeframe, java.util.Date time, boolean exact)
          Search for bar by open time.
 double iBearsPower(java.lang.String symbol, Timeframe timeframe, int period, AppliedPrice appliedPrice, int shift)
          Calculates the Bears Power indicator and returns its value.
 double iBullsPower(java.lang.String symbol, Timeframe timeframe, int period, AppliedPrice appliedPrice, int shift)
          Calculates the Bulls Power indicator and returns its value.
 double iBWMFI(java.lang.String symbol, Timeframe timeframe, int shift)
          Calculates the Bill Williams Market Facilitation index and returns its value.
 double iCCI(java.lang.String symbol, Timeframe timeframe, int period, AppliedPrice appliedPrice, int shift)
          Calculates the Commodity channel index and returns its value.
 double iClose(java.lang.String symbol, Timeframe timeframe, int shift)
          Returns Close value for the bar of indicated symbol with timeframe and shift.
 double iCustom(java.lang.String symbol, Timeframe timeframe, java.lang.String name, int mode, int shift)
          Calculates the specified custom indicator and returns its value.
 double iDeMarker(java.lang.String symbol, Timeframe timeframe, int period, int shift)
          Calculates the DeMarker indicator and returns its value.
 double iEnvelopes(java.lang.String symbol, Timeframe timeframe, int maPeriod, MovingAverageMethod maMethod, int maShitf, AppliedPrice appliedPrice, double deviation, BandsIndicatorLines mode, int shift)
          Calculates the Envelopes indicator and returns its value.
 double iForce(java.lang.String symbol, Timeframe timeframe, int period, MovingAverageMethod maMethod, AppliedPrice appliedPrice, int shift)
          Calculates the Force index and returns its value.
 double iFractals(java.lang.String symbol, Timeframe timeframe, BandsIndicatorLines mode, int shift)
          Calculates the Fractals and returns its value.
 double iGator(java.lang.String symbol, Timeframe timeframe, int jawPeriod, int jawShift, int teethPeriod, int teethShift, int lipsPeriod, int lipsShift, MovingAverageMethod maMethod, AppliedPrice appliedPrice, GatorMode mode, int shift)
          Gator oscillator calculation.
 double iHigh(java.lang.String symbol, Timeframe timeframe, int shift)
          Returns High value for the bar of indicated symbol with timeframe and shift.
 int iHighest(java.lang.String symbol, Timeframe timeframe, Series type, int count, int start)
          Returns the shift of the maximum value over a specific number of periods depending on type.
 double iLow(java.lang.String symbol, Timeframe timeframe, int shift)
          Returns Low value for the bar of indicated symbol with timeframe and shift.
 int iLowest(java.lang.String symbol, Timeframe timeframe, Series type, int count, int start)
          Returns the shift of the least value over a specific number of periods depending on type.
 double iMA(java.lang.String symbol, Timeframe timeframe, int period, int maShift, MovingAverageMethod maMethod, AppliedPrice appliedPrice, int shift)
          Calculates the Moving average indicator and returns its value.
 double iMACD(java.lang.String symbol, Timeframe timeframe, int fastEMAPeriod, int slowEMAPeriod, int signalPeriod, AppliedPrice appliedPrice, MACDIndicatorLines mode, int shift)
          Calculates the Moving averages convergence/divergence and returns its value.
 double iMFI(java.lang.String symbol, Timeframe timeframe, int period, int shift)
          Calculates the Money flow index and returns its value.
 double iMomentum(java.lang.String symbol, Timeframe timeframe, int period, AppliedPrice appliedPrice, int shift)
          Calculates the Momentum indicator and returns its value.
 double iOBV(java.lang.String symbol, Timeframe timeframe, AppliedPrice appliedPrice, int shift)
          Calculates the On Balance Volume indicator and returns its value.
 double iOpen(java.lang.String symbol, Timeframe timeframe, int shift)
          Returns Open value for the bar of indicated symbol with timeframe and shift.
 double iOsMA(java.lang.String symbol, Timeframe timeframe, int fastEMAPeriod, int slowEMAPeriod, int signalPeriod, AppliedPrice appliedPrice, int shift)
          Calculates the Moving Average of Oscillator and returns its value.
 double iRSI(java.lang.String symbol, Timeframe timeframe, int period, AppliedPrice appliedPrice, int shift)
          Calculates the Relative strength index and returns its value.
 double iRVI(java.lang.String symbol, Timeframe timeframe, int period, MACDIndicatorLines mode, int shift)
          Calculates the Relative Vigor index and returns its value.
 double iSAR(java.lang.String symbol, Timeframe timeframe, double step, double maximum, int shift)
          Calculates the Parabolic Stop and Reverse system and returns its value.
 boolean isConnected()
          The function returns the status of the main connection between client terminal and server that performs data pumping.
 boolean isDemo()
          Returns TRUE if the expert runs on a demo account, otherwise returns FALSE.
 double iStdDev(java.lang.String symbol, Timeframe timeframe, int maPeriod, int maShift, MovingAverageMethod maMethod, AppliedPrice appliedPrice, int shift)
          Calculates the Standard Deviation indicator and returns its value.
 boolean isTesting()
          Returns TRUE if expert runs in the testing mode, otherwise returns FALSE.
 double iStochastic(java.lang.String symbol, Timeframe timeframe, int kPeriod, int dPeriod, int slowing, MovingAverageMethod maMethod, int priceField, MACDIndicatorLines mode, int shift)
          Calculates the Stochastic oscillator and returns its value.
 boolean isTradeContextBusy()
          Returns TRUE if a thread for trading is occupied by another expert advisor, otherwise returns FALSE.
 boolean isVisualMode()
          Returns TRUE if the expert is tested with checked 'Visual Mode' button, otherwise returns FALSE.
 java.util.Date iTime(java.lang.String symbol, Timeframe timeframe, int shift)
          Returns Time value for the bar of indicated symbol with timeframe and shift.
 double iVolume(java.lang.String symbol, Timeframe timeframe, int shift)
          Returns Tick Volume value for the bar of indicated symbol with timeframe and shift.
 double iWPR(java.lang.String symbol, Timeframe timeframe, int period, int shift)
          Calculates the Larry William's percent range indicator and returns its value.
 double marketInfo(java.lang.String symbol, MarketInfo type)
           
 int minute()
          Returns the current minute (0,1,2,..59) of the last known server time by the moment of the program start (this value will not change within the time of the program execution).
 int month()
          Returns the current month as number (1-January,2,3,4,5,6,7,8,9,10,11,12), i.e., the number of month of the last known server time.
 boolean objectCreate(java.lang.String name, ObjectType type, int window, java.util.Date time1, double price1)
          Creation of an object with the specified name, type and initial coordinates in the specified window.
 boolean objectCreate(java.lang.String name, ObjectType type, int window, java.util.Date time1, double price1, java.util.Date time2, double price2)
          Creation of an object with the specified name, type and initial coordinates in the specified window.
 boolean objectCreate(java.lang.String name, ObjectType type, int window, java.util.Date time1, double price1, java.util.Date time2, double price2, java.util.Date time3, double price3)
          Creation of an object with the specified name, type and initial coordinates in the specified window.
 boolean objectDelete(java.lang.String name)
          Deletes object having the specified name.
 double objectGet(java.lang.String name, ObjectProperty index)
          The function returns the value of the specified object property.
 java.lang.String objectGetFiboDescription(java.lang.String name, int index)
          The function returns the level description of a Fibonacci object.
 boolean objectSet(java.lang.String name, ObjectProperty index, double value)
          Changes the value of the specified object property.
 boolean objectSetFiboDescription(java.lang.String name, int index, java.lang.String text)
          The function assigns a new description to a level of a Fibonacci object.
 boolean objectSetText(java.lang.String name, java.lang.String text, int font_size, java.lang.String font, long text_color)
          Changes the object description.
 int objectsTotal(ObjectType type)
          Returns total amount of objects of the specified type in the chart.
 int objectType(java.lang.String name)
          The function returns the object type value.
 boolean orderClose(int ticket, double lots, double price, int slippage, long arrowColor)
          Closes opened order.
 boolean orderCloseBy(int ticket, int opposite, long arrowColor)
          Closes an opened order by another opposite opened order.
 double orderClosePrice()
          Returns close price for the currently selected order.
 java.util.Date orderCloseTime()
          Returns close time for the currently selected order.
 java.lang.String orderComment()
          Returns comment for the selected order.
 double orderCommission()
          Returns calculated commission for the currently selected order.
 boolean orderDelete(int ticket, long arrowColor)
          Deletes previously opened pending order.
 double orderExpiration()
          Returns expiration date for the selected pending order.
 double orderLots()
          Returns amount of lots for the selected order.
 int orderMagicNumber()
          Returns an identifying (magic) number for the currently selected order.
 boolean orderModify(int ticket, double price, double stoploss, double takeprofit, java.util.Date expiration, long arrowColor)
          Modification of characteristics for the previously opened position or pending orders.
 double orderOpenPrice()
          Returns open price for the currently selected order.
 java.util.Date orderOpenTime()
          Returns open time for the currently selected order.
 void orderPrint()
          Prints information about the selected order in the log in the following format: ticket number; open time; trade operation; amount of lots; open price; Stop Loss; Take Profit; close time; close price; commission; swap; profit; comment; magic number; pending order expiration date.
 double orderProfit()
          Returns the net profit value (without swaps or commissions) for the selected order.
 boolean orderSelect(int index, SelectionType select, SelectionPool pool)
          The function selects an order for further processing.
 int orderSend(java.lang.String symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit, java.lang.String comment, int magic, java.util.Date expiration, long arrowColor)
          The main function used to open a position or place a pending order.
 int ordersHistoryTotal()
          Returns the number of closed orders in the account history loaded into the terminal.
 double orderStopLoss()
          Returns stop loss value for the currently selected order.
 int ordersTotal()
          Returns market and pending orders count.
 double orderSwap()
          Returns swap value for the currently selected order.
 java.lang.String orderSymbol()
          Returns the order symbol value for selected order.
 double orderTakeProfit()
          Returns take profit value for the currently selected order.
 int orderTicket()
          Returns ticket number for the currently selected order.
 int orderType()
          Returns order operation type for the currently selected order.
 void print(java.lang.String comments)
          Prints a message to the experts log
 boolean refreshRates()
          Refreshing of data in pre-defined variables and series arrays.
 int seconds()
          Returns the amount of seconds elapsed from the beginning of the current minute of the last known server time by the moment of the program start (this value will not change within the time of the program execution).
 void setOrdersProcessingChannel(StrategyRunner strategyRunner)
           
 void setStrategyRunner(StrategyRunner strategyRunner)
           
 java.util.Date timeCurrent()
          Returns the last known server time (time of incoming of the latest quote) as number of seconds elapsed from 00:00 January 1, 1970.
 int year()
          Returns the current year, i.e., the year of the last known server time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MT4

public MT4()
Method Detail

getStrategyRunner

public StrategyRunner getStrategyRunner()

setStrategyRunner

public void setStrategyRunner(StrategyRunner strategyRunner)

setOrdersProcessingChannel

public void setOrdersProcessingChannel(StrategyRunner strategyRunner)

iBars

public int iBars(java.lang.String symbol,
                 Timeframe timeframe)
          throws ErrHistoryWillUpdated,
                 ErrUnknownSymbol
Returns the number of bars on the specified chart. For the current chart, the information about the amount of bars is in the predefined variable named Bars.

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.
Returns:
Returns the number of bars on the specified chart. For the current chart, the information about the amount of bars is in the predefined variable named Bars.
Throws:
ErrHistoryWillUpdated
ErrUnknownSymbol

iBarShift

public int iBarShift(java.lang.String symbol,
                     Timeframe timeframe,
                     java.util.Date time,
                     boolean exact)
              throws ErrUnknownSymbol
Search for bar by open time. The function returns bar shift with the open time specified. If the bar having the specified open time is missing, the function will return -1 or the nearest bar shift depending on the exact.

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.
time - value to find (bar's open time).
exact - Return mode when bar not found. false - iBarShift returns nearest. true - iBarShift returns -1.
Returns:
Search for bar by open time. The function returns bar shift with the open time specified. If the bar having the specified open time is missing, the function will return -1 or the nearest bar shift depending on the exact.
Throws:
ErrUnknownSymbol

iClose

public double iClose(java.lang.String symbol,
                     Timeframe timeframe,
                     int shift)
              throws ErrHistoryWillUpdated,
                     ErrUnknownSymbol
Returns Close 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 close prices is in the predefined array named Close[].

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).
Returns:
Returns Close 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 close prices is in the predefined array named Close[].
Throws:
ErrHistoryWillUpdated
ErrUnknownSymbol

iHigh

public double iHigh(java.lang.String symbol,
                    Timeframe timeframe,
                    int shift)
             throws ErrHistoryWillUpdated,
                    ErrUnknownSymbol
Returns High 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 high prices is in the predefined array named High[].

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).
Returns:
Returns High 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 high prices is in the predefined array named High[].
Throws:
ErrHistoryWillUpdated
ErrUnknownSymbol

iLow

public double iLow(java.lang.String symbol,
                   Timeframe timeframe,
                   int shift)
            throws ErrHistoryWillUpdated,
                   ErrUnknownSymbol
Returns Low 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 low prices is in the predefined array named Low[].

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).
Returns:
Returns Low 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 low prices is in the predefined array named Low[].
Throws:
ErrHistoryWillUpdated
ErrUnknownSymbol

iOpen

public double iOpen(java.lang.String symbol,
                    Timeframe timeframe,
                    int shift)
             throws ErrHistoryWillUpdated,
                    ErrUnknownSymbol
Returns Open 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 open prices is in the predefined array named Open[].

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).
Returns:
Returns Open 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 open prices is in the predefined array named Open[].
Throws:
ErrHistoryWillUpdated
ErrUnknownSymbol

iVolume

public double iVolume(java.lang.String symbol,
                      Timeframe timeframe,
                      int shift)
               throws ErrHistoryWillUpdated,
                      ErrUnknownSymbol
Returns Tick Volume 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 tick volumes is in the predefined array named Volume[].

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).
Returns:
Returns Tick Volume 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 tick volumes is in the predefined array named Volume[].
Throws:
ErrHistoryWillUpdated
ErrUnknownSymbol

iTime

public java.util.Date iTime(java.lang.String symbol,
                            Timeframe timeframe,
                            int shift)
                     throws ErrHistoryWillUpdated,
                            ErrUnknownSymbol
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).
Returns:
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[].
Throws:
ErrHistoryWillUpdated
ErrUnknownSymbol

iLowest

public int iLowest(java.lang.String symbol,
                   Timeframe timeframe,
                   Series type,
                   int count,
                   int start)
            throws ErrIncorrectSeriesarrayUsing,
                   ErrHistoryWillUpdated,
                   ErrUnknownSymbol
Returns the shift of the least value over a specific number of periods depending on type.

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.
type - Series array identifier. It can be any of Series array identifier enumeration values.
count - Number of periods (in direction from the start bar to the back one) on which the calculation is carried out.
start - Shift showing the bar, relative to the current bar, that the data should be taken from.
Returns:
Returns the shift of the least value over a specific number of periods depending on type.
Throws:
ErrIncorrectSeriesarrayUsing
ErrHistoryWillUpdated
ErrUnknownSymbol

iHighest

public int iHighest(java.lang.String symbol,
                    Timeframe timeframe,
                    Series type,
                    int count,
                    int start)
             throws ErrIncorrectSeriesarrayUsing,
                    ErrHistoryWillUpdated,
                    ErrUnknownSymbol
Returns the shift of the maximum value over a specific number of periods depending on type.

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.
type - Series array identifier. It can be any of Series array identifier enumeration values.
count - Number of periods (in direction from the start bar to the back one) on which the calculation is carried out.
start - Shift showing the bar, relative to the current bar, that the data should be taken from.
Returns:
Returns the shift of the maximum value over a specific number of periods depending on type.
Throws:
ErrIncorrectSeriesarrayUsing
ErrHistoryWillUpdated
ErrUnknownSymbol

accountBalance

public double accountBalance()
Returns balance value of the current account (the amount of money on the account).

Returns:
Returns balance value of the current account (the amount of money on the account).

accountCredit

public double accountCredit()
Returns credit value of the current account.

Returns:
Returns credit value of the current account.

accountCompany

public java.lang.String accountCompany()
Returns the brokerage company name where the current account was registered.

Returns:
Returns the brokerage company name where the current account was registered.

accountCurrency

public java.lang.String accountCurrency()
Returns currency name of the current account.

Returns:
Returns currency name of the current account.

accountEquity

public double accountEquity()
Returns equity value of the current account. Equity calculation depends on trading server settings.

Returns:
Returns equity value of the current account. Equity calculation depends on trading server settings.

accountFreeMargin

public double accountFreeMargin()
Returns free margin value of the current account.

Returns:
Returns free margin value of the current account.

accountMargin

public double accountMargin()
Returns margin value of the current account.

Returns:
Returns margin value of the current account.

accountName

public java.lang.String accountName()
Returns the current account name.

Returns:
Returns the current account name.

accountNumber

public int accountNumber()
Returns the number of the current account

Returns:
Returns the number of the current account

accountProfit

public double accountProfit()
Returns profit value of the current account.

Returns:
Returns profit value of the current account.

getLastError

public int getLastError()
The function returns the last occurred error, then the value of special last_error variable where the last error code is stored will be zeroized. So, the next call for GetLastError() will return 0.

Returns:
The function returns the last occurred error, then the value of special last_error variable where the last error code is stored will be zeroized. So, the next call for GetLastError() will return 0.

isConnected

public boolean isConnected()
The function returns the status of the main connection between client terminal and server that performs data pumping. It returns TRUE if connection to the server was successfully established, otherwise, it returns FALSE.

Returns:
The function returns the status of the main connection between client terminal and server that performs data pumping. It returns TRUE if connection to the server was successfully established, otherwise, it returns FALSE.

isDemo

public boolean isDemo()
Returns TRUE if the expert runs on a demo account, otherwise returns FALSE.

Returns:
Returns TRUE if the expert runs on a demo account, otherwise returns FALSE.

isTesting

public boolean isTesting()
Returns TRUE if expert runs in the testing mode, otherwise returns FALSE.

Returns:
Returns TRUE if expert runs in the testing mode, otherwise returns FALSE.

isVisualMode

public boolean isVisualMode()
Returns TRUE if the expert is tested with checked 'Visual Mode' button, otherwise returns FALSE.

Returns:
Returns TRUE if the expert is tested with checked 'Visual Mode' button, otherwise returns FALSE.

getTickCount

public int getTickCount()
The GetTickCount() function retrieves the number of milliseconds that have elapsed since the system was started. It is limited to the resolution of the system timer.

Returns:
The GetTickCount() function retrieves the number of milliseconds that have elapsed since the system was started. It is limited to the resolution of the system timer.

comment

public void comment(java.lang.String comments)
The function outputs the comment defined by the user in the left top corner of the chart.

Parameters:
comments - User defined comment.

marketInfo

public double marketInfo(java.lang.String symbol,
                         MarketInfo type)
                  throws ErrUnknownSymbol
Parameters:
symbol -
type -
Returns:
Throws:
ErrUnknownSymbol

print

public void print(java.lang.String comments)
Prints a message to the experts log

Parameters:
comments - User defined message.

day

public int day()
Returns the current day of the month, i.e., the day of month of the last known server time. Note: At the testing, the last known server time is modelled.

Returns:
Returns the current day of the month, i.e., the day of month of the last known server time. Note: At the testing, the last known server time is modelled.

dayOfWeek

public int dayOfWeek()
Returns the current zero-based day of the week (0-Sunday,1,2,3,4,5,6) of the last known server time. Note: At the testing, the last known server time is modelled.

Returns:
Returns the current zero-based day of the week (0-Sunday,1,2,3,4,5,6) of the last known server time. Note: At the testing, the last known server time is modelled.

dayOfYear

public int dayOfYear()
Returns the current day of the year (1 means 1 January,..,365(6) does 31 December), i.e., the day of year of the last known server time. Note: At the testing, the last known server time is modelled.

Returns:
Returns the current day of the year (1 means 1 January,..,365(6) does 31 December), i.e., the day of year of the last known server time. Note: At the testing, the last known server time is modelled.

hour

public int hour()
Returns the hour (0,1,2,..23) of the last known server time by the moment of the program start (this value will not change within the time of the program execution). Note: At the testing, the last known server time is modelled.

Returns:
Returns the hour (0,1,2,..23) of the last known server time by the moment of the program start (this value will not change within the time of the program execution). Note: At the testing, the last known server time is modelled.

minute

public int minute()
Returns the current minute (0,1,2,..59) of the last known server time by the moment of the program start (this value will not change within the time of the program execution).

Returns:
Returns the current minute (0,1,2,..59) of the last known server time by the moment of the program start (this value will not change within the time of the program execution).

month

public int month()
Returns the current month as number (1-January,2,3,4,5,6,7,8,9,10,11,12), i.e., the number of month of the last known server time. Note: At the testing, the last known server time is modelled.

Returns:
Returns the current month as number (1-January,2,3,4,5,6,7,8,9,10,11,12), i.e., the number of month of the last known server time. Note: At the testing, the last known server time is modelled.

seconds

public int seconds()
Returns the amount of seconds elapsed from the beginning of the current minute of the last known server time by the moment of the program start (this value will not change within the time of the program execution).

Returns:
Returns the amount of seconds elapsed from the beginning of the current minute of the last known server time by the moment of the program start (this value will not change within the time of the program execution).

timeCurrent

public java.util.Date timeCurrent()
Returns the last known server time (time of incoming of the latest quote) as number of seconds elapsed from 00:00 January 1, 1970. Note: At the testing, the last known server time is modelled.

Returns:
Returns the last known server time (time of incoming of the latest quote) as number of seconds elapsed from 00:00 January 1, 1970. Note: At the testing, the last known server time is modelled.

year

public int year()
Returns the current year, i.e., the year of the last known server time. Note: At the testing, the last known server time is modelled.

Returns:
Returns the current year, i.e., the year of the last known server time. Note: At the testing, the last known server time is modelled.

objectCreate

public boolean objectCreate(java.lang.String name,
                            ObjectType type,
                            int window,
                            java.util.Date time1,
                            double price1,
                            java.util.Date time2,
                            double price2,
                            java.util.Date time3,
                            double price3)
Creation of an object with the specified name, type and initial coordinates in the specified window. Count of coordinates related to the object can be from 1 to 3 depending on the object type. If the function succeeds, the returned value will be TRUE. Otherwise, it will be FALSE. To get the detailed error information, one has to call the GetLastError() function. Objects of the OBJ_LABEL type ignore the coordinates. Use the function of ObjectSet() to set up the OBJPROP_XDISTANCE and OBJPROP_YDISTANCE properties. Notes: The chart sub-windows (if there are sub-windows with indicators in the chart) are numbered starting from 1. The chart main window always exists and has the 0 index. Coordinates must be passed in pairs: time and price. For example, the OBJ_VLINE object needs only time, but price (any value) must be passed, as well.

Parameters:
name - Object unique name.
type - Object type. It can be any of the Object type enumeration values.
window - Index of the window where the object will be added. Window index must exceed or equal to 0 and be less than WindowsTotal().
time1 - Time part of the first point.
price1 - Price part of the first point.
time2 - Time part of the second point.
price2 - Price part of the second point.
time3 - Time part of the third point.
price3 - Price part of the third point.
Returns:
Creation of an object with the specified name, type and initial coordinates in the specified window. Count of coordinates related to the object can be from 1 to 3 depending on the object type. If the function succeeds, the returned value will be TRUE. Otherwise, it will be FALSE. To get the detailed error information, one has to call the GetLastError() function. Objects of the OBJ_LABEL type ignore the coordinates. Use the function of ObjectSet() to set up the OBJPROP_XDISTANCE and OBJPROP_YDISTANCE properties. Notes: The chart sub-windows (if there are sub-windows with indicators in the chart) are numbered starting from 1. The chart main window always exists and has the 0 index. Coordinates must be passed in pairs: time and price. For example, the OBJ_VLINE object needs only time, but price (any value) must be passed, as well.

objectCreate

public boolean objectCreate(java.lang.String name,
                            ObjectType type,
                            int window,
                            java.util.Date time1,
                            double price1)
Creation of an object with the specified name, type and initial coordinates in the specified window. Count of coordinates related to the object can be from 1 to 3 depending on the object type. If the function succeeds, the returned value will be TRUE. Otherwise, it will be FALSE. To get the detailed error information, one has to call the GetLastError() function. Objects of the OBJ_LABEL type ignore the coordinates. Use the function of ObjectSet() to set up the OBJPROP_XDISTANCE and OBJPROP_YDISTANCE properties. Notes: The chart sub-windows (if there are sub-windows with indicators in the chart) are numbered starting from 1. The chart main window always exists and has the 0 index. Coordinates must be passed in pairs: time and price. For example, the OBJ_VLINE object needs only time, but price (any value) must be passed, as well.

Parameters:
name - Object unique name.
type - Object type. It can be any of the Object type enumeration values.
window - Index of the window where the object will be added. Window index must exceed or equal to 0 and be less than WindowsTotal().
time1 - Time part of the first point.
price1 - Price part of the first point.
Returns:
Creation of an object with the specified name, type and initial coordinates in the specified window. Count of coordinates related to the object can be from 1 to 3 depending on the object type. If the function succeeds, the returned value will be TRUE. Otherwise, it will be FALSE. To get the detailed error information, one has to call the GetLastError() function. Objects of the OBJ_LABEL type ignore the coordinates. Use the function of ObjectSet() to set up the OBJPROP_XDISTANCE and OBJPROP_YDISTANCE properties. Notes: The chart sub-windows (if there are sub-windows with indicators in the chart) are numbered starting from 1. The chart main window always exists and has the 0 index. Coordinates must be passed in pairs: time and price. For example, the OBJ_VLINE object needs only time, but price (any value) must be passed, as well.

objectCreate

public boolean objectCreate(java.lang.String name,
                            ObjectType type,
                            int window,
                            java.util.Date time1,
                            double price1,
                            java.util.Date time2,
                            double price2)
Creation of an object with the specified name, type and initial coordinates in the specified window. Count of coordinates related to the object can be from 1 to 3 depending on the object type. If the function succeeds, the returned value will be TRUE. Otherwise, it will be FALSE. To get the detailed error information, one has to call the GetLastError() function. Objects of the OBJ_LABEL type ignore the coordinates. Use the function of ObjectSet() to set up the OBJPROP_XDISTANCE and OBJPROP_YDISTANCE properties. Notes: The chart sub-windows (if there are sub-windows with indicators in the chart) are numbered starting from 1. The chart main window always exists and has the 0 index. Coordinates must be passed in pairs: time and price. For example, the OBJ_VLINE object needs only time, but price (any value) must be passed, as well.

Parameters:
name - Object unique name.
type - Object type. It can be any of the Object type enumeration values.
window - Index of the window where the object will be added. Window index must exceed or equal to 0 and be less than WindowsTotal().
time1 - Time part of the first point.
price1 - Price part of the first point.
time2 - Time part of the second point.
price2 - Price part of the second point.
Returns:
Creation of an object with the specified name, type and initial coordinates in the specified window. Count of coordinates related to the object can be from 1 to 3 depending on the object type. If the function succeeds, the returned value will be TRUE. Otherwise, it will be FALSE. To get the detailed error information, one has to call the GetLastError() function. Objects of the OBJ_LABEL type ignore the coordinates. Use the function of ObjectSet() to set up the OBJPROP_XDISTANCE and OBJPROP_YDISTANCE properties. Notes: The chart sub-windows (if there are sub-windows with indicators in the chart) are numbered starting from 1. The chart main window always exists and has the 0 index. Coordinates must be passed in pairs: time and price. For example, the OBJ_VLINE object needs only time, but price (any value) must be passed, as well.

objectDelete

public boolean objectDelete(java.lang.String name)
Deletes object having the specified name. If the function succeeds, the returned value will be TRUE. Otherwise, it will be FALSE. To get the detailed error information, one has to call the GetLastError() function.

Parameters:
name - Object unique name.
Returns:
Deletes object having the specified name. If the function succeeds, the returned value will be TRUE. Otherwise, it will be FALSE. To get the detailed error information, one has to call the GetLastError() function.

objectGet

public double objectGet(java.lang.String name,
                        ObjectProperty index)
The function returns the value of the specified object property. To check errors, one has to call the GetLastError() function. See also ObjectSet() function.

Parameters:
name - Object unique name.
index - Object property index. It can be any of the Object properties enumeration values.
Returns:
The function returns the value of the specified object property. To check errors, one has to call the GetLastError() function. See also ObjectSet() function.

objectSet

public boolean objectSet(java.lang.String name,
                         ObjectProperty index,
                         double value)
Changes the value of the specified object property. If the function succeeds, the returned value will be TRUE. Otherwise, it will be FALSE. To get the detailed error information, one has to call the GetLastError() function. See also ObjectGet() function.

Parameters:
name - Object unique name.
index - Object property index. It can be any of the Object properties enumeration values.
value - New value of the given property.
Returns:
Changes the value of the specified object property. If the function succeeds, the returned value will be TRUE. Otherwise, it will be FALSE. To get the detailed error information, one has to call the GetLastError() function. See also ObjectGet() function.

objectGetFiboDescription

public java.lang.String objectGetFiboDescription(java.lang.String name,
                                                 int index)
The function returns the level description of a Fibonacci object. The amount of Fibonacci levels depends on the object type. The maximum amount of Fibonacci levels is 32. To get the detailed error information, one has to call the GetLastError() function. See also ObjectSetFiboDescription() function.

Parameters:
name - Object unique name.
index - Index of the Fibonacci level (0-31).
Returns:
The function returns the level description of a Fibonacci object. The amount of Fibonacci levels depends on the object type. The maximum amount of Fibonacci levels is 32. To get the detailed error information, one has to call the GetLastError() function. See also ObjectSetFiboDescription() function.

objectSetFiboDescription

public boolean objectSetFiboDescription(java.lang.String name,
                                        int index,
                                        java.lang.String text)
The function assigns a new description to a level of a Fibonacci object. The amount of Fibonacci levels depends on the object type. The maximum amount of Fibonacci levels is 32. To get the detailed error information, one has to call the GetLastError() function.

Parameters:
name - Object unique name.
index - Index of the Fibonacci level (0-31).
text - New description of the level.
Returns:
The function assigns a new description to a level of a Fibonacci object. The amount of Fibonacci levels depends on the object type. The maximum amount of Fibonacci levels is 32. To get the detailed error information, one has to call the GetLastError() function.

objectSetText

public boolean objectSetText(java.lang.String name,
                             java.lang.String text,
                             int font_size,
                             java.lang.String font,
                             long text_color)
Changes the object description. For objects of OBJ_TEXT and OBJ_LABEL, this description is shown as a text line in the chart. If the function succeeds, the returned value will be TRUE. Otherwise, it is FALSE. To get the detailed error information, one has to call the GetLastError() function. Parameters of font_size, font_name and text_color are used for objects of OBJ_TEXT and OBJ_LABEL only. For objects of other types, these parameters are ignored. See also ObjectDescription() function.

Parameters:
name - Object unique name.
text - A text describing the object.
font_size - Font size in points.
font - Font name (NULL).
text_color - Text color (CLR_NONE).
Returns:
Changes the object description. For objects of OBJ_TEXT and OBJ_LABEL, this description is shown as a text line in the chart. If the function succeeds, the returned value will be TRUE. Otherwise, it is FALSE. To get the detailed error information, one has to call the GetLastError() function. Parameters of font_size, font_name and text_color are used for objects of OBJ_TEXT and OBJ_LABEL only. For objects of other types, these parameters are ignored. See also ObjectDescription() function.

objectsTotal

public int objectsTotal(ObjectType type)
Returns total amount of objects of the specified type in the chart.

Parameters:
type - Optional parameter. An object type to be counted. It can be any of the Object type enumeration values or EMPTY constant to count all objects with any types.
Returns:
Returns total amount of objects of the specified type in the chart.

objectType

public int objectType(java.lang.String name)
The function returns the object type value. To get the detailed error information, one has to call the GetLastError() function.

Parameters:
name - Object unique name.
Returns:
The function returns the object type value. To get the detailed error information, one has to call the GetLastError() function.

iAC

public double iAC(java.lang.String symbol,
                  Timeframe timeframe,
                  int shift)
           throws ErrUnknownSymbol
Calculates the Bill Williams' Accelerator/Decelerator oscillator.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. 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).
Returns:
Calculates the Bill Williams' Accelerator/Decelerator oscillator.
Throws:
ErrUnknownSymbol

iAD

public double iAD(java.lang.String symbol,
                  Timeframe timeframe,
                  int shift)
           throws ErrUnknownSymbol
Calculates the Accumulation/Distribution indicator and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. 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).
Returns:
Calculates the Accumulation/Distribution indicator and returns its value.
Throws:
ErrUnknownSymbol

iAlligator

public double iAlligator(java.lang.String symbol,
                         Timeframe timeframe,
                         int jawPeriod,
                         int jawShift,
                         int teethPeriod,
                         int teethShift,
                         int lipsPeriod,
                         int lipsShift,
                         MovingAverageMethod maMethod,
                         AppliedPrice appliedPrice,
                         GatorMode mode,
                         int shift)
                  throws ErrUnknownSymbol
Calculates the Bill Williams' Alligator and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
jawPeriod - Blue line averaging period (Alligator's Jaw).
jawShift - Blue line shift relative to the chart.
teethPeriod - Red line averaging period (Alligator's Teeth).
teethShift - Red line shift relative to the chart.
lipsPeriod - Green line averaging period (Alligator's Lips).
lipsShift - Green line shift relative to the chart.
maMethod - MA method. It can be any of Moving Average methods.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
mode - Data source, identifier of a line of the indicator. It can be any of the following values: MODE_GATORJAW - Gator Jaw (blue) balance line, MODE_GATORTEETH - Gator Teeth (red) balance line, MODE_GATORLIPS - Gator Lips (green) balance line.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Bill Williams' Alligator and returns its value.
Throws:
ErrUnknownSymbol

iADX

public double iADX(java.lang.String symbol,
                   Timeframe timeframe,
                   int period,
                   AppliedPrice appliedPrice,
                   ADXIndicatorLines mode,
                   int shift)
            throws ErrUnknownSymbol
Calculates the Movement directional index and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Averaging period for calculation.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
mode - Indicator line index. It can be any of the Indicators line identifiers enumeration value.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Movement directional index and returns its value.
Throws:
ErrUnknownSymbol

iATR

public double iATR(java.lang.String symbol,
                   Timeframe timeframe,
                   int period,
                   int shift)
            throws ErrUnknownSymbol
Calculates the Indicator of the average true range and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Averaging period for calculation.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Indicator of the average true range and returns its value.
Throws:
ErrUnknownSymbol

iAO

public double iAO(java.lang.String symbol,
                  Timeframe timeframe,
                  int shift)
           throws ErrUnknownSymbol
Calculates the Bill Williams' Awesome oscillator and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. 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).
Returns:
Calculates the Bill Williams' Awesome oscillator and returns its value.
Throws:
ErrUnknownSymbol

iBearsPower

public double iBearsPower(java.lang.String symbol,
                          Timeframe timeframe,
                          int period,
                          AppliedPrice appliedPrice,
                          int shift)
                   throws ErrUnknownSymbol
Calculates the Bears Power indicator and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Averaging period for calculation.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Bears Power indicator and returns its value.
Throws:
ErrUnknownSymbol

iBands

public double iBands(java.lang.String symbol,
                     Timeframe timeframe,
                     int period,
                     int deviation,
                     int bandsShift,
                     AppliedPrice appliedPrice,
                     BandsIndicatorLines mode,
                     int shift)
              throws ErrUnknownSymbol
Calculates the Movement directional index and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Averaging period for calculation.
deviation - Deviation from the main line.
bandsShift - The indicator shift relative to the chart.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
mode - Indicator line index. It can be any of the Indicators line identifiers enumeration value.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Movement directional index and returns its value.
Throws:
ErrUnknownSymbol

iBullsPower

public double iBullsPower(java.lang.String symbol,
                          Timeframe timeframe,
                          int period,
                          AppliedPrice appliedPrice,
                          int shift)
                   throws ErrUnknownSymbol
Calculates the Bulls Power indicator and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Averaging period for calculation.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Bulls Power indicator and returns its value.
Throws:
ErrUnknownSymbol

iCCI

public double iCCI(java.lang.String symbol,
                   Timeframe timeframe,
                   int period,
                   AppliedPrice appliedPrice,
                   int shift)
            throws ErrUnknownSymbol
Calculates the Commodity channel index and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Averaging period for calculation.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Commodity channel index and returns its value.
Throws:
ErrUnknownSymbol

iCustom

public double iCustom(java.lang.String symbol,
                      Timeframe timeframe,
                      java.lang.String name,
                      int mode,
                      int shift)
               throws ErrUnknownSymbol
Calculates the specified custom indicator and returns its value. The custom indicator must be compiled (*.EX4 file) and be in the terminal_directory/experts/indicators directory.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
name - Custom indicator compiled program name.
mode - Line index. Can be from 0 to 7 and must correspond with the index used by one of SetIndexBuffer functions.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the specified custom indicator and returns its value. The custom indicator must be compiled (*.EX4 file) and be in the terminal_directory/experts/indicators directory.
Throws:
ErrUnknownSymbol

iDeMarker

public double iDeMarker(java.lang.String symbol,
                        Timeframe timeframe,
                        int period,
                        int shift)
                 throws ErrUnknownSymbol
Calculates the DeMarker indicator and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Averaging period for calculation.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the DeMarker indicator and returns its value.
Throws:
ErrUnknownSymbol

iEnvelopes

public double iEnvelopes(java.lang.String symbol,
                         Timeframe timeframe,
                         int maPeriod,
                         MovingAverageMethod maMethod,
                         int maShitf,
                         AppliedPrice appliedPrice,
                         double deviation,
                         BandsIndicatorLines mode,
                         int shift)
                  throws ErrUnknownSymbol
Calculates the Envelopes indicator and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
maPeriod - Averaging period for calculation of the main line.
maMethod - MA method. It can be any of Moving Average methods.
maShitf - MA shift. Indicator line offset relate to the chart by timeframe.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
deviation - Percent deviation from the main line.
mode - Indicator line index. It can be any of the Indicators line identifiers enumeration value.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Envelopes indicator and returns its value.
Throws:
ErrUnknownSymbol

iForce

public double iForce(java.lang.String symbol,
                     Timeframe timeframe,
                     int period,
                     MovingAverageMethod maMethod,
                     AppliedPrice appliedPrice,
                     int shift)
              throws ErrUnknownSymbol
Calculates the Force index and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Averaging period for calculation.
maMethod - MA method. It can be any of Moving Average methods.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Force index and returns its value.
Throws:
ErrUnknownSymbol

iFractals

public double iFractals(java.lang.String symbol,
                        Timeframe timeframe,
                        BandsIndicatorLines mode,
                        int shift)
                 throws ErrUnknownSymbol
Calculates the Fractals and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
mode - Indicator line index. It can be any of the Indicators line identifiers enumeration value.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Fractals and returns its value.
Throws:
ErrUnknownSymbol

iGator

public double iGator(java.lang.String symbol,
                     Timeframe timeframe,
                     int jawPeriod,
                     int jawShift,
                     int teethPeriod,
                     int teethShift,
                     int lipsPeriod,
                     int lipsShift,
                     MovingAverageMethod maMethod,
                     AppliedPrice appliedPrice,
                     GatorMode mode,
                     int shift)
              throws ErrUnknownSymbol
Gator oscillator calculation. The oscillator displays the difference between the Alligator red and blue lines (the upper histogram) and that between red and green lines (the lower histogram).

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
jawPeriod - Blue line averaging period (Alligator's Jaw).
jawShift - Blue line shift relative to the chart.
teethPeriod - Red line averaging period (Alligator's Teeth).
teethShift - Red line shift relative to the chart.
lipsPeriod - Green line averaging period (Alligator's Lips).
lipsShift - Green line shift relative to the chart.
maMethod - MA method. It can be any of Moving Average methods.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
mode - Data source, identifier of a line of the indicator. It can be any of the following values: MODE_GATORJAW - Gator Jaw (blue) balance line, MODE_GATORTEETH - Gator Teeth (red) balance line, MODE_GATORLIPS - Gator Lips (green) balance line.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Gator oscillator calculation. The oscillator displays the difference between the Alligator red and blue lines (the upper histogram) and that between red and green lines (the lower histogram).
Throws:
ErrUnknownSymbol

iBWMFI

public double iBWMFI(java.lang.String symbol,
                     Timeframe timeframe,
                     int shift)
              throws ErrUnknownSymbol
Calculates the Bill Williams Market Facilitation index and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. 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).
Returns:
Calculates the Bill Williams Market Facilitation index and returns its value.
Throws:
ErrUnknownSymbol

iMomentum

public double iMomentum(java.lang.String symbol,
                        Timeframe timeframe,
                        int period,
                        AppliedPrice appliedPrice,
                        int shift)
                 throws ErrUnknownSymbol
Calculates the Momentum indicator and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Averaging period for calculation.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Momentum indicator and returns its value.
Throws:
ErrUnknownSymbol

iMFI

public double iMFI(java.lang.String symbol,
                   Timeframe timeframe,
                   int period,
                   int shift)
            throws ErrUnknownSymbol
Calculates the Money flow index and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Averaging period for calculation.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Money flow index and returns its value.
Throws:
ErrUnknownSymbol

iMA

public double iMA(java.lang.String symbol,
                  Timeframe timeframe,
                  int period,
                  int maShift,
                  MovingAverageMethod maMethod,
                  AppliedPrice appliedPrice,
                  int shift)
           throws ErrUnknownSymbol
Calculates the Moving average indicator and returns its value.

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.
period - Averaging period for calculation.
maShift - MA shift. Indicators line offset relate to the chart by timeframe.
maMethod - MA method. It can be any of the Moving Average method enumeration value.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Moving average indicator and returns its value.
Throws:
ErrUnknownSymbol

iOsMA

public double iOsMA(java.lang.String symbol,
                    Timeframe timeframe,
                    int fastEMAPeriod,
                    int slowEMAPeriod,
                    int signalPeriod,
                    AppliedPrice appliedPrice,
                    int shift)
             throws ErrUnknownSymbol
Calculates the Moving Average of Oscillator and returns its value. Sometimes called MACD Histogram in some systems.

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.
fastEMAPeriod - Number of periods for fast moving average calculation.
slowEMAPeriod - Number of periods for slow moving average calculation.
signalPeriod - Number of periods for signal moving average calculation.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Moving Average of Oscillator and returns its value. Sometimes called MACD Histogram in some systems.
Throws:
ErrUnknownSymbol

iMACD

public double iMACD(java.lang.String symbol,
                    Timeframe timeframe,
                    int fastEMAPeriod,
                    int slowEMAPeriod,
                    int signalPeriod,
                    AppliedPrice appliedPrice,
                    MACDIndicatorLines mode,
                    int shift)
             throws ErrUnknownSymbol
Calculates the Moving averages convergence/divergence and returns its value. In the systems where OsMA is called MACD Histogram, this indicator is displayed as two lines. In the Client Terminal, the Moving Average Convergence/Divergence is drawn as a histogram.

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.
fastEMAPeriod - Number of periods for fast moving average calculation.
slowEMAPeriod - Number of periods for slow moving average calculation.
signalPeriod - Number of periods for signal moving average calculation.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
mode - Indicator line index. It can be any of the Indicators line identifiers enumeration value.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Moving averages convergence/divergence and returns its value. In the systems where OsMA is called MACD Histogram, this indicator is displayed as two lines. In the Client Terminal, the Moving Average Convergence/Divergence is drawn as a histogram.
Throws:
ErrUnknownSymbol

iOBV

public double iOBV(java.lang.String symbol,
                   Timeframe timeframe,
                   AppliedPrice appliedPrice,
                   int shift)
            throws ErrUnknownSymbol
Calculates the On Balance Volume indicator and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the On Balance Volume indicator and returns its value.
Throws:
ErrUnknownSymbol

iSAR

public double iSAR(java.lang.String symbol,
                   Timeframe timeframe,
                   double step,
                   double maximum,
                   int shift)
            throws ErrUnknownSymbol
Calculates the Parabolic Stop and Reverse system and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
step - Increment, usually 0.02.
maximum - Maximum value, usually 0.2.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Parabolic Stop and Reverse system and returns its value.
Throws:
ErrUnknownSymbol

iRSI

public double iRSI(java.lang.String symbol,
                   Timeframe timeframe,
                   int period,
                   AppliedPrice appliedPrice,
                   int shift)
            throws ErrUnknownSymbol
Calculates the Relative strength index and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Number of periods for calculation.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Relative strength index and returns its value.
Throws:
ErrUnknownSymbol

iRVI

public double iRVI(java.lang.String symbol,
                   Timeframe timeframe,
                   int period,
                   MACDIndicatorLines mode,
                   int shift)
            throws ErrUnknownSymbol
Calculates the Relative Vigor index and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Number of periods for calculation.
mode - Indicator line index. It can be any of the Indicators line identifiers enumeration value.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Relative Vigor index and returns its value.
Throws:
ErrUnknownSymbol

iStdDev

public double iStdDev(java.lang.String symbol,
                      Timeframe timeframe,
                      int maPeriod,
                      int maShift,
                      MovingAverageMethod maMethod,
                      AppliedPrice appliedPrice,
                      int shift)
               throws ErrUnknownSymbol
Calculates the Standard Deviation indicator and returns its value.

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.
maPeriod - MA period
maShift - MA shift. Indicators line offset relate to the chart by timeframe.
maMethod - MA method. It can be any of the Moving Average method enumeration value.
appliedPrice - Applied price. It can be any of Applied price enumeration values.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Standard Deviation indicator and returns its value.
Throws:
ErrUnknownSymbol

iStochastic

public double iStochastic(java.lang.String symbol,
                          Timeframe timeframe,
                          int kPeriod,
                          int dPeriod,
                          int slowing,
                          MovingAverageMethod maMethod,
                          int priceField,
                          MACDIndicatorLines mode,
                          int shift)
                   throws ErrUnknownSymbol
Calculates the Stochastic oscillator and returns its value.

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.
kPeriod - %K line period.
dPeriod - %D line period.
slowing - Slowing value.
maMethod - MA method. It can be any of the Moving Average method enumeration value.
priceField - Price field parameter. Can be one of this values: 0 - Low/High or 1 - Close/Close.
mode - Indicator line index. It can be any of the Indicators line identifiers enumeration value.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Stochastic oscillator and returns its value.
Throws:
ErrUnknownSymbol

iWPR

public double iWPR(java.lang.String symbol,
                   Timeframe timeframe,
                   int period,
                   int shift)
            throws ErrUnknownSymbol
Calculates the Larry William's percent range indicator and returns its value.

Parameters:
symbol - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Averaging period for calculation.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Returns:
Calculates the Larry William's percent range indicator and returns its value.
Throws:
ErrUnknownSymbol

orderClose

public boolean orderClose(int ticket,
                          double lots,
                          double price,
                          int slippage,
                          long arrowColor)
                   throws ErrCustomIndicatorError,
                          ErrIntegerParameterExpected,
                          ErrInvalidFunctionParamvalue,
                          ErrInvalidPriceParam,
                          ErrInvalidTicket,
                          ErrUnknownSymbol,
                          ErrTradeNotAllowed,
                          ErrCommonError,
                          ErrInvalidTradeParameters,
                          ErrServerBusy,
                          ErrOldVersion,
                          ErrNoConnection,
                          ErrTooFrequentRequests,
                          ErrAccountDisabled,
                          ErrInvalidAccount,
                          ErrTradeTimeout,
                          ErrInvalidPrice,
                          ErrInvalidStops,
                          ErrInvalidTradeVolume,
                          ErrMarketClosed,
                          ErrTradeDisabled,
                          ErrNotEnoughMoney,
                          ErrPriceChanged,
                          ErrOffQuotes,
                          ErrRequote,
                          ErrOrderLocked,
                          ErrLongPositionsOnlyAllowed,
                          ErrTooManyRequests,
                          ErrTradeTimeout2,
                          ErrTradeTimeout3,
                          ErrTradeTimeout4,
                          ErrTradeModifyDenied,
                          ErrTradeContextBusy,
                          ErrTradeExpirationDenied,
                          ErrTradeTooManyOrders
Closes opened order. If the function succeeds, the return value is true. If the function fails, the return value is false. To get the detailed error information, call GetLastError().

Parameters:
ticket - Unique number of the order ticket.
lots - Number of lots.
price - Preferred closing price.
slippage - Value of the maximum price slippage in points.
arrowColor - Color of the closing arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart.
Returns:
Closes opened order. If the function succeeds, the return value is true. If the function fails, the return value is false. To get the detailed error information, call GetLastError().
Throws:
ErrCustomIndicatorError
ErrIntegerParameterExpected
ErrInvalidFunctionParamvalue
ErrInvalidPriceParam
ErrInvalidTicket
ErrUnknownSymbol
ErrTradeNotAllowed
ErrCommonError
ErrInvalidTradeParameters
ErrServerBusy
ErrOldVersion
ErrNoConnection
ErrTooFrequentRequests
ErrAccountDisabled
ErrInvalidAccount
ErrTradeTimeout
ErrInvalidPrice
ErrInvalidStops
ErrInvalidTradeVolume
ErrMarketClosed
ErrTradeDisabled
ErrNotEnoughMoney
ErrPriceChanged
ErrOffQuotes
ErrRequote
ErrOrderLocked
ErrLongPositionsOnlyAllowed
ErrTooManyRequests
ErrTradeTimeout2
ErrTradeTimeout3
ErrTradeTimeout4
ErrTradeModifyDenied
ErrTradeContextBusy
ErrTradeExpirationDenied
ErrTradeTooManyOrders

orderCloseBy

public boolean orderCloseBy(int ticket,
                            int opposite,
                            long arrowColor)
                     throws ErrCustomIndicatorError,
                            ErrIntegerParameterExpected,
                            ErrInvalidFunctionParamvalue,
                            ErrInvalidTicket,
                            ErrUnknownSymbol,
                            ErrTradeNotAllowed,
                            ErrCommonError,
                            ErrInvalidTradeParameters,
                            ErrServerBusy,
                            ErrOldVersion,
                            ErrNoConnection,
                            ErrTooFrequentRequests,
                            ErrAccountDisabled,
                            ErrInvalidAccount,
                            ErrTradeTimeout,
                            ErrInvalidPrice,
                            ErrInvalidStops,
                            ErrInvalidTradeVolume,
                            ErrMarketClosed,
                            ErrTradeDisabled,
                            ErrNotEnoughMoney,
                            ErrPriceChanged,
                            ErrOffQuotes,
                            ErrRequote,
                            ErrOrderLocked,
                            ErrLongPositionsOnlyAllowed,
                            ErrTooManyRequests,
                            ErrTradeTimeout2,
                            ErrTradeTimeout3,
                            ErrTradeTimeout4,
                            ErrTradeModifyDenied,
                            ErrTradeContextBusy,
                            ErrTradeExpirationDenied,
                            ErrTradeTooManyOrders
Closes an opened order by another opposite opened order. If the function succeeds, the return value is true. If the function fails, the return value is false. To get the detailed error information, call GetLastError().

Parameters:
ticket - Unique number of the order ticket.
opposite - Unique number of the opposite order ticket.
arrowColor - Color of the closing arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart.
Returns:
Closes an opened order by another opposite opened order. If the function succeeds, the return value is true. If the function fails, the return value is false. To get the detailed error information, call GetLastError().
Throws:
ErrCustomIndicatorError
ErrIntegerParameterExpected
ErrInvalidFunctionParamvalue
ErrInvalidTicket
ErrUnknownSymbol
ErrTradeNotAllowed
ErrCommonError
ErrInvalidTradeParameters
ErrServerBusy
ErrOldVersion
ErrNoConnection
ErrTooFrequentRequests
ErrAccountDisabled
ErrInvalidAccount
ErrTradeTimeout
ErrInvalidPrice
ErrInvalidStops
ErrInvalidTradeVolume
ErrMarketClosed
ErrTradeDisabled
ErrNotEnoughMoney
ErrPriceChanged
ErrOffQuotes
ErrRequote
ErrOrderLocked
ErrLongPositionsOnlyAllowed
ErrTooManyRequests
ErrTradeTimeout2
ErrTradeTimeout3
ErrTradeTimeout4
ErrTradeModifyDenied
ErrTradeContextBusy
ErrTradeExpirationDenied
ErrTradeTooManyOrders

orderClosePrice

public double orderClosePrice()
                       throws ErrNoOrderSelected
Returns close price for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns close price for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderCloseTime

public java.util.Date orderCloseTime()
                              throws ErrNoOrderSelected
Returns close time for the currently selected order. If order close time is not 0 then the order selected and has been closed and retrieved from the account history. Open and pending orders close time is equal to 0. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns close time for the currently selected order. If order close time is not 0 then the order selected and has been closed and retrieved from the account history. Open and pending orders close time is equal to 0. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderComment

public java.lang.String orderComment()
                              throws ErrNoOrderSelected
Returns comment for the selected order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns comment for the selected order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderCommission

public double orderCommission()
                       throws ErrNoOrderSelected
Returns calculated commission for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns calculated commission for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderDelete

public boolean orderDelete(int ticket,
                           long arrowColor)
                    throws ErrCustomIndicatorError,
                           ErrInvalidFunctionParamvalue,
                           ErrInvalidTicket,
                           ErrUnknownSymbol,
                           ErrTradeNotAllowed,
                           ErrCommonError,
                           ErrInvalidTradeParameters,
                           ErrServerBusy,
                           ErrOldVersion,
                           ErrNoConnection,
                           ErrTooFrequentRequests,
                           ErrAccountDisabled,
                           ErrInvalidAccount,
                           ErrTradeTimeout,
                           ErrInvalidPrice,
                           ErrInvalidStops,
                           ErrInvalidTradeVolume,
                           ErrMarketClosed,
                           ErrTradeDisabled,
                           ErrNotEnoughMoney,
                           ErrPriceChanged,
                           ErrOffQuotes,
                           ErrRequote,
                           ErrOrderLocked,
                           ErrLongPositionsOnlyAllowed,
                           ErrTooManyRequests,
                           ErrTradeTimeout2,
                           ErrTradeTimeout3,
                           ErrTradeTimeout4,
                           ErrTradeModifyDenied,
                           ErrTradeContextBusy,
                           ErrTradeExpirationDenied,
                           ErrTradeTooManyOrders
Deletes previously opened pending order. If the function succeeds, the return value is true. If the function fails, the return value is false. To get the detailed error information, call GetLastError().

Parameters:
ticket - Unique number of the order ticket.
arrowColor - Color of the arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart.
Returns:
Deletes previously opened pending order. If the function succeeds, the return value is true. If the function fails, the return value is false. To get the detailed error information, call GetLastError().
Throws:
ErrCustomIndicatorError
ErrInvalidFunctionParamvalue
ErrInvalidTicket
ErrUnknownSymbol
ErrTradeNotAllowed
ErrCommonError
ErrInvalidTradeParameters
ErrServerBusy
ErrOldVersion
ErrNoConnection
ErrTooFrequentRequests
ErrAccountDisabled
ErrInvalidAccount
ErrTradeTimeout
ErrInvalidPrice
ErrInvalidStops
ErrInvalidTradeVolume
ErrMarketClosed
ErrTradeDisabled
ErrNotEnoughMoney
ErrPriceChanged
ErrOffQuotes
ErrRequote
ErrOrderLocked
ErrLongPositionsOnlyAllowed
ErrTooManyRequests
ErrTradeTimeout2
ErrTradeTimeout3
ErrTradeTimeout4
ErrTradeModifyDenied
ErrTradeContextBusy
ErrTradeExpirationDenied
ErrTradeTooManyOrders

orderExpiration

public double orderExpiration()
                       throws ErrNoOrderSelected
Returns expiration date for the selected pending order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns expiration date for the selected pending order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderLots

public double orderLots()
                 throws ErrNoOrderSelected
Returns amount of lots for the selected order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns amount of lots for the selected order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderMagicNumber

public int orderMagicNumber()
                     throws ErrNoOrderSelected
Returns an identifying (magic) number for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns an identifying (magic) number for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderModify

public boolean orderModify(int ticket,
                           double price,
                           double stoploss,
                           double takeprofit,
                           java.util.Date expiration,
                           long arrowColor)
                    throws ErrCustomIndicatorError,
                           ErrIntegerParameterExpected,
                           ErrInvalidFunctionParamvalue,
                           ErrInvalidPriceParam,
                           ErrInvalidTicket,
                           ErrUnknownSymbol,
                           ErrTradeNotAllowed,
                           ErrNoResult,
                           ErrCommonError,
                           ErrInvalidTradeParameters,
                           ErrServerBusy,
                           ErrOldVersion,
                           ErrNoConnection,
                           ErrTooFrequentRequests,
                           ErrAccountDisabled,
                           ErrInvalidAccount,
                           ErrTradeTimeout,
                           ErrInvalidPrice,
                           ErrInvalidStops,
                           ErrInvalidTradeVolume,
                           ErrMarketClosed,
                           ErrTradeDisabled,
                           ErrNotEnoughMoney,
                           ErrPriceChanged,
                           ErrOffQuotes,
                           ErrRequote,
                           ErrOrderLocked,
                           ErrLongPositionsOnlyAllowed,
                           ErrTooManyRequests,
                           ErrTradeTimeout2,
                           ErrTradeTimeout3,
                           ErrTradeTimeout4,
                           ErrTradeModifyDenied,
                           ErrTradeContextBusy,
                           ErrTradeExpirationDenied,
                           ErrTradeTooManyOrders
Modification of characteristics for the previously opened position or pending orders. If the function succeeds, the returned value will be TRUE. If the function fails, the returned value will be FALSE. To get the detailed error information, call GetLastError() function. Notes: Open price and expiration time can be changed only for pending orders. If unchanged values are passed as the function parameters, the error 1 (ERR_NO_RESULT) will be generated. Pending order expiration time can be disabled in some trade servers. In this case, when a non-zero value is specified in the expiration parameter, the error 147 (ERR_TRADE_EXPIRATION_DENIED) will be generated.

Parameters:
ticket - Unique number of the order ticket.
price - New open price of the pending order.
stoploss - New StopLoss level.
takeprofit - New TakeProfit level.
expiration - Pending order expiration time.
arrowColor - Color of the arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart.
Returns:
Modification of characteristics for the previously opened position or pending orders. If the function succeeds, the returned value will be TRUE. If the function fails, the returned value will be FALSE. To get the detailed error information, call GetLastError() function. Notes: Open price and expiration time can be changed only for pending orders. If unchanged values are passed as the function parameters, the error 1 (ERR_NO_RESULT) will be generated. Pending order expiration time can be disabled in some trade servers. In this case, when a non-zero value is specified in the expiration parameter, the error 147 (ERR_TRADE_EXPIRATION_DENIED) will be generated.
Throws:
ErrCustomIndicatorError
ErrIntegerParameterExpected
ErrInvalidFunctionParamvalue
ErrInvalidPriceParam
ErrInvalidTicket
ErrUnknownSymbol
ErrTradeNotAllowed
ErrNoResult
ErrCommonError
ErrInvalidTradeParameters
ErrServerBusy
ErrOldVersion
ErrNoConnection
ErrTooFrequentRequests
ErrAccountDisabled
ErrInvalidAccount
ErrTradeTimeout
ErrInvalidPrice
ErrInvalidStops
ErrInvalidTradeVolume
ErrMarketClosed
ErrTradeDisabled
ErrNotEnoughMoney
ErrPriceChanged
ErrOffQuotes
ErrRequote
ErrOrderLocked
ErrLongPositionsOnlyAllowed
ErrTooManyRequests
ErrTradeTimeout2
ErrTradeTimeout3
ErrTradeTimeout4
ErrTradeModifyDenied
ErrTradeContextBusy
ErrTradeExpirationDenied
ErrTradeTooManyOrders

orderOpenPrice

public double orderOpenPrice()
                      throws ErrNoOrderSelected
Returns open price for the currently selected order. Order must be first selected by the OrderSelect() function.

Returns:
Returns open price for the currently selected order. Order must be first selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderOpenTime

public java.util.Date orderOpenTime()
                             throws ErrNoOrderSelected
Returns open time for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns open time for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderPrint

public void orderPrint()
                throws ErrNoOrderSelected
Prints information about the selected order in the log in the following format: ticket number; open time; trade operation; amount of lots; open price; Stop Loss; Take Profit; close time; close price; commission; swap; profit; comment; magic number; pending order expiration date. Order must be selected by the OrderSelect() function.

Throws:
ErrNoOrderSelected

orderProfit

public double orderProfit()
                   throws ErrNoOrderSelected
Returns the net profit value (without swaps or commissions) for the selected order. For open positions, it is the current unrealized profit. For closed orders, it is the fixed profit. Returns profit for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns the net profit value (without swaps or commissions) for the selected order. For open positions, it is the current unrealized profit. For closed orders, it is the fixed profit. Returns profit for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderSelect

public boolean orderSelect(int index,
                           SelectionType select,
                           SelectionPool pool)
The function selects an order for further processing. It returns TRUE if the function succeeds. It returns FALSE if the function fails. To get the error information, one has to call the GetLastError() function. The pool parameter is ignored if the order is selected by the ticket number. The ticket number is a unique order identifier. To find out from what list the order has been selected, its close time must be analyzed. If the order close time equals to 0, the order is open or pending and taken from the terminal open positions list. One can distinguish an open position from a pending order by the order type. If the order close time does not equal to 0, the order is a closed order or a deleted pending order and was selected from the terminal history. They also differ from each other by their order types.

Parameters:
index - Order index or order ticket depending on the second parameter.
select - Selecting flags. It can be any of the following values: SELECT_BY_POS - index in the order pool, SELECT_BY_TICKET - index is order ticket.
pool - Optional order pool index. Used when the selected parameter is SELECT_BY_POS. It can be any of the following values: MODE_TRADES (default)- order selected from trading pool(opened and pending orders), MODE_HISTORY - order selected from history pool (closed and canceled order).
Returns:
The function selects an order for further processing. It returns TRUE if the function succeeds. It returns FALSE if the function fails. To get the error information, one has to call the GetLastError() function. The pool parameter is ignored if the order is selected by the ticket number. The ticket number is a unique order identifier. To find out from what list the order has been selected, its close time must be analyzed. If the order close time equals to 0, the order is open or pending and taken from the terminal open positions list. One can distinguish an open position from a pending order by the order type. If the order close time does not equal to 0, the order is a closed order or a deleted pending order and was selected from the terminal history. They also differ from each other by their order types.

orderSend

public int orderSend(java.lang.String symbol,
                     TradeOperation cmd,
                     double volume,
                     double price,
                     int slippage,
                     double stoploss,
                     double takeprofit,
                     java.lang.String comment,
                     int magic,
                     java.util.Date expiration,
                     long arrowColor)
              throws ErrInvalidFunctionParamvalue,
                     ErrCustomIndicatorError,
                     ErrStringParameterExpected,
                     ErrIntegerParameterExpected,
                     ErrUnknownSymbol,
                     ErrInvalidPriceParam,
                     ErrTradeNotAllowed,
                     ErrLongsNotAllowed,
                     ErrShortsNotAllowed,
                     ErrCommonError,
                     ErrInvalidTradeParameters,
                     ErrServerBusy,
                     ErrOldVersion,
                     ErrNoConnection,
                     ErrTooFrequentRequests,
                     ErrAccountDisabled,
                     ErrInvalidAccount,
                     ErrTradeTimeout,
                     ErrInvalidPrice,
                     ErrInvalidStops,
                     ErrInvalidTradeVolume,
                     ErrMarketClosed,
                     ErrTradeDisabled,
                     ErrNotEnoughMoney,
                     ErrPriceChanged,
                     ErrOffQuotes,
                     ErrRequote,
                     ErrOrderLocked,
                     ErrLongPositionsOnlyAllowed,
                     ErrTooManyRequests,
                     ErrTradeTimeout2,
                     ErrTradeTimeout3,
                     ErrTradeTimeout4,
                     ErrTradeModifyDenied,
                     ErrTradeContextBusy,
                     ErrTradeExpirationDenied,
                     ErrTradeTooManyOrders
The main function used to open a position or place a pending order. Returns number of the ticket assigned to the order by the trade server or -1 if it fails. To get additional error information, one has to call the GetLastError() function. Notes: At opening of a market order (OP_SELL or OP_BUY), only the latest prices of Bid (for selling) or Ask (for buying) can be used as open price. If operation is performed with a security differing from the current one, the MarketInfo() function must be used with MODE_BID or MODE_ASK parameter for the latest quotes for this security to be obtained. Calculated or unnormalized price cannot be applied. If there has not been the requested open price in the price thread or it has not been normalized according to the amount of digits after decimal point, the error 129 (ERR_INVALID_PRICE) will be generated. If the requested open price is fully out of date, the error 138 (ERR_REQUOTE) will be generated independently on the slippage parameter. If the requested price is out of date, but present in the thread, the position will be opened at the current price and only if the current price lies within the range of price+-slippage. StopLoss and TakeProfit levels cannot be too close to the market. The minimal distance of stop levels in points can be obtained using the MarketInfo() function with MODE_STOPLEVEL parameter. In the case of erroneous or unnormalized stop levels, the error 130 (ERR_INVALID_STOPS) will be generated. At placing of a pending order, the open price cannot be too close to the market. The minimal distance of the pending price from the current market one in points can be obtained using the MarketInfo() function with the MODE_STOPLEVEL parameter. In case of false open price of a pending order, the error 130 (ERR_INVALID_STOPS) will be generated. Applying of pending order expiration time can be disabled in some trade servers. In this case, when a non-zero value is specified in the expiration parameter, the error 147 (ERR_TRADE_EXPIRATION_DENIED) will be generated. On some trade servers, the total amount of open and pending orders can be limited. If this limit has been exceeded, no new position will be opened (or no pending order will be placed) and trade server will return error 148 (ERR_TRADE_TOO_MANY_ORDERS).

Parameters:
symbol - Symbol for trading.
cmd - Operation type. It can be any of the Trade operation enumeration.
volume - Number of lots.
price - Preferred price of the trade.
slippage - Maximum price slippage for buy or sell orders in points.
stoploss - StopLoss level.
takeprofit - TakeProfit level.
comment - Order comment text. Last part of the comment may be changed by server.
magic - Order magic number. May be used as user defined identifier.
expiration - Order expiration time (for pending orders only).
arrowColor - Color of the arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart.
Returns:
The main function used to open a position or place a pending order. Returns number of the ticket assigned to the order by the trade server or -1 if it fails. To get additional error information, one has to call the GetLastError() function. Notes: At opening of a market order (OP_SELL or OP_BUY), only the latest prices of Bid (for selling) or Ask (for buying) can be used as open price. If operation is performed with a security differing from the current one, the MarketInfo() function must be used with MODE_BID or MODE_ASK parameter for the latest quotes for this security to be obtained. Calculated or unnormalized price cannot be applied. If there has not been the requested open price in the price thread or it has not been normalized according to the amount of digits after decimal point, the error 129 (ERR_INVALID_PRICE) will be generated. If the requested open price is fully out of date, the error 138 (ERR_REQUOTE) will be generated independently on the slippage parameter. If the requested price is out of date, but present in the thread, the position will be opened at the current price and only if the current price lies within the range of price+-slippage. StopLoss and TakeProfit levels cannot be too close to the market. The minimal distance of stop levels in points can be obtained using the MarketInfo() function with MODE_STOPLEVEL parameter. In the case of erroneous or unnormalized stop levels, the error 130 (ERR_INVALID_STOPS) will be generated. At placing of a pending order, the open price cannot be too close to the market. The minimal distance of the pending price from the current market one in points can be obtained using the MarketInfo() function with the MODE_STOPLEVEL parameter. In case of false open price of a pending order, the error 130 (ERR_INVALID_STOPS) will be generated. Applying of pending order expiration time can be disabled in some trade servers. In this case, when a non-zero value is specified in the expiration parameter, the error 147 (ERR_TRADE_EXPIRATION_DENIED) will be generated. On some trade servers, the total amount of open and pending orders can be limited. If this limit has been exceeded, no new position will be opened (or no pending order will be placed) and trade server will return error 148 (ERR_TRADE_TOO_MANY_ORDERS).
Throws:
ErrInvalidFunctionParamvalue
ErrCustomIndicatorError
ErrStringParameterExpected
ErrIntegerParameterExpected
ErrUnknownSymbol
ErrInvalidPriceParam
ErrTradeNotAllowed
ErrLongsNotAllowed
ErrShortsNotAllowed
ErrCommonError
ErrInvalidTradeParameters
ErrServerBusy
ErrOldVersion
ErrNoConnection
ErrTooFrequentRequests
ErrAccountDisabled
ErrInvalidAccount
ErrTradeTimeout
ErrInvalidPrice
ErrInvalidStops
ErrInvalidTradeVolume
ErrMarketClosed
ErrTradeDisabled
ErrNotEnoughMoney
ErrPriceChanged
ErrOffQuotes
ErrRequote
ErrOrderLocked
ErrLongPositionsOnlyAllowed
ErrTooManyRequests
ErrTradeTimeout2
ErrTradeTimeout3
ErrTradeTimeout4
ErrTradeModifyDenied
ErrTradeContextBusy
ErrTradeExpirationDenied
ErrTradeTooManyOrders

ordersHistoryTotal

public int ordersHistoryTotal()
Returns the number of closed orders in the account history loaded into the terminal. The history list size depends on the current settings of the Account history tab of the terminal.

Returns:
Returns the number of closed orders in the account history loaded into the terminal. The history list size depends on the current settings of the Account history tab of the terminal.

orderStopLoss

public double orderStopLoss()
                     throws ErrNoOrderSelected
Returns stop loss value for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns stop loss value for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

ordersTotal

public int ordersTotal()
Returns market and pending orders count.

Returns:
Returns market and pending orders count.

orderSwap

public double orderSwap()
                 throws ErrNoOrderSelected
Returns swap value for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns swap value for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderSymbol

public java.lang.String orderSymbol()
                             throws ErrNoOrderSelected
Returns the order symbol value for selected order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns the order symbol value for selected order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderTakeProfit

public double orderTakeProfit()
                       throws ErrNoOrderSelected
Returns take profit value for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns take profit value for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderTicket

public int orderTicket()
                throws ErrNoOrderSelected
Returns ticket number for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.

Returns:
Returns ticket number for the currently selected order. Note: The order must be previously selected by the OrderSelect() function.
Throws:
ErrNoOrderSelected

orderType

public int orderType()
              throws ErrNoOrderSelected
Returns order operation type for the currently selected order. It can be any of the following values: OP_BUY - buying position, OP_SELL - selling position, OP_BUYLIMIT - buy limit pending position, OP_BUYSTOP - buy stop pending position, OP_SELLLIMIT - sell limit pending position, OP_SELLSTOP - sell stop pending position. Note: order must be selected by OrderSelect() function.

Returns:
Returns order operation type for the currently selected order. It can be any of the following values: OP_BUY - buying position, OP_SELL - selling position, OP_BUYLIMIT - buy limit pending position, OP_BUYSTOP - buy stop pending position, OP_SELLLIMIT - sell limit pending position, OP_SELLSTOP - sell stop pending position. Note: order must be selected by OrderSelect() function.
Throws:
ErrNoOrderSelected

isTradeContextBusy

public boolean isTradeContextBusy()
Returns TRUE if a thread for trading is occupied by another expert advisor, otherwise returns FALSE.

Returns:
Returns TRUE if a thread for trading is occupied by another expert advisor, otherwise returns FALSE.

refreshRates

public boolean refreshRates()
Refreshing of data in pre-defined variables and series arrays. This function is used when expert advisor has been calculating for a long time and needs data refreshing. Returns TRUE if data are refreshed, otherwise returns FALSE. The only reason for data cannot be refreshed is that they are the current data of the client terminal. Experts and scripts operate with their own copy of history data. Data of the current symbol are copied at the first launch of the expert or script. At each subsequent launch of the expert (remember that script is executed only once and does not depend on incoming ticks), the initial copy will be updated. One or more new ticks can income while the expert or script is operating, and data can become out of date.

Returns:
Refreshing of data in pre-defined variables and series arrays. This function is used when expert advisor has been calculating for a long time and needs data refreshing. Returns TRUE if data are refreshed, otherwise returns FALSE. The only reason for data cannot be refreshed is that they are the current data of the client terminal. Experts and scripts operate with their own copy of history data. Data of the current symbol are copied at the first launch of the expert or script. At each subsequent launch of the expert (remember that script is executed only once and does not depend on incoming ticks), the initial copy will be updated. One or more new ticks can income while the expert or script is operating, and data can become out of date.

accountStopoutLevel

public int accountStopoutLevel()
Returns the value of the Stop Out level.

Returns:
Returns the value of the Stop Out level.

accountStopoutMode

public int accountStopoutMode()
Returns the calculation mode for the Stop Out level. Calculation mode can take the following values: 0 - calculation of percentage ratio between margin and equity; 1 - comparison of the free margin level to the absolute value.

Returns:
Returns the calculation mode for the Stop Out level. Calculation mode can take the following values: 0 - calculation of percentage ratio between margin and equity; 1 - comparison of the free margin level to the absolute value.


Copyright © 2008-2009 Roman Gerasimenko.