@pingleware/metatrader4-oanda
Version:
Metatrader 4 to OANDA v2.0 REST API proxy
583 lines (565 loc) • 10.9 kB
JavaScript
const {
MARKETINFO_MODE,
ENUM_SYMBOL_INFO_INTEGER,
ENUM_SYMBOL_INFO_DOUBLE,
ENUM_SYMBOL_INFO_STRING,
ENUM_SYMBOL_TRADE_MODE,
ENUM_SYMBOL_TRADE_EXECUTION,
ENUM_DAY_OF_WEEK,
MarketInfo,
SymbolsTotal,
SymbolName,
SymbolSelect,
SymbolInfoDouble,
SymbolInfoInteger,
SymbolInfoString,
SymbolInfoTick,
SymbolInfoSessionQuote,
SymbolInfoSessionTrade,
OrderBook,
PositionBook
} = require('./marketinfo');
const {
ENUM_ACCOUNT_INFO_INTEGER,
ENUM_ACCOUNT_INFO_DOUBLE,
ENUM_ACCOUNT_INFO_STRING,
ENUM_ACCOUNT_TRADE_MODE,
ENUM_ACCOUNT_STOPOUT_MODE,
AccountInfoDouble,
AccountInfoInteger,
AccountInfoString,
AccountBalance,
AccountCredit,
AccountCompany,
AccountCurrency,
AccountEquity,
AccountFreeMargin,
AccountFreeMarginCheck,
AccountFreeMarginMode,
AccountLeverage,
AccountMargin,
AccountName,
AccountNumber,
AccountProfit,
AccountServer,
AccountStopoutLevel,
AccountStopoutMode
} = require('./account_information');
const {
TRADE_OP,
ENUM_ORDER_POOL_INDEX,
ENUM_ORDER_SELECT_FLAGS,
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
} = require('./trade');
const {
MathAbs,
MathCos,
MathArcsin,
MathArctan,
MathCeil,
MathArccos,
MathExp,
MathFloor,
MathLog,
MathLog10,
MathMax,
MathMin,
MathMod,
MathPow,
MathRand,
MathRound,
MathSin,
MathSqrt,
MathSrand,
MathTan,
MathIsValidNumber
} = require('./math');
const {
ENUM_TIMEFRAMES,
ENUM_SERIES_INFO_INTEGER,
ENUM_SERIESMODE,
SeriesInfoInteger,
RefreshRates,
CopyRatesFromStart,
CopyRatesFromDate,
CopyRatesBetween,
CopyTimeFromStart,
CopyTimeFromDate,
CopyTimeBetween,
CopyOpenFromStart,
CopyOpenFromDate,
CopyOpenBetween,
CopyHighFromStart,
CopyHighFromDate,
CopyHighBetween,
CopyLowFromStart,
CopyLowFromDate,
CopyLowBetween,
CopyCloseFromStart,
CopyCloseFromDate,
CopyCloseBetween,
CopyTickVolumeFromStart,
CopyTickVolumeFromDate,
CopyTickVolumeBetween,
Bars,
BarsBetween,
iBars,
iBarShift,
iClose,
iHigh,
iHighest,
iLow,
iLowest,
iOpen,
iTime,
iVolume
} = require('./timeseries');
const {
MqlDateTime,
TimeCurrent,
TimeLocal,
TimeGMT,
TimeDaylightSavings,
TimeGMTOffset,
TimeToStruct,
StructToTime,
Day,
DayOfWeek,
DayOfYear,
Hour,
Minute,
Month,
Seconds,
TimeDay,
TimeDayOfWeek,
TimeDayOfYear,
TimeHour,
TimeMinute,
TimeMonth,
TimeSeconds,
TimeYear,
Year
} = require('./datetime');
const {
iAC,
iAD,
iADX,
iAlligator,
iAO,
iATR,
iBearsPower,
iBands,
iBandsOnArray,
iBullsPower,
iCCI,
iCCIOnArray,
iCustom,
iDeMarker,
iEnvelopes,
iEnvelopesOnArray,
iForce,
iFractals,
iGator,
iIchimoku,
iBWMFI,
iMomentum,
iMomentumOnArray,
iMFI,
iMA,
iMAOnArray,
iOsMA,
iMACD,
iOBV,
iSAR,
iRSI,
iRSIOnArray,
iRVI,
iStdDev,
iStdDevOnArray,
iStochastic,
iWPR
} = require('./technical');
const {
GetLastError,
IsStopped,
UninitializeReason,
MQLInfoInteger,
MQLInfoString,
MQLSetInteger,
TerminalInfoInteger,
TerminalInfoDouble,
TerminalInfoString,
Symbol,
Period,
Digits,
Point,
IsConnected,
IsDemo,
IsDllsAllowed,
IsExpertEnabled,
IsLibrariesAllowed,
IsOptimization,
IsTesting,
IsTradeAllowed,
IsTradeContextBusy,
IsVisualMode,
TerminalCompany,
TerminalName,
TerminalPath
} = require('./checkup');
const {
Alert,
CheckPointer,
Comment,
CryptEncode,
CryptDecode,
DebugBreak,
ExpertRemove,
GetPointer,
GetTickCount,
GetMicrosecondCount,
MessageBox,
PeriodSeconds,
PlaySound,
Print,
PrintFormat,
ResetLastError,
ResourceCreate,
ResourceFree,
ResourceReadImage,
ResourceSave,
SendFTP,
SendMail,
SendNotification,
Sleep,
TerminalClose,
TesterStatistics,
TranslateKey,
WebRequest,
ZeroMemory
} = require('./common');
const {
Login,
Logout,
GetMyAccounts,
GetWatchedAccounts,
GetOpenOrders,
GetOpenTrades,
GetHistory,
GetDailyGain,
GetGain,
GetCustomWidget,
GetCommunitySentiment,
GetCommunitySentimentByCountry,
GetDataDaily
} = require('./myfxbook');
var {
systime,
setAccountContext
} = require('./account');
function initialize(hostname,token,accountId) {
setAccountContext(hostname,token,accountId);
systime.set(new Date().getTime());
}
function configureFTP(options) {
var {ftpClient} = require('./account');
ftpClient.set(options);
}
function configureTwilio(options) {
var {twilio} = require('./account');
twilio.set(options);
}
function configSendGrid(apiKey,from,to) {
var {sendgrid} = require('./account');
sendgrid.set(apiKey,from,to);
}
module.exports = {
initialize,
configureFTP,
configureTwilio,
configSendGrid,
MARKETINFO_MODE,
ENUM_SYMBOL_INFO_INTEGER,
ENUM_SYMBOL_INFO_DOUBLE,
ENUM_SYMBOL_INFO_STRING,
ENUM_SYMBOL_TRADE_MODE,
ENUM_SYMBOL_TRADE_EXECUTION,
ENUM_DAY_OF_WEEK,
MarketInfo,
SymbolsTotal,
SymbolName,
SymbolSelect,
SymbolInfoDouble,
SymbolInfoInteger,
SymbolInfoString,
SymbolInfoTick,
SymbolInfoSessionQuote,
SymbolInfoSessionTrade,
OrderBook,
PositionBook,
ENUM_ACCOUNT_INFO_INTEGER,
ENUM_ACCOUNT_INFO_DOUBLE,
ENUM_ACCOUNT_INFO_STRING,
ENUM_ACCOUNT_TRADE_MODE,
ENUM_ACCOUNT_STOPOUT_MODE,
AccountInfoDouble,
AccountInfoInteger,
AccountInfoString,
AccountBalance,
AccountCredit,
AccountCompany,
AccountCurrency,
AccountEquity,
AccountFreeMargin,
AccountFreeMarginCheck,
AccountFreeMarginMode,
AccountLeverage,
AccountMargin,
AccountName,
AccountNumber,
AccountProfit,
AccountServer,
AccountStopoutLevel,
AccountStopoutMode,
TRADE_OP,
ENUM_ORDER_POOL_INDEX,
ENUM_ORDER_SELECT_FLAGS,
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,
MathAbs,
MathCos,
MathArcsin,
MathArctan,
MathCeil,
MathArccos,
MathExp,
MathFloor,
MathLog,
MathLog10,
MathMax,
MathMin,
MathMod,
MathPow,
MathRand,
MathRound,
MathSin,
MathSqrt,
MathSrand,
MathTan,
MathIsValidNumber,
ENUM_TIMEFRAMES,
ENUM_SERIES_INFO_INTEGER,
ENUM_SERIESMODE,
SeriesInfoInteger,
RefreshRates,
CopyRatesFromStart,
CopyRatesFromDate,
CopyRatesBetween,
CopyTimeFromStart,
CopyTimeFromDate,
CopyTimeBetween,
CopyOpenFromStart,
CopyOpenFromDate,
CopyOpenBetween,
CopyHighFromStart,
CopyHighFromDate,
CopyHighBetween,
CopyLowFromStart,
CopyLowFromDate,
CopyLowBetween,
CopyCloseFromStart,
CopyCloseFromDate,
CopyCloseBetween,
CopyTickVolumeFromStart,
CopyTickVolumeFromDate,
CopyTickVolumeBetween,
Bars,
BarsBetween,
iBars,
iBarShift,
iClose,
iHigh,
iHighest,
iLow,
iLowest,
iOpen,
iTime,
iVolume,
MqlDateTime,
TimeCurrent,
TimeLocal,
TimeGMT,
TimeDaylightSavings,
TimeGMTOffset,
TimeToStruct,
StructToTime,
Day,
DayOfWeek,
DayOfYear,
Hour,
Minute,
Month,
Seconds,
TimeDay,
TimeDayOfWeek,
TimeDayOfYear,
TimeHour,
TimeMinute,
TimeMonth,
TimeSeconds,
TimeYear,
Year,
iAC,
iAD,
iADX,
iAlligator,
iAO,
iATR,
iBearsPower,
iBands,
iBandsOnArray,
iBullsPower,
iCCI,
iCCIOnArray,
iCustom,
iDeMarker,
iEnvelopes,
iEnvelopesOnArray,
iForce,
iFractals,
iGator,
iIchimoku,
iBWMFI,
iMomentum,
iMomentumOnArray,
iMFI,
iMA,
iMAOnArray,
iOsMA,
iMACD,
iOBV,
iSAR,
iRSI,
iRSIOnArray,
iRVI,
iStdDev,
iStdDevOnArray,
iStochastic,
iWPR,
GetLastError,
IsStopped,
UninitializeReason,
MQLInfoInteger,
MQLInfoString,
MQLSetInteger,
TerminalInfoInteger,
TerminalInfoDouble,
TerminalInfoString,
Symbol,
Period,
Digits,
Point,
IsConnected,
IsDemo,
IsDllsAllowed,
IsExpertEnabled,
IsLibrariesAllowed,
IsOptimization,
IsTesting,
IsTradeAllowed,
IsTradeContextBusy,
IsVisualMode,
TerminalCompany,
TerminalName,
TerminalPath,
Alert,
CheckPointer,
Comment,
CryptEncode,
CryptDecode,
DebugBreak,
ExpertRemove,
GetPointer,
GetTickCount,
GetMicrosecondCount,
MessageBox,
PeriodSeconds,
PlaySound,
Print,
PrintFormat,
ResetLastError,
ResourceCreate,
ResourceFree,
ResourceReadImage,
ResourceSave,
SendFTP,
SendMail,
SendNotification,
Sleep,
TerminalClose,
TesterStatistics,
TranslateKey,
WebRequest,
ZeroMemory,
Login,
Logout,
GetMyAccounts,
GetWatchedAccounts,
GetOpenOrders,
GetOpenTrades,
GetHistory,
GetDailyGain,
GetGain,
GetCustomWidget,
GetCommunitySentiment,
GetCommunitySentimentByCountry,
GetDataDaily
};