public class Strategy extends MT4
| Modifier and Type | Class and Description |
|---|---|
class |
Strategy.Instrument |
class |
Strategy.Terminal
An additional Terminal using Strategy's credentials to connect to mt4 broker in parallel.
|
static class |
Strategy.TerminalType
Enumeration of additional strategy terminal workers.
|
static interface |
Strategy.TickListener
Tick events handler interface.
|
static interface |
Strategy.TimerListener |
| Modifier and Type | Field and Description |
|---|---|
ArrayList<String> |
groups |
HashMap<String,ArrayList<String>> |
groupsMap |
ArrayList<Strategy.Instrument> |
instruments |
static int |
MT4_CONNECTION_WAIT_SECONDS |
static String |
SPCH |
ArrayList<String> |
srv |
ArrayList<String> |
symbols |
| Constructor and Description |
|---|
Strategy() |
| Modifier and Type | Method and Description |
|---|---|
Strategy.Terminal |
addTerminal(Strategy.TerminalType type)
Creates another terminal instance integrated with this strategy object.
|
Strategy.Terminal |
addTerminal(Strategy.TimerListener lsnr,
int timerIntervalMillis)
Creates another terminal instance and registers timer event handler for it.
|
Strategy.Terminal |
addTerminal(String symbol,
Strategy.TickListener lsnr)
Creates another terminal instance to get specified symbol's ticks in real-time.
|
Strategy |
addTickListener(String symbol,
Strategy.TickListener tickListener)
Adds TickListener to the strategy.
|
void |
close()
Kills MT4 Client Terminal with timeout (JFX_TERM_IDLE_TMOUT_SECONDS env.
|
void |
close(boolean immediately)
Kills MT4 Client Terminal
|
void |
connect(String termServerHost,
int termServerPort,
Broker mt4Server,
String mt4User,
String mt4Password) |
void |
connect(String termServerHost,
int termServerPort,
Broker mt4Server,
String mt4User,
String mt4Password,
boolean asynchOrderOperations) |
void |
connect(String termServerHost,
int termServerPort,
Broker mt4Server,
String mt4User,
String mt4Password,
String symbol) |
void |
connect(String termServerHost,
int termServerPort,
Broker mt4Server,
String mt4User,
String mt4Password,
String symbol,
boolean asynchOrderOperations) |
void |
coordinate() |
long |
coordinationIntervalMillis() |
void |
deinit() |
void |
disconnect()
Disconnects from MT4 Client Terminal.
|
ArrayList<Strategy.Instrument> |
getInstruments()
Provides list of all available on MT4 Terminal instruments.
|
Broker |
getMt4Server() |
String |
getMt4User() |
Timeframe |
getNextTimeframe(Timeframe tf) |
int |
getPeriod() |
Timeframe |
getPrevTimeframe(Timeframe tf) |
int |
getSlippage() |
static Strategy |
getStrategy(String id) |
String |
getSymbol() |
ArrayList<String> |
getSymbols()
Provides list of all available on MT4 Terminal instruments.
|
String |
getTermServerHost() |
int |
getTermServerPort() |
Timeframe |
getTimeframe() |
Version |
getVersion()
Returns NJ4X API version registry, i.e.
|
void |
init(String symbol,
int period,
StrategyRunner strategyRunner) |
boolean |
isAlive() |
boolean |
isLimitedFunctionality() |
boolean |
isReconnect() |
boolean |
isTickListenerStrategy() |
static Strategy |
removeStrategy(String id) |
void |
setMt4Password(String mt4Password) |
void |
setMt4Server(Broker mt4Server) |
void |
setMt4User(String mt4User) |
Strategy |
setPositionListener(PositionListener lsnr)
Installs user defined PositionListener for the strategy.
|
Strategy |
setPositionListener(PositionListener lsnr,
int minDelayMillis,
int maxDelayMillis)
Installs user defined PositionListener for the strategy.
|
void |
setReconnect(boolean reconnect) |
void |
setTermServerHost(String termServerHost) |
void |
setTermServerPort(int termServerPort) |
Strategy |
setTimerListener(Strategy.TimerListener lsnr,
int intervalMillis)
Installs user defined TimerListener for the strategy.
|
void |
setTimeZoneCorrectionOffset(long timeZoneCorrectionOffset) |
Strategy |
withDedicatedInstrumentOrdersWorker(String _symbol)
Installs Orders-worker chart for the strategy.
|
Strategy |
withJfxServerHost(String jfxServerHost) |
accountBalance, accountCompany, accountCredit, accountCurrency, accountEquity, accountFreeMargin, accountFreeMarginCheck, accountFreeMarginMode, accountLeverage, accountMargin, accountName, accountNumber, accountProfit, accountServer, accountStopoutLevel, accountStopoutMode, alert, comment, day, dayOfWeek, dayOfYear, fromDate, getLastError, getStrategyRunner, getTickCount, globalVariableCheck, globalVariableDel, globalVariableGet, globalVariableName, globalVariablesDeleteAll, globalVariableSet, globalVariableSetOnCondition, globalVariablesTotal, hideTestIndicators, hour, iAC, iAD, iADX, iAlligator, iAO, iATR, iBands, iBars, iBarShift, iBearsPower, iBullsPower, iBWMFI, iCCI, iClose, iCustom, iCustom, iCustom, iCustom, iDeMarker, iEnvelopes, iForce, iFractals, iGator, iHigh, iHighest, iIchimoku, iLow, iLowest, iMA, iMACD, iMFI, iMomentum, iOBV, iOpen, iOsMA, iRSI, iRVI, iSAR, isConnected, isConnectedToTerminal, IsConnectedToTerminal, isDemo, isDllsAllowed, isExpertEnabled, isLibrariesAllowed, isOptimization, isStopped, iStdDev, isTesting, iStochastic, isTradeAllowed, isTradeContextBusy, isVisualMode, iTime, iVolume, iWPR, marketInfo_MODE_TIME, marketInfo, marketInfo, messageBox, minute, month, newPosition, newTick, objectCreate, objectCreate, objectCreate, objectDelete, objectDescription, objectFind, objectGet, objectGetFiboDescription, objectGetShiftByValue, objectGetValueByShift, objectMove, objectName, objectsDeleteAll, objectSet, objectSetFiboDescription, objectSetText, objectsTotal, objectType, orderClose, orderCloseBy, orderClosePrice, orderCloseTime, orderComment, orderCommission, orderDelete, orderExpiration, orderGet, orderLots, orderMagicNumber, orderModify, orderOpenPrice, orderOpenTime, orderPrint, orderProfit, orderSelect, orderSend, ordersHistoryTotal, orderStopLoss, ordersTotal, orderSwap, orderSymbol, orderTakeProfit, orderTicket, orderType, period, playSound, print, refreshRates, seconds, setAutoRefreshRates, setOrdersProcessingChannel, setStrategyRunner, symbol, terminalCompany, terminalName, terminalPath, timeCurrent, toDate, uninitializeReason, windowBarsPerChart, windowExpertName, windowFind, windowFirstVisibleBar, windowHandle, windowIsVisible, windowOnDropped, windowPriceMax, windowPriceMin, windowPriceOnDropped, windowRedraw, windowScreenShot, windowsTotal, windowTimeOnDropped, windowXOnDropped, windowYOnDropped, yearpublic static final int MT4_CONNECTION_WAIT_SECONDS
public static final String SPCH
public ArrayList<Strategy.Instrument> instruments
public Version getVersion()
public boolean isLimitedFunctionality()
public boolean isAlive()
public String getSymbol()
public int getPeriod()
public Timeframe getTimeframe()
public int getSlippage()
public ArrayList<String> getSymbols()
public ArrayList<Strategy.Instrument> getInstruments()
public void init(String symbol, int period, StrategyRunner strategyRunner) throws ErrUnknownSymbol, IOException
ErrUnknownSymbolIOExceptionpublic void setTimeZoneCorrectionOffset(long timeZoneCorrectionOffset)
public boolean isReconnect()
public void setReconnect(boolean reconnect)
public void deinit()
public void setTermServerHost(String termServerHost)
public void setTermServerPort(int termServerPort)
public void setMt4Server(Broker mt4Server)
public void setMt4User(String mt4User)
public void setMt4Password(String mt4Password)
public long coordinationIntervalMillis()
public void coordinate()
public void disconnect()
throws IOException
IOException - in case of Terminal Server is unreachablepublic void close()
throws IOException
IOException - in case of Terminal Server is unreachablepublic void close(boolean immediately)
throws IOException
immediately - pass true if immediate mt4 terminal process termination is required, otherwise JFX_TERM_IDLE_TMOUT_SECONDS env. variable will be used by MT4 terminal to exit at idle timeout.IOException - in case of Terminal Server is unreachablepublic void connect(String termServerHost, int termServerPort, Broker mt4Server, String mt4User, String mt4Password) throws IOException
IOExceptionpublic void connect(String termServerHost, int termServerPort, Broker mt4Server, String mt4User, String mt4Password, String symbol) throws IOException
IOExceptionpublic void connect(String termServerHost, int termServerPort, Broker mt4Server, String mt4User, String mt4Password, boolean asynchOrderOperations) throws IOException
IOExceptionpublic Strategy addTickListener(String symbol, Strategy.TickListener tickListener)
symbol - symbol to listen for the ticks oftickListener - ticks listenerpublic Strategy setPositionListener(PositionListener lsnr)
lsnr - user defined position listenerpublic Strategy setPositionListener(PositionListener lsnr, int minDelayMillis, int maxDelayMillis)
lsnr - user defined position listenerminDelayMillis - minimum new orders check interval millismaxDelayMillis - maximum new orders check interval millispublic Strategy setTimerListener(Strategy.TimerListener lsnr, int intervalMillis)
lsnr - user defined timer listenerintervalMillis - minimum new orders check interval millispublic Strategy withDedicatedInstrumentOrdersWorker(String _symbol)
public void connect(String termServerHost, int termServerPort, Broker mt4Server, String mt4User, String mt4Password, String symbol, boolean asynchOrderOperations) throws NJ4XInvalidUserNameOrPasswordException, NJ4XMaxNumberOfTerminalsExceededException, NJ4XNoConnectionToServerException, IOException
public String getTermServerHost()
public int getTermServerPort()
public Broker getMt4Server()
public String getMt4User()
public Strategy.Terminal addTerminal(String symbol, Strategy.TickListener lsnr)
symbol - symbol to subscribe ticks listener forlsnr - listener to process symbol's tick eventspublic Strategy.Terminal addTerminal(Strategy.TimerListener lsnr, int timerIntervalMillis)
lsnr - timer listener to perform regular mt4 account jobs under.public Strategy.Terminal addTerminal(Strategy.TerminalType type)
type - TerminalType.ORDERS_WORKER or TerminalType.FREE_WORKERpublic boolean isTickListenerStrategy()