내가 개발한 MT4 Java API를 알려드리고 싶습니다.
MT4 JFX(터미널 Java API)는 MetaQuotes 거래 에 Java 인터페이스를 제공하기 위한 것입니다.
표준 MetaTrader 4 클라이언트 터미널(MT4 터미널)을 통해 서버.
표준 MetaTrader 4 클라이언트 터미널(MT4 터미널)을 통해 서버.
To make use of JFX API, one must create its own strategy java class, extending com.jfx.strategy.Strategy and overriding coordinate() method: public class MyStrategy extends com.jfx.strategy.Strategy { public void init(String symbol, int period, StrategyRunner strategyRunner) { super.init(symbol, period, strategyRunner); // // load existing orders, recover itself from the previous shutdown // } public void deinit() { // release resources on EA exit } public void coordinate() { // trading logic goes here /* make use of all API methods: accountBalance, accountCompany, accountCredit, accountCurrency, accountEquity, accountFreeMargin, accountMargin, accountName, accountNumber, accountProfit, comment, day, dayOfWeek, dayOfYear, getLastError, getTickCount, hour, iAC, iAD, iADX, iAlligator, iAO, iATR, iBands, iBars, iBarShift, iBearsPower, iBullsPower, iBWMFI, iCCI, iClose, iCustom, iDeMarker, iEnvelopes, iForce, iFractals, iGator, iHigh, iHighest, iLow, iLowest, iMA, iMACD, iMFI, iMomentum, iOBV, iOpen, iOsMA, iRSI, iRVI, iSAR, isConnected, isDemo, iStdDev, isTesting, iStochastic, isTradeContextBusy, isVisualMode, iTime, iVolume, iWPR, marketInfo, minute, month, objectCreate, objectCreate, objectCreate, objectDelete, objectGet, objectGetFiboDescription, objectSet, objectSetFiboDescription, objectSetText, objectsTotal, objectType, orderClose, orderCloseBy, orderClosePrice, orderCloseTime, orderComment, orderCommission, orderDelete, orderExpiration, orderLots, orderMagicNumber, orderModify, orderOpenPrice, orderOpenTime, orderPrint, orderProfit, orderSelect, orderSend,ordersHistoryTotal, orderStopLoss, ordersTotal, orderSwap, orderSymbol, orderTakeProfit, orderTicket, orderType, print, refreshRates, seconds, timeCurrent, year */ } }
// Java: double point = marketInfo(EURUSD, MarketInfo.MODE_POINT); double price = marketInfo(EURUSD, MarketInfo.MODE_ASK); buyPrice = price; int ticket = orderSend( EURUSD, TradeOperation.OP_BUY, 1, buyPrice, 2, price - 100 * point, price + 100 * point, "" + System.currentTimeMillis(), 0, new Date(System.currentTimeMillis() + 60 * 60 * 1000), -1 ); System.out.println("---------------------------------------"); System.out.println("Buy order ticket: " + ticket);
Pls는 여기에 파일을 첨부합니다. Easyshare는 있는 그대로입니다. 나는 계속해서 500초 동안 기다리라는 메시지만 받고 있습니다.
어렵지 않다면 MT4가 자바에 어떻게 연결되는지 설명해주세요. 나 자신도 dll과 TCP 프로토콜을 통해 그러한 연결을 구현했는데 어떻게 했는지 궁금하다.