4367
4938
4745
什么是降维打击?“降维打击”这个词,应该来自于刘新慈的小说《三体》。里面有个“二向箔”,这个玩意儿可以把所有接触者从三维降维到二维,是高等文明的清理员用来打击太阳系文明的武器,当人类无法适应二维的时候,地球文明的被毁灭也就是必然的了。以最直白的话来形容,降维攻击就是一方利用多维度的新型优势去攻击在这个维度上处于劣势的另一方.。通俗地讲,“降维打击”,就是“高纬度生物”对“低纬度生物”的一种毁灭式打击。三维的人,碾死一只二维世界的蚂蚁是何其容易,因为其水平不在一个层次,思维不在一个层次的战斗。我们生活在三维空间,除了平面以外,还有深度,但是对于蚂蚁来说,蚂蚁只知道前后左右,没有上下,那么它的世界近似是二维的。怎样实现“降维打击”要想实现“降维打击”,主要有两种方法:(1)把对方去掉一个维度,给于对手致命一击黑洞听说过吗,黑洞是将所有的维度塌缩到0维度(一个点)。而二向箔则是将三维塌缩成2维,其实质是破坏了三维空间内所有的物质的分子结构。《三体》中整个太阳系就是毁于一片小小的“二向箔”。(2)占居高维度三维生物就是二维生物的神!升维打击理论是指在同一个领域里面,利用不在同一竞争层面、高于同行业竞争者的技术或模式创新对其进行不对称打击,从而更快地占领市场。实现“升维”打击战略的关键是将高级别的技术和行业标准应用到低级别的行业,例如将军用技术应用到工业领域,将工业技术应用到民用领域等。交易里的升维进化与降维打击在金融交易里,也是可以通过“升维进化”来实现降维打击的。同样也是把高级别的技术或工具应用到低级别的交易市场里。高级别技术的一个现实例子是“人工智能技术在金融交易”的使用,当我们还在通过阅读著名分析师的评论而做交易参考的时候,“高维度”的交易者,已经通过人工智能瞬间掌握了“全数据”,对整个交易市场的心态了如指掌。当我们还在纠结于用一个通过看不懂豆粕的涨跌时,“高纬度”的交易者却已经再通过期权赚钱。
5
0 1141天前
4744
在本文中,我想推荐我的从 MQL4 迁移到 MQL5 的指南版本。1. 图表周期在 MQL5 图表中,周期常数发生了变化,并添加了一些新的时间周期(M2、M3、M4、M6、M10、M12、H2、H3、H6、H8、H12)。要转换 MQL4 时间段,您可以使用以下函数:ENUM_TIMEFRAMES TFMigrate(int tf)
{
switch(tf)
{
case 0: return(PERIOD_CURRENT);
case 1: return(PERIOD_M1);
case 5: return(PERIOD_M5);
case 15: return(PERIOD_M15);
case 30: return(PERIOD_M30);
case 60: return(PERIOD_H1);
case 240: return(PERIOD_H4);
case 1440: return(PERIOD_D1);
case 10080: return(PERIOD_W1);
case 43200: return(PERIOD_MN1);
case 2: return(PERIOD_M2);
case 3: return(PERIOD_M3);
case 4: return(PERIOD_M4);
case 6: return(PERIOD_M6);
case 10: return(PERIOD_M10);
case 12: return(PERIOD_M12);
case 16385: return(PERIOD_H1);
case 16386: return(PERIOD_H2);
case 16387: return(PERIOD_H3);
case 16388: return(PERIOD_H4);
case 16390: return(PERIOD_H6);
case 16392: return(PERIOD_H8);
case 16396: return(PERIOD_H12);
case 16408: return(PERIOD_D1);
case 32769: return(PERIOD_W1);
case 49153: return(PERIOD_MN1);
default: return(PERIOD_CURRENT);
}
}应该注意的是,在 MQL5 中,图表时间框架常数的数值(从 H1 开始)不等于柱的分钟数(例如,在 MQL5 中,常数 PERIOD_H1 的数值=16385,但在 MQL4 PERIOD_H1 中=60)。如果在 MQL4 程序中使用 MQL4 常量的数值,则在转换为 MQL5 时您应该考虑到这一点。要确定图表指定时间段的分钟数,请将函数PeriodSeconds返回的值除以60。2. 声明内容MQL5 中不存在一些标准 MQL4 常量,因此应声明它们:#define OP_BUY 0 //Buy
#define OP_SELL 1 //Sell
#define OP_BUYLIMIT 2 //Pending order of BUY LIMIT type
#define OP_SELLLIMIT 3 //Pending order of SELL LIMIT type
#define OP_BUYSTOP 4 //Pending order of BUY STOP type
#define OP_SELLSTOP 5 //Pending order of SELL STOP type
//---
#define MODE_OPEN 0
#define MODE_CLOSE 3
#define MODE_VOLUME 4
#define MODE_REAL_VOLUME 5
#define MODE_TRADES 0
#define MODE_HISTORY 1
#define SELECT_BY_POS 0
#define SELECT_BY_TICKET 1
//---
#define DOUBLE_VALUE 0
#define FLOAT_VALUE 1
#define LONG_VALUE INT_VALUE
//---
#define CHART_BAR 0
#define CHART_CANDLE 1
//---
#define MODE_ASCEND 0
#define MODE_DESCEND 1
//---
#define MODE_LOW 1
#define MODE_HIGH 2
#define MODE_TIME 5
#define MODE_BID 9
#define MODE_ASK 10
#define MODE_POINT 11
#define MODE_DIGITS 12
#define MODE_SPREAD 13
#define MODE_STOPLEVEL 14
#define MODE_LOTSIZE 15
#define MODE_TICKVALUE 16
#define MODE_TICKSIZE 17
#define MODE_SWAPLONG 18
#define MODE_SWAPSHORT 19
#define MODE_STARTING 20
#define MODE_EXPIRATION 21
#define MODE_TRADEALLOWED 22
#define MODE_MINLOT 23
#define MODE_LOTSTEP 24
#define MODE_MAXLOT 25
#define MODE_SWAPTYPE 26
#define MODE_PROFITCALCMODE 27
#define MODE_MARGINCALCMODE 28
#define MODE_MARGININIT 29
#define MODE_MARGINMAINTENANCE 30
#define MODE_MARGINHEDGED 31
#define MODE_MARGINREQUIRED 32
#define MODE_FREEZELEVEL 33
//---
#define EMPTY -13. 预定义变量MQL4 MQL5Descriptiondouble AskMqlTick last_tick;
SymbolInfoTick(_Symbol,last_tick);
double Ask=last_tick.ask;
AskThe latest known ask price for the current symbol.SymbolInfoTickint Barsint Bars=Bars(_Symbol,_Period);BarsNumber of bars in the current chart.Barsdouble BidMqlTick last_tick;
SymbolInfoTick(_Symbol,last_tick);
double Bid=last_tick.bid;BidThe latest known bid price of the current symbol.SymbolInfoTickdouble Close[]double Close[];
int count; // number of elements to copy
ArraySetAsSeries(Close,true);
CopyClose(_Symbol,_Period,0,count,Close);CloseSeries array that contains close prices for each bar of the current chart.CopyClose, ArraySetAsSeriesint Digitsint Digits=_Digits;DigitsNumber of digits after the decimal point for the current symbol prices._Digitsdouble High[]double High[];
int count; // number of elements to copy
ArraySetAsSeries(High,true);
CopyHigh(_Symbol,_Period,0,count,High);HighSeries array that contains the highest prices of each bar of the current chart.CopyHigh, ArraySetAsSeriesdouble Low[]double Low[];
int count; // number of elements to copy
ArraySetAsSeries(Low,true);
CopyLow(_Symbol,_Period,0,count,Low);LowSeries array that contains the lowest prices of each bar of the current chart.CopyLow, ArraySetAsSeriesdouble Open[]double Open[];
int count; // number of elements to copy
ArraySetAsSeries(Open,true);
CopyOpen(_Symbol,_Period,0,count,Open);OpenSeries array that contains open prices of each bar of the current chart.CopyOpen, ArraySetAsSeriesdouble Pointdouble Point=_Point;PointThe current symbol point value in the quote currency._Pointdatetime Time[]datetime Time[];
int count; // number of elements to copy
ArraySetAsSeries(Time,true);
CopyTime(_Symbol,_Period,0,count,Time);TimeSeries array that contains open time of each bar of the current chart. Data like datetime represent time, in seconds, that has passed since 00:00 a.m. of 1 January, 1970.CopyTime, ArraySetAsSeriesdouble Volume[]long Volume[];
int count; // number of elements to copy
ArraySetAsSeries(Volume,true);
CopyTickVolume(_Symbol,_Period,0,count,Volume);VolumeSeries array that contains tick volumes of each bar of the current chart.CopyTickVolume, ArraySetAsSeries4. Account InformationMQL4MQL5Descriptiondouble AccountBalance()double AccountInfoDouble(ACCOUNT_BALANCE)AccountBalanceReturns balance value of the current account (the amount of money on the account).AccountInfoDoubledouble AccountCredit()double AccountInfoDouble(ACCOUNT_CREDIT)AccountCreditReturns credit value of the current account.AccountInfoDoublestring AccountCompany()string AccountInfoString(ACCOUNT_COMPANY)AccountCompanyReturns the brokerage company name where the current account was registered.AccountInfoStringstring AccountCurrency()string AccountInfoString(ACCOUNT_CURRENCY)AccountCurrencyReturns currency name of the current account.AccountInfoStringdouble AccountEquity()double AccountInfoDouble(ACCOUNT_EQUITY)AccountEquityReturns equity value of the current account. Equity calculation depends on trading server settings.AccountInfoDoubledouble AccountFreeMargin()double AccountInfoDouble(ACCOUNT_FREEMARGIN)AccountFreeMarginReturns free margin value of the current account.AccountInfoDoubledouble AccountFreeMarginCheck(string symbol,
int cmd,
double volume)-AccountFreeMarginCheckReturns free margin that remains after the specified position has been opened at the current price on the current account.double AccountFreeMarginMode()-AccountFreeMarginModeCalculation mode of free margin allowed to open positions on the current account.int AccountLeverage()int AccountInfoInteger(ACCOUNT_LEVERAGE)AccountLeverageReturns leverage of the current account.AccountInfoIntegerdouble AccountMargin()double AccountInfoDouble(ACCOUNT_MARGIN)AccountMarginReturns margin value of the current account.AccountInfoDoublestring AccountName()string AccountInfoString(ACCOUNT_NAME)AccountNameReturns the current account name.AccountInfoStringint AccountNumber()int AccountInfoInteger(ACCOUNT_LOGIN)AccountNumberReturns the number of the current account.AccountInfoIntegerdouble AccountProfit()double AccountInfoDouble(ACCOUNT_PROFIT)AccountProfitReturns profit value of the current account.AccountInfoDoublestring AccountServer()string AccountInfoString(ACCOUNT_SERVER)AccountServerReturns the connected server name.AccountInfoStringint AccountStopoutLevel()double AccountInfoDouble(ACCOUNT_MARGIN_SO_SO)AccountStopoutLevelReturns the value of the Stop Out level.AccountInfoDoubleint AccountStopoutMode()int AccountInfoInteger(ACCOUNT_MARGIN_SO_MODE)AccountStopoutModeReturns the calculation mode for the Stop Out level.AccountInfoInteger5. Array FunctionsMQL4MQL5 Descriptionint ArrayBsearch(double array[],
double value,
int count=WHOLE_ARRAY,
int start=0,
int direction=MODE_ASCEND)int ArrayBsearch(double array[],
double searched_value
)ArrayBsearchThe function searches for a specified value in a one-dimension numeric array.ArrayBsearchint ArrayCopy(object&dest[],
object source[],
int start_dest=0,
int start_source=0,
int count=WHOLE_ARRAY)int ArrayCopy(void dst_array[],
void src_array[],
int dst_start=0,
int src_start=0,
int cnt=WHOLE_ARRAY
)ArrayCopyCopies an array to another one. Arrays must be of the same type, but arrays with type double[], int[], datetime[], color[], and bool[] can be copied as arrays of the same type. Returns the amount of copied elements.ArrayCopyint ArrayCopyRates(double&dest_array[],
string symbol=NULL,
int timeframe=0)-ArrayCopyRatesCopies data of the current chart bars to the two-dimensional array of RateInfo[][6] type and returns copied bars amount, or -1 if failed.int ArrayCopySeries(double&array[],
int series_index,
string symbol=NULL,
int timeframe=0)int ArrayCopySeriesMQL4(double &array[],
int series_index,
string symbol=NULL,
int tf=0)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int count=Bars(symbol,timeframe);
switch(series_index)
{
case MODE_OPEN:
return(CopyOpen(symbol,timeframe,0,count,array));
case MODE_LOW:
return(CopyLow(symbol,timeframe,0,count,array));
case MODE_HIGH:
return(CopyHigh(symbol,timeframe,0,count,array));
case MODE_CLOSE:
return(CopyClose(symbol,timeframe,0,count,array));
default: return(0);
}
return(0);
}ArrayCopySeriesCopies a timeseries array to a custom array and returns the count of the copied elements.CopyOpen, CopyLow, CopyHigh, CopyClose, Barsint ArrayDimension( object array[])-ArrayDimensionReturns the multidimensional array rank.bool ArrayGetAsSeries( object array[])bool ArrayGetAsSeries(void array)ArrayGetAsSeriesReturns TRUE if an array is organized as a timeseries array (array elements are indexed from the last to the first one), otherwise returns FALSE.ArrayGetAsSeriesint ArrayInitialize(double &array[],
double value)int ArrayInitializeMQL4(double &array[],
double value)
{
ArrayInitialize(array,value);
return(ArraySize(array));
}ArrayInitializeSets all elements of a numeric array to the same value. Returns the count of initialized elements.ArrayInitialize, ArraySizebool ArrayIsSeries( object array[])bool ArrayIsSeries(void array[])ArrayIsSeriesReturns TRUE if the array under check is a timeseries array (Time[],Open[],Close[],High[],Low[], or Volume[]), otherwise returns FALSE.ArrayIsSeriesint ArrayMaximum(double array[],
int count=WHOLE_ARRAY,
int start=0)int ArrayMaximumMQL4(double &array[],
int count=WHOLE_ARRAY,
int start=0)
{
return(ArrayMaximum(array,start,count));
}ArrayMaximumSearches for the element with the maximal value. The function returns position of this maximal element in the array.ArrayMaximumint ArrayMinimum(double array[],
int count=WHOLE_ARRAY,
int start=0)int ArrayMinimumMQL4(double &array[],
int count=WHOLE_ARRAY,
int start=0)
{
return(ArrayMinimum(array,start,count));
}ArrayMinimumSearches for the element with the minimal value. The function returns position of this minimal element in the array.ArrayMinimumint ArrayRange(object array[],
int range_index)int ArrayRange(void array[],
int rank_index
)ArrayRangeReturns the count of elements in the given dimension of the array.ArrayRangeint ArrayResize(object &array[],
int new_size)int ArrayResize(void array[],
int new_size,
int allocated_size=0
)ArrayResizeSets a new size for the first dimension.ArrayResizebool ArraySetAsSeries(double &array[],
bool set)bool ArraySetAsSeries(void array[],
bool set
)ArraySetAsSeriesReturns the count of elements in the given dimension of the array. Since indexes are zero-based, the size of dimension is 1 greater than the largest index.ArraySetAsSeriesint ArraySize( object array[])int ArraySize(void array[])ArraySizeReturns the count of elements contained in the array.ArraySizeint ArraySort(double &array[],
int count=WHOLE_ARRAY,
int start=0,
int sort_dir=MODE_ASCEND)int ArraySortMQL4(double &array[],
int count=WHOLE_ARRAY,
int start=0,
int sort_dir=MODE_ASCEND)
{
switch(sort_dir)
{
case MODE_ASCEND:
ArraySetAsSeries(array,true);
case MODE_DESCEND:
ArraySetAsSeries(array,false);
default: ArraySetAsSeries(array,true);
}
ArraySort(array);
return(0);
}ArraySortSorts numeric arrays by first dimension. Series arrays cannot be sorted by ArraySort().ArraySort, ArraySetAsSeries6. CheckupMQL4MQL5Descriptionint GetLastError()int GetLastError()GetLastErrorThe function returns the last occurred error, then the value of special last_error variable where the last error code is stored will be zeroized.GetLastErrorbool IsConnected()bool TerminalInfoInteger(TERMINAL_CONNECTED)IsConnectedThe function returns the status of the main connection between the client terminal and the server that performs data pumping. It returns TRUE if connection to the server was successfully established, otherwise, it returns FALSE.TerminalInfoIntegerbool IsDemo()bool IsDemoMQL4()
{
if(AccountInfoInteger(ACCOUNT_TRADE_MODE)==ACCOUNT_TRADE_MODE_DEMO)
return(true);
else
return(false);
}IsDemoReturns TRUE if the expert runs on a demo account, otherwise returns FALSE.AccountInfoIntegerbool IsDllsAllowed()bool TerminalInfoInteger(TERMINAL_DLLS_ALLOWED)IsDllsAllowedReturns TRUE if the function DLL call is allowed for the Expert Advisor, otherwise returns FALSE.TerminalInfoIntegerbool IsExpertEnabled()bool AccountInfoInteger(ACCOUNT_TRADE_EXPERT)IsExpertEnabledReturns TRUE if use of Expert Advisors is enabled in the client terminal, otherwise returns FALSE.AccountInfoIntegerbool IsLibrariesAllowed()bool MQLInfoInteger(MQL5_DLLS_ALLOWED)IsLibrariesAllowedReturns TRUE if an Expert Advisor can call library function, otherwise returns FALSE.MQLInfoIntegerbool IsOptimization()bool MQLInfoInteger(MQL5_OPTIMIZATION)IsOptimizationReturns TRUE if an Expert Advisor is running in the strategy tester optimization mode, otherwise returns FALSE.MQLInfoIntegerbool IsStopped()bool IsStopped()IsStoppedReturns TRUE if the program (an Expert Advisor or a script) has been commanded to stop its operation, otherwise returns FALSE.IsStoppedbool IsTesting()bool MQLInfoInteger(MQL5_TESTING)IsTestingReturns TRUE if an Expert Advisor is running in the testing mode, otherwise returns FALSE.MQLInfoIntegerbool IsTradeAllowed()bool MQLInfoInteger(MQL5_TRADE_ALLOWED)IsTradeAllowedReturns TRUE if trading by Expert Advisors is allowed and a thread for trading is not occupied, otherwise returns FALSE.MQLInfoIntegerbool IsTradeContextBusy()-IsTradeContextBusyReturns TRUE if a thread for trading is occupied by another Expert Advisor, otherwise returns FALSE.bool IsVisualMode()bool MQLInfoInteger(MQL5_VISUAL_MODE)IsVisualModeReturns TRUE if the Expert Advisor is tested with checked "Visual Mode" button, otherwise returns FALSE.MQLInfoIntegerint UninitializeReason()int UninitializeReason()UninitializeReasonReturns the code of the uninitialization reason for Expert Advisors, custom indicators, and scripts.UninitializeReason7. Client TerminalMQL4 MQL5 Descriptionstring TerminalCompany()string TerminalInfoString(TERMINAL_COMPANY)TerminalCompanyReturns the name of company owning the client terminal.TerminalInfoStringstring TerminalName()string TerminalInfoString(TERMINAL_NAME)TerminalNameReturns client terminal name.TerminalInfoStringstring TerminalPath()string TerminalInfoString(TERMINAL_PATH)TerminalPathReturns the directory, from which the client terminal was launched.TerminalInfoString8. Common FunctionsMQL4MQL5Descriptionvoid Alert(...)void Alert(argument,...)AlertDisplays a dialog box containing the user-defined data. Parameters can be of any type.Alertvoid Comment(...)void Comment(argument,...)CommentThe function outputs the comment defined by the user in the left top corner of the chart.Commentint GetTickCount()uint GetTickCount()GetTickCountThe GetTickCount() function retrieves the number of milliseconds that have elapsed since the system was started.GetTickCountdouble MarketInfo(string symbol,
int type)double MarketInfoMQL4(string symbol,
int type)
{
switch(type)
{
case MODE_LOW:
return(SymbolInfoDouble(symbol,SYMBOL_LASTLOW));
case MODE_HIGH:
return(SymbolInfoDouble(symbol,SYMBOL_LASTHIGH));
case MODE_TIME:
return(SymbolInfoInteger(symbol,SYMBOL_TIME));
case MODE_BID:
return(Bid);
case MODE_ASK:
return(Ask);
case MODE_POINT:
return(SymbolInfoDouble(symbol,SYMBOL_POINT));
case MODE_DIGITS:
return(SymbolInfoInteger(symbol,SYMBOL_DIGITS));
case MODE_SPREAD:
return(SymbolInfoInteger(symbol,SYMBOL_SPREAD));
case MODE_STOPLEVEL:
return(SymbolInfoInteger(symbol,SYMBOL_TRADE_STOPS_LEVEL));
case MODE_LOTSIZE:
return(SymbolInfoDouble(symbol,SYMBOL_TRADE_CONTRACT_SIZE));
case MODE_TICKVALUE:
return(SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_VALUE));
case MODE_TICKSIZE:
return(SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_SIZE));
case MODE_SWAPLONG:
return(SymbolInfoDouble(symbol,SYMBOL_SWAP_LONG));
case MODE_SWAPSHORT:
return(SymbolInfoDouble(symbol,SYMBOL_SWAP_SHORT));
case MODE_STARTING:
return(0);
case MODE_EXPIRATION:
return(0);
case MODE_TRADEALLOWED:
return(0);
case MODE_MINLOT:
return(SymbolInfoDouble(symbol,SYMBOL_VOLUME_MIN));
case MODE_LOTSTEP:
return(SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP));
case MODE_MAXLOT:
return(SymbolInfoDouble(symbol,SYMBOL_VOLUME_MAX));
case MODE_SWAPTYPE:
return(SymbolInfoInteger(symbol,SYMBOL_SWAP_MODE));
case MODE_PROFITCALCMODE:
return(SymbolInfoInteger(symbol,SYMBOL_TRADE_CALC_MODE));
case MODE_MARGINCALCMODE:
return(0);
case MODE_MARGININIT:
return(0);
case MODE_MARGINMAINTENANCE:
return(0);
case MODE_MARGINHEDGED:
return(0);
case MODE_MARGINREQUIRED:
return(0);
case MODE_FREEZELEVEL:
return(SymbolInfoInteger(symbol,SYMBOL_TRADE_FREEZE_LEVEL));
default: return(0);
}
return(0);
}MarketInfoReturns various data about securities listed in the Market Watch window.SymbolInfoInteger, SymbolInfoDouble, Bid, Askint MessageBox(string text=NULL,
string caption=NULL,
int flags=EMPTY)int MessageBox(string text,
string caption=NULL,
int flags=0)MessageBoxThe MessageBox function creates, displays, and operates message box.MessageBoxvoid PlaySound(string filename)bool PlaySound(string filename)PlaySoundFunction plays a sound file.PlaySoundvoid Print(...)void Print(argument,...)PrintPrints a message to the experts log.Printbool SendFTP(string filename,
string ftp_path=NULL)bool SendFTP(string filename,
string ftp_path=NULL)SendFTPSends the file to the FTP server set in the Tools->Options->Publisher tab. If the attempt fails, it retuns FALSE.SendFTPvoid SendMail(string subject,
string some_text)bool SendMail(string subject,
string some_text)SendMailSends a message to the e-mail set in the Tools->Options->EMail tab.SendMailvoid Sleep(int milliseconds)void Sleep(int milliseconds)SleepThe Sleep() function suspends execution of the current expert within the specified interval.Sleep9. Conversion FunctionsMQL4MQL5Descriptionstring CharToStr(int char_code)string CharToString(int char_code)CharToStrConversion of the symbol code into a one-character string.CharToStringstring DoubleToStr(double value,
int digits)string DoubleToString(double value,
int digits=8)DoubleToStrReturns text string with the specified numerical value converted into a specified precision format.DoubleToStringdouble NormalizeDouble(double value,
int digits)double NormalizeDouble(double value,
int digits)NormalizeDoubleRounds the floating point value to the given precision. Returns normalized value of the double type.NormalizeDoubledouble StrToDouble(string value)double StringToDouble(string value)StrToDoubleConverts string representation of number to double type (double-precision format with floating point).StringToDoubleint StrToInteger(string value)long StringToInteger(string value)StrToIntegerConverts string containing the value character representation into a value of the int (integer) type.StringToIntegerdatetime StrToTime(string value)datetime StringToTime(string value)StrToTimeConverts string in the format "yyyy.mm.dd hh:mi" to datetime type (the amount of seconds that have passed since 1 Jan., 1970).StringToTimestring TimeToStr(datetime value,
int mode=TIME_DATE|TIME_MINUTES)string TimeToString(datetime value,
int mode=TIME_DATE|TIME_MINUTES)TimeToStrConverts value containing time in seconds that has passed since January 1, 1970, into a string of "yyyy.mm.dd hh:mi" format.TimeToString10. Custom IndicatorsMQL4MQL5 Descriptionvoid IndicatorBuffers(int count)-IndicatorBuffersAllocates memory for buffers used for custom indicator calculations.int IndicatorCounted()int IndicatorCountedMQL4()
{
if(prev_calculated>0) return(prev_calculated-1);
if(prev_calculated==0) return(0);
return(0);
}IndicatorCountedThe function returns the amount of bars not changed after the indicator had been launched last.OnCalculatevoid IndicatorDigits(int digits)bool IndicatorSetInteger(INDICATOR_DIGITS,digits)IndicatorDigitsSets precision format (the count of digits after decimal point) to visualize indicator values.IndicatorSetIntegervoid IndicatorShortName(string name)bool IndicatorSetString(INDICATOR_SHORTNAME,name)IndicatorShortNameSets the "short" name of a custom indicator to be shown in the DataWindow and in the chart subwindow.IndicatorSetStringvoid SetIndexArrow(int index,
int code)bool PlotIndexSetInteger(index,PLOT_ARROW,code)SetIndexArrowSets an arrow symbol for indicators line of the DRAW_ARROW type.PlotIndexSetIntegerbool SetIndexBuffer(int index,
double array[])bool SetIndexBuffer(index,array,INDICATOR_DATA)SetIndexBufferBinds the array variable declared at a global level to the custom indicator pre-defined buffer.SetIndexBuffervoid SetIndexDrawBegin(int index,
int begin)bool PlotIndexSetInteger(index,PLOT_DRAW_BEGIN,begin)SetIndexDrawBeginSets the bar number (from the data beginning) from which the drawing of the given indicator line must start.PlotIndexSetIntegervoid SetIndexEmptyValue(int index,
double value)bool PlotIndexSetDouble(index,PLOT_EMPTY_VALUE,value)SetIndexEmptyValueSets drawing line empty value.PlotIndexSetDoublevoid SetIndexLabel(int index,
string text)bool PlotIndexSetString(index,PLOT_LABEL,text)SetIndexLabelSets drawing line description for showing in the DataWindow and in the tooltip.PlotIndexSetStringvoid SetIndexShift(int index,
int shift)bool PlotIndexSetInteger(index,PLOT_SHIFT,shift)SetIndexShiftSets offset for the drawing line.PlotIndexSetIntegervoid SetIndexStyle(int index,
int type,
int style=EMPTY,
int width=EMPTY,
color clr=CLR_NONE)void SetIndexStyleMQL4(int index,
int type,
int style=EMPTY,
int width=EMPTY,
color clr=CLR_NONE)
{
if(width>-1)
PlotIndexSetInteger(index,PLOT_LINE_WIDTH,width);
if(clr!=CLR_NONE)
PlotIndexSetInteger(index,PLOT_LINE_COLOR,clr);
switch(type)
{
case 0:
PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_LINE);
case 1:
PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_SECTION);
case 2:
PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_HISTOGRAM);
case 3:
PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_ARROW);
case 4:
PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_ZIGZAG);
case 12:
PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_NONE);
default:
PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_LINE);
}
switch(style)
{
case 0:
PlotIndexSetInteger(index,PLOT_LINE_STYLE,STYLE_SOLID);
case 1:
PlotIndexSetInteger(index,PLOT_LINE_STYLE,STYLE_DASH);
case 2:
PlotIndexSetInteger(index,PLOT_LINE_STYLE,STYLE_DOT);
case 3:
PlotIndexSetInteger(index,PLOT_LINE_STYLE,STYLE_DASHDOT);
case 4:
PlotIndexSetInteger(index,PLOT_LINE_STYLE,STYLE_DASHDOTDOT);
default: return;
}SetIndexStyleSets the new type, style, width and color for a given indicator line.PlotIndexSetIntegervoid SetLevelStyle(int draw_style,
int line_width,
color clr=CLR_NONE)void SetLevelStyleMQL4(int draw_style,
int line_width,
color clr=CLR_NONE)
{
IndicatorSetInteger(INDICATOR_LEVELWIDTH,line_width);
if(clr!=CLR_NONE)
IndicatorSetInteger(INDICATOR_LEVELCOLOR,clr);
switch(draw_style)
{
case 0:
IndicatorSetInteger(INDICATOR_LEVELSTYLE,STYLE_SOLID);
case 1:
IndicatorSetInteger(INDICATOR_LEVELSTYLE,STYLE_DASH);
case 2:
IndicatorSetInteger(INDICATOR_LEVELSTYLE,STYLE_DOT);
case 3:
IndicatorSetInteger(INDICATOR_LEVELSTYLE,STYLE_DASHDOT);
case 4:
IndicatorSetInteger(INDICATOR_LEVELSTYLE,STYLE_DASHDOTDOT);
default: return;
}
}SetLevelStyleThe function sets a new style, width and color of horizontal levels of indicator to be output in a separate window.IndicatorSetIntegervoid SetLevelValue(int level,
double value)bool IndicatorSetDouble(INDICATOR_LEVELVALUE,level,value)SetLevelValueThe function sets a value for a given horizontal level of the indicator to be output in a separate window.IndicatorSetDouble11. Date and Time FunctionsMQL4 MQL5Descriptionint Day()int DayMQL4()
{
MqlDateTime tm;
TimeCurrent(tm);
return(tm.day);
}DayReturns the current day of the month, i.e., the day of month of the last known server time.TimeCurrent, MqlDateTimeint DayOfWeek()int DayOfWeekMQL4()
{
MqlDateTime tm;
TimeCurrent(tm);
return(tm.day_of_week);
}DayOfWeekReturns the current zero-based day of the week (0-Sunday,1,2,3,4,5,6) of the last known server time.TimeCurrent, MqlDateTimeint DayOfYear()int DayOfYearMQL4()
{
MqlDateTime tm;
TimeCurrent(tm);
return(tm.day_of_year);
}DayOfYearReturns 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.TimeCurrent, MqlDateTimeint Hour()int HourMQL4()
{
MqlDateTime tm;
TimeCurrent(tm);
return(tm.hour);
}HourReturns 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).TimeCurrent, MqlDateTimeint Minute()int MinuteMQL4()
{
MqlDateTime tm;
TimeCurrent(tm);
return(tm.min);
}MinuteReturns 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).TimeCurrent, MqlDateTimeint Month()int MonthMQL4()
{
MqlDateTime tm;
TimeCurrent(tm);
return(tm.mon);
}MonthReturns 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.TimeCurrent, MqlDateTimeint Seconds()int SecondsMQL4()
{
MqlDateTime tm;
TimeCurrent(tm);
return(tm.sec);
}SecondsReturns 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, MqlDateTimedatetime TimeCurrent()datetime TimeCurrent()TimeCurrentReturns the last known server time (time of incoming of the latest quote) as number of seconds elapsed from 00:00 January 1, 1970.TimeCurrentint TimeDay(datetime date)int TimeDayMQL4(datetime date)
{
MqlDateTime tm;
TimeToStruct(date,tm);
return(tm.day);
}TimeDayReturns day of month (1 - 31) for the specified date.TimeToStruct, MqlDateTimeint TimeDayOfWeek(datetime date)int TimeDayOfWeekMQL4(datetime date)
{
MqlDateTime tm;
TimeToStruct(date,tm);
return(tm.day_of_week);
}TimeDayOfWeekReturns the zero-based day of week (0 means Sunday,1,2,3,4,5,6) for the specified date.TimeToStruct, MqlDateTimeint TimeDayOfYear(datetime date)int TimeDayOfYearMQL4(datetime date)
{
MqlDateTime tm;
TimeToStruct(date,tm);
return(tm.day_of_year);
}TimeDayOfYearReturns day (1 means 1 January,..,365(6) does 31 December) of year for the specified date.TimeToStruct, MqlDateTimeint TimeHour(datetime time)int TimeHourMQL4(datetime date)
{
MqlDateTime tm;
TimeToStruct(date,tm);
return(tm.hour);
}TimeHourReturns the hour for the specified time.TimeToStruct, MqlDateTimedatetime TimeLocal()datetime TimeLocal()TimeLocalReturns local computer time as number of seconds elapsed from 00:00 January 1, 1970.TimeLocalint TimeMinute(datetime time)int TimeMinuteMQL4(datetime date)
{
MqlDateTime tm;
TimeToStruct(date,tm);
return(tm.min);
}TimeMinuteReturns the minute for the specified time.TimeToStruct, MqlDateTimeint TimeMonth(datetime time)int TimeMonthMQL4(datetime date)
{
MqlDateTime tm;
TimeToStruct(date,tm);
return(tm.mon);
}TimeMonthReturns the month number for the specified time.TimeToStruct, MqlDateTimeint TimeSeconds(datetime time)int TimeSecondsMQL4(datetime date)
{
MqlDateTime tm;
TimeToStruct(date,tm);
return(tm.sec);
}TimeSecondsReturns the amount of seconds elapsed from the beginning of the minute for the specified time.TimeToStruct, MqlDateTimeint TimeYear(datetime time)int TimeYearMQL4(datetime date)
{
MqlDateTime tm;
TimeToStruct(date,tm);
return(tm.year);
}TimeYearReturns year for the specified date. The returned value can be within the range of 1970 to 2037.TimeToStruct, MqlDateTimeint Year()int YearMQL4()
{
MqlDateTime tm;
TimeCurrent(tm);
return(tm.year);
}YearReturns the current year, i.e., the year of the last known server time.TimeCurrent, MqlDateTime12. File FunctionsMQL4 MQL5 Descriptionvoid FileClose(int handle)void FileClose(int file_handle)FileCloseCloses file previously opened by the FileOpen() function.FileClosevoid FileDelete(string filename)bool FileDelete(string file_name
int common_flag=0)FileDeleteRemoves specified file name.FileDeletevoid FileFlush(int handle)void FileFlush(int file_handle)FileFlushFlushes all data stored in the file buffer to the disk.FileFlushbool FileIsEnding(int handle)bool FileIsEnding(int file_handle)FileIsEndingReturns logical true if file pointer is at the end of the file, otherwise returns false.FileIsEndingbool FileIsLineEnding(int handle)bool FileIsLineEnding(int file_handle)FileIsLineEndingFor CSV file returns logical true if file pointer is at the end of the line, otherwise returns false.FileIsLineEndingint FileOpen(string filename,
int mode,
int delimiter=';')int FileOpen(string ile_name,
int pen_flags,
short delimiter='\t'
uint codepage=CP_ACP)FileOpenOpens file for input and/or output. Returns a file handle for the opened file or -1 (if the function fails).FileOpenint FileOpenHistory(string filename,
int mode,
int delimiter=';')-FileOpenHistoryOpens file in the current history directory (terminal_directory\history\server_name) or in its subfolders. Returns the file handle for the opened file. If the function fails, the returned value is -1.int FileReadArray(int handle,
object &array[],
int start,
int count)uint FileReadArray(int file_handle,
void array[],
int start_item=0,
int items_count=WHOLE_ARRAY)FileReadArrayReads the specified amount of elements from the binary file into array.FileReadArraydouble FileReadDouble(int handle,
int size=DOUBLE_VALUE)double FileReadDoubleMQL4(int handle,
int size=DOUBLE_VALUE)
{
return(FileReadDouble(handle));
}FileReadDoubleReads the double-precision number with floating point from the current binary file position.FileReadDoubleint FileReadInteger(int handle,
int size=LONG_VALUE)int FileReadInteger(int file_handle,
int size=INT_VALUE)FileReadIntegerThe function reads the integer from the current binary file position.FileReadIntegerdouble FileReadNumber(int handle)double FileReadNumber(int file_handle)FileReadNumberRead the number from the current file position before the delimiter. Only for CSV files.FileReadNumberstring FileReadString(int handle,
int length=0)string FileReadString(int file_handle,
int size=-1)FileReadStringФункция читает строку с текущей позиции файла.FileReadStringbool FileSeek(int handle,
int offset,
int origin)bool FileSeekMQL4(long handle,
int offset,
ENUM_FILE_POSITION origin)
{
FileSeek(handle,offset,origin);
return(true);
}FileSeekThe function moves the file pointer to a new position that is an offset, in bytes, from the beginning, the end or the current file position.FileSeekint FileSize(int handle)ulong FileSize(int file_handle)FileSizeThe function returns file size in bytes.FileSizeint FileTell(int handle)ulong FileTell(int file_handle)FileTellReturns the current position of the file pointer.FileTellint FileWrite(int handle,...)uint FileWrite(int file_handle,...)FileWriteThe function is intended for writing of data into a CSV file, delimiter being inserted automatically.FileWriteint FileWriteArray(int handle,
object array[],
int start,
int count)int FileWriteArray(int file_handle,
void array[],
int start_item=0,
int items_count=WHOLE_ARRAY)FileWriteArrayThe function writes the array to a binary file.FileWriteArrayint FileWriteDouble(int handle,
double value,
int size=DOUBLE_VALUE)uint FileWriteDouble(int file_handle,
double dvalue)FileWriteDoubleThe function writes a double value with floating point to a binary file.FileWriteDoubleint FileWriteInteger(int handle,
int value,
int size=LONG_VALUE)uint FileWriteInteger(int file_handle,
int ivalue,
int size=INT_VALUE)FileWriteIntegerThe function writes the integer value to a binary file.FileWriteIntegerint FileWriteString(int handle,
string value,
int size)uint FileWriteString(int file_handle,
string svalue,
int size=-1)FileWriteStringThe function writes the string to a binary file from the current file position.FileWriteString13. Global VariablesMQL4MQL5 Descriptionbool GlobalVariableCheck(string name)bool GlobalVariableCheck(string name)GlobalVariableCheckReturns TRUE if the global variable exists, otherwise, returns FALSE.GlobalVariableCheckbool GlobalVariableDel(string name)bool GlobalVariableDel(string name)GlobalVariableDelDeletes the global variable.GlobalVariableDeldouble GlobalVariableGet(string name)double GlobalVariableGet(string name)GlobalVariableGetReturns the value of an existing global variable or 0 if an error occurs.GlobalVariableGetstring GlobalVariableName(int index)string GlobalVariableName(int index)GlobalVariableNameThe function returns the name of a global variable by its index in the list of global variables.GlobalVariableNamedatetime GlobalVariableSet(string name,
double value)datetime GlobalVariableSet(string name,
double value)GlobalVariableSetSets a new value of the global variable. If it does not exist, the system creates a new global variable.GlobalVariableSetbool GlobalVariableSetOnCondition(string name,
double value,
double check_value)bool GlobalVariableSetOnCondition(string name,
double value,
double check_value)GlobalVariableSetOnConditionSets the new value of the existing global variable if the current value equals to the third parameter check_value.GlobalVariableSetOnConditionint GlobalVariablesDeleteAll(string prefix_name=NULL)int GlobalVariablesDeleteAll(string prefix_name=NULL
datetime limit_data=0)GlobalVariablesDeleteAllDeletes global variables.GlobalVariablesDeleteAllint GlobalVariablesTotal()int GlobalVariablesTotal()GlobalVariablesTotalThe function returns the total count of global variables.GlobalVariablesTotal14. Mathematical Functions MQL4MQL5 Descriptiondouble MathAbs(double value)double MathAbs(double value)MathAbsReturns the absolute value (modulus) of the specified numeric value.MathAbsdouble MathArccos(double x)double MathArccos(double val)MathArccosThe MathArccos function returns the arccosine of x within the range 0 to Pi (in radians).MathArccosdouble MathArcsin(double x)double MathArcsin(double val)MathArcsinThe MathArcsin function returns the arcsine of x in the range -Pi/2 to Pi/2 radians.MathArcsindouble MathArctan(double x)double MathArctan(double value)MathArctanThe MathArctan returns the arctangent of x.MathArctandouble MathCeil(double x)double MathCeil(double val)MathCeilThe MathCeil function returns a numeric value representing the smallest integer that exceeds or equals to x.MathCeildouble MathCos(double value)double MathCos(double value)MathCosReturns the cosine of the specified angle.MathCosdouble MathExp(double d)double MathExp(double value)MathExpReturns the value of e raised to the power of d.MathExpdouble MathFloor(double x)double MathFloor(double val)MathFloorThe MathFloor function returns a numeric value representing the largest integer that is less than or equal to x.MathFloordouble MathLog(double x)double MathLog(double val)MathLogThe MathLog function returns the natural logarithm of x if successful.MathLogdouble MathMax(double value1,
double value2)double MathMax(double value1,
double value2)MathMaxReturns the maximum value of two numeric values.MathMaxdouble MathMin(double value1,
double value2)double MathMin(double value1,
double value2)MathMinReturns the minimum value of two numeric values.MathMindouble MathMod(double value1,
double value2)double MathMod(double value1,
double value2)MathModThe function returns the floating-point remainder of division of two numbers.MathModdouble MathPow(double base,
double exponent)double MathPow(double base,
double exponent)MathPowReturns the value of the base expression raised to the specified power (exponent value).MathPowint MathRand()int MathRand()MathRandThe MathRand function returns a pseudorandom integer within the range of 0 to 32767.MathRanddouble MathRound(double value)double MathRound(double value)MathRoundReturns value rounded to the nearest integer of the specified numeric value.MathRounddouble MathSin(double value)double MathSin(double value)MathSinReturns the sine of the specified angle.MathSindouble MathSqrt(double x)double MathSqrt(double value)MathSqrtThe MathSqrt function returns the square root of x.MathSqrtvoid MathSrand(int seed)void MathSrand(int seed)MathSrandThe MathSrand() function sets the starting point for generating a series of pseudorandom integers.MathSranddouble MathTan(double x)double MathTan(double rad)MathTanMathTan returns the tangent of x.MathTan15. Object FunctionsMQL4 MQL5Descriptionbool ObjectCreate(string name,
int type,
int window,
datetime time1,
double price1,
datetime time2=0,
double price2=0,
datetime time3=0,
double price3=0)bool ObjectCreateMQL4(string name,
ENUM_OBJECT type,
int window,
datetime time1,
double price1,
datetime time2=0,
double price2=0,
datetime time3=0,
double price3=0)
{
return(ObjectCreate(0,name,type,window,
time1,price1,time2,price2,time3,price3));
}ObjectCreateCreation of an object with the specified name, type and initial coordinates in the specified window.ObjectCreatebool ObjectDelete(string name)bool ObjectDeleteMQL4(string name)
{
return(ObjectDelete(0,name));
}ObjectDeleteDeletes object having the specified name.ObjectDeletestring ObjectDescription(string name)string ObjectDescriptionMQL4(string name)
{
return(ObjectGetString(0,name,OBJPROP_TEXT));
}ObjectDescriptionReturn object description.ObjectGetStringint ObjectFind(string name)int ObjectFindMQL4(string name)
{
return(ObjectFind(0,name));
}ObjectFindSearch for an object having the specified name.ObjectFinddouble ObjectGet(string name,
int prop_id)double ObjectGetMQL4(string name,
int index)
{
switch(index)
{
case OBJPROP_TIME1:
return(ObjectGetInteger(0,name,OBJPROP_TIME));
case OBJPROP_PRICE1:
return(ObjectGetDouble(0,name,OBJPROP_PRICE));
case OBJPROP_TIME2:
return(ObjectGetInteger(0,name,OBJPROP_TIME,1));
case OBJPROP_PRICE2:
return(ObjectGetDouble(0,name,,1));
case OBJPROP_TIME3:
return(ObjectGetInteger(0,name,OBJPROP_TIME,2));
case OBJPROP_PRICE3:
return(ObjectGetDouble(0,name,OBJPROP_PRICE,2));
case OBJPROP_COLOR:
return(ObjectGetInteger(0,name,OBJPROP_COLOR));
case OBJPROP_STYLE:
return(ObjectGetInteger(0,name,OBJPROP_STYLE));
case OBJPROP_WIDTH:
return(ObjectGetInteger(0,name,OBJPROP_WIDTH));
case OBJPROP_BACK:
return(ObjectGetInteger(0,name,OBJPROP_WIDTH));
case OBJPROP_RAY:
return(ObjectGetInteger(0,name,OBJPROP_RAY_RIGHT));
case OBJPROP_ELLIPSE:
return(ObjectGetInteger(0,name,OBJPROP_ELLIPSE));
case OBJPROP_SCALE:
return(ObjectGetDouble(0,name,OBJPROP_SCALE));
case OBJPROP_ANGLE:
return(ObjectGetDouble(0,name,OBJPROP_ANGLE));
case OBJPROP_ARROWCODE:
return(ObjectGetInteger(0,name,OBJPROP_ARROWCODE));
case return(ObjectGetInteger(0,name,OBJPROP_TIMEFRAMES));
case OBJPROP_DEVIATION:
return(ObjectGetDouble(0,name,OBJPROP_DEVIATION));
case OBJPROP_FONTSIZE:
return(ObjectGetInteger(0,name,OBJPROP_FONTSIZE));
case OBJPROP_CORNER:
return(ObjectGetInteger(0OBJPROP_CORNER));
case OBJPROP_XDISTANCE:
return(ObjectGetInteger(0,name,OBJPROP_XDISTANCE));
case OBJPROP_YDISTANCE:
return(ObjectGetInteger(0,name,OBJPROP_YDISTANCE));
case OBJPROP_FIBOLEVELS:
return(ObjectGetInteger(0,name,OBJPROP_LEVELS));
case OBJPROP_LEVELCOLOR:
return(
}
}ObjectGetThe function returns the value of the specified object property.ObjectGetInteger, ObjectGetDoublestring ObjectGetFiboDescription(string name,
int index)string ObjectGetFiboDescriptionMQL4(string name,
int index)
{
return(ObjectGetString(0,name,OBJPROP_LEVELTEXT,index));
}ObjectGetFiboDescriptionThe function returns the level description of a Fibonacci object.ObjectGetStringint ObjectGetShiftByValue(string name,
double value)int ObjectGetShiftByValueMQL4(string name,
double
{
ENUM_TIMEFRAMES timeframe=TFMigrate(PERIOD_CURRENT);
datetime Arr[];
int shift;
MqlRates mql4[];
if(ObjectGetTimeByValue(0,name,value)<0) return(-1);
CopyRates(NULL,timeframe,0,1,mql4);
if(CopyTime(NULL,timeframe,mql4[0].time,
ObjectGetTimeByValue(0,name,value),Arr)>0)
return(ArraySize(Arr)-1);
else return(-1);
}ObjectGetShiftByValueThe function calculates and returns bar index (shift related to the current bar) for the given price.MqlRates, ObjectGetTimeByValue, CopyRates, CopyTime, ArraySizedouble ObjectGetValueByShift(string name,
int shift)double ObjectGetValueByShiftMQL4(string name,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(PERIOD_CURRENT);
MqlRates mql4[];
CopyRates(NULL,timeframe,shift,1,mql4);
return(ObjectGetValueByTime(0,name,mql4[0].time,0));
}ObjectGetValueByShiftThe function calculates and returns the price value for the specified bar (shift related to the current bar).MqlRates, CopyRates, ObjectGetValueByTimebool ObjectMove(string name,
int point,
datetime time1,
double price1)bool ObjectMoveMQL4(string name,
int point,
datetime time1,
double price1)
{
return(ObjectMove(0,name,point,time1,price1));
}ObjectMoveThe function moves an object coordinate in the chart. Objects can have from one to three coordinates depending on their types.ObjectMovestring ObjectName(int index)string ObjectNameMQL4(int index)
{
return(ObjectName(0,index));
}ObjectNameThe function returns the object name by its index in the objects list.ObjectNameint ObjectsDeleteAll(int window=EMPTY,
int type=EMPTY)int ObjectsDeleteAllMQL4(int window=EMPTY,
int type=EMPTY)
{
return(ObjectsDeleteAll(0,window,type));
}ObjectsDeleteAllRemoves all objects of the specified type and in the specified sub-window of the chart.ObjectsDeleteAllbool ObjectSet(string name,
int prop_id,
double value)bool ObjectSetMQL4(string name,
int index,
double value)
{
switch(index)
{
case OBJPROP_TIME1:
ObjectSetInteger(0,name,OBJPROP_TIME,(int)value);return(true);
case OBJPROP_PRICE1:
ObjectSetDouble(0,name,OBJPROP_PRICE,value);return(true);
case OBJPROP_TIME2:
ObjectSetInteger(0,name,OBJPROP_TIME,1,(int)value);return(true);
case OBJPROP_PRICE2:
ObjectSetDouble(0,name,OBJPROP_PRICE,1,value);return(true);
case OBJPROP_TIME3:
ObjectSetInteger(0,name,OBJPROP_TIME,2,(int)value);return(true);
case OBJPROP_PRICE3:
ObjectSetDouble(0,name,OBJPROP_PRICE,2,value);return(true);
case OBJPROP_COLOR:
ObjectSetInteger(0,name,OBJPROP_COLOR,(int)value);return(true);
case OBJPROP_STYLE:
ObjectSetInteger(0,name,OBJPROP_STYLE,(int)value);return(true);
case OBJPROP_WIDTH:
ObjectSetInteger(0,name,OBJPROP_WIDTH,(int)value);return(true);
case OBJPROP_BACK:
ObjectSetInteger(0,name,OBJPROP_BACK,(int)value);return(true);
case OBJPROP_RAY:
ObjectSetInteger(0,name,OBJPROP_RAY_RIGHT,(int)value);return(true);
case OBJPROP_ELLIPSE:
ObjectSetInteger(0,name,OBJPROP_ELLIPSE,(int)value);return(true);
case OBJPROP_SCALE:
ObjectSetDouble(0,name,OBJPROP_SCALE,value);return(true);
case OBJPROP_ANGLE:
ObjectSetDouble(0,name,OBJPROP_ANGLE,value);return(true);
case OBJPROP_ARROWCODE:
ObjectSetInteger(0,name,OBJPROP_ARROWCODE,(int)value);return(true);
case OBJPROP_TIMEFRAMES:
ObjectSetInteger(0,name,OBJPROP_TIMEFRAMES,(int)value);return(true);
case OBJPROP_DEVIATION:
ObjectSetDouble(0,name,OBJPROP_DEVIATION,value);return(true);
case OBJPROP_FONTSIZE:
ObjectSetInteger(0,name,OBJPROP_FONTSIZE,(int)value);return(true);
case OBJPROP_CORNER:
ObjectSetInteger(0,name,OBJPROP_CORNER,(int)value);return(true);
case OBJPROP_XDISTANCE:
ObjectSetInteger(0,name,OBJPROP_XDISTANCE,(int)value);return(true);
case OBJPROP_YDISTANCE:
ObjectSetInteger(0,name,OBJPROP_YDISTANCE,(int)value);return(true);
case OBJPROP_FIBOLEVELS:
ObjectSetInteger(0,name,OBJPROP_LEVELS,(int)value);return(true);
case OBJPROP_LEVELCOLOR:
ObjectSetInteger(0,name,OBJPROP_LEVELCOLOR,(int)value);return(true);
case OBJPROP_LEVELSTYLE:
ObjectSetInteger(0,name,OBJPROP_LEVELSTYLE,(int)value);return(true);
case OBJPROP_LEVELWIDTH:
ObjectSetInteger(0,name,OBJPROP_LEVELWIDTH,(int)value);return(true);
default: return(false);
}
return(false);
}ObjectSetChanges the value of the specified object property.ObjectSetInteger, ObjectSetDoublebool ObjectSetFiboDescription(string name,
int index,
string text)bool ObjectSetFiboDescriptionMQL4(string name,
int index,
string text)
{
return(ObjectSetString(0,name,OBJPROP_LEVELTEXT,index,text));
}ObjectSetFiboDescriptionThe function assigns a new description to a level of a Fibonacci object.ObjectSetStringbool ObjectSetText(string name,
string text,
int font_size,
string font_name=NULL,
color text_color=CLR_NONE)bool ObjectSetTextMQL4(string name,
string text,
int font_size,
string font="",
color text_color=CLR_NONE)
{
int tmpObjType=(int)ObjectGetInteger(0,name,OBJPROP_TYPE);
if(tmpObjType!=OBJ_LABEL && tmpObjType!=OBJ_TEXT) return(false);
if(StringLen(text)>0 && font_size>0)
{
if(ObjectSetString(0,name,OBJPROP_TEXT,text)==true
&& ObjectSetInteger(0,name,OBJPROP_FONTSIZE,font_size)==true)
{
if((StringLen(font)>0)
&& ObjectSetString(0,name,OBJPROP_FONT,font)==false)
return(false);
if(text_color>-1
&& ObjectSetInteger(0,name,OBJPROP_COLOR,text_color)==false)
return(false);
return(true);
}
return(false);
}
return(false);
}ObjectSetTextChanges the object description.ObjectGetInteger, ObjectSetString, ObjectSetInteger StringLenint ObjectsTotal(int type=EMPTY)int ObjectsTotalMQL4(int type=EMPTY,
int window=-1)
{
return(ObjectsTotal(0,window,type));
}ObjectsTotalReturns total amount of objects of the specified type in the chart.ObjectsTotalint ObjectType(string name)int ObjectTypeMQL4(string name)
{
return((int)ObjectGetInteger(0,name,OBJPROP_TYPE));
}ObjectTypeThe function returns the object type value.ObjectGetInteger16. String FunctionsMQL4MQL5 Descriptionstring StringConcatenate(...)int StringConcatenate(string &string_var,
void argument1
void argument2
...)StringConcatenateForms a string of the data passed and returns it.StringConcatenateint StringFind(string text,
string matched_text,
int start=0)int StringFind(string string_value,
string match_substring,
int start_pos=0)StringFindSearch for a substring. Returns the position in the string from which the searched substring begins, or -1 if the substring has not been found.StringFindint StringGetChar(string text,
int pos)ushort StringGetCharacter(string string_value,
int pos)StringGetCharReturns character (code) from the specified position in the string.StringGetCharacterint StringLen(string text)int StringLen(string string_value)StringLenReturns character count in a string.StringLenstring StringSetChar(string text,
int pos,
int value)bool StringSetCharacter(string &string_var,
int pos,
ushort character)StringSetCharReturns the string copy with changed character in the specified position.StringSetCharacterstring StringSubstr(string text,
int start,
int length=0)string StringSubstr(string string_value,
int start_pos,
int length=-1)StringSubstrExtracts a substring from text string starting from the given position.StringSubstrstring StringTrimLeft(string text)int StringTrimLeft(string& string_var)StringTrimLeftThe function cuts line feed characters, spaces and tabs in the left part of the string.StringTrimLeftstring StringTrimRight(string text)int StringTrimRight(string& string_var)StringTrimRightThe function cuts line feed characters, spaces and tabs in the right part of the string.StringTrimRight17. Technical IndicatorsThe principles of use of the technical indicators in Expert Advisors are considered in the article MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors. The method, used in this reference is sufficient to get the indicator calculation results for the specified price. To use this method, we need the auxiliary function:double CopyBufferMQL4(int handle,int index,int shift)
{
double buf[];
switch(index)
{
case 0: if(CopyBuffer(handle,0,shift,1,buf)>0)
return(buf[0]); break;
case 1: if(CopyBuffer(handle,1,shift,1,buf)>0)
return(buf[0]); break;
case 2: if(CopyBuffer(handle,2,shift,1,buf)>0)
return(buf[0]); break;
case 3: if(CopyBuffer(handle,3,shift,1,buf)>0)
return(buf[0]); break;
case 4: if(CopyBuffer(handle,4,shift,1,buf)>0)
return(buf[0]); break;
default: break;
}
return(EMPTY_VALUE);
}let's declare the following constants:ENUM_MA_METHOD MethodMigrate(int method)
{
switch(method)
{
case 0: return(MODE_SMA);
case 1: return(MODE_EMA);
case 2: return(MODE_SMMA);
case 3: return(MODE_LWMA);
default: return(MODE_SMA);
}
}
ENUM_APPLIED_PRICE PriceMigrate(int price)
{
switch(price)
{
case 1: return(PRICE_CLOSE);
case 2: return(PRICE_OPEN);
case 3: return(PRICE_HIGH);
case 4: return(PRICE_LOW);
case 5: return(PRICE_MEDIAN);
case 6: return(PRICE_TYPICAL);
case 7: return(PRICE_WEIGHTED);
default: return(PRICE_CLOSE);
}
}
ENUM_STO_PRICE StoFieldMigrate(int field)
{
switch(field)
{
case 0: return(STO_LOWHIGH);
case 1: return(STO_CLOSECLOSE);
default: return(STO_LOWHIGH);
}
}
//+------------------------------------------------------------------+
enum ALLIGATOR_MODE { MODE_GATORJAW=1, MODE_GATORTEETH, MODE_GATORLIPS };
enum ADX_MODE { MODE_MAIN, MODE_PLUSDI, MODE_MINUSDI };
enum UP_LOW_MODE { MODE_BASE, MODE_UPPER, MODE_LOWER };
enum ICHIMOKU_MODE { MODE_TENKANSEN=1, MODE_KIJUNSEN, MODE_SENKOUSPANA, MODE_SENKOUSPANB, MODE_CHINKOUSPAN };
enum MAIN_SIGNAL_MODE{ MODE_MAIN, MODE_SIGNAL };MQL4 MQL5 Decsriptiondouble iAC(string symbol,
int timeframe,
int shift)double iACMQL4(string symbol,
int tf,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iAC(symbol,timeframe);
if(handle<0)
{
Print("The iAC object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iACCalculates the Bill Williams' Accelerator/Decelerator oscillator.iACdouble iAD(string symbol,
int timeframe,
int shift)double iADMQL4(string symbol,
int tf,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=(int)iAD(symbol,timeframe,VOLUME_TICK);
if(handle<0)
{
Print("The iAD object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iADCalculates the Accumulation/Distribution indicator and returns its value.iADdouble iAlligator(string symbol,
int timeframe,
int jaw_period,
int jaw_shift,
int teeth_period,
int teeth_shift,
int lips_period,
int lips_shift,
int ma_method,
int applied_price,
int mode,
int shift)double iAlligatorMQL4(string symbol,
int tf,
int jaw_period,
int jaw_shift,
int teeth_period,
int teeth_shift,
int lips_period,
int lips_shift,
int method,
int price,
int mode,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_MA_METHOD ma_method=MethodMigrate(method);
ENUM_APPLIED_PRICE applied_price=PriceMigrate(price);
int handle=iAlligator(symbol,timeframe,jaw_period,jaw_shift,
teeth_period,teeth_shift,
lips_period,lips_shift,
ma_method,applied_price);
if(handle<0)
{
Print("The iAlligator object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,mode-1,shift));
}iAlligatorCalculates the Bill Williams' Alligator and returns its value.iAlligatordouble iADX(string symbol,
int timeframe,
int period,
int applied_price,
int mode,
int shift)double iADXMQL4(string symbol,
int tf,
int period,
int price,
int mode,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iADX(symbol,timeframe,period);
if(handle<0)
{
Print("The iADX object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,mode,shift));
}iADXCalculates the Movement directional index and returns its value.iADXdouble iATR(string symbol,
int timeframe,
int period,
int shift)double iATRMQL4(string symbol,
int tf,
int period,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iATR(symbol,timeframe,period);
if(handle<0)
{
Print("The iATR object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iATRCalculates the Indicator of the average true range and returns its value.iATRdouble iAO(string symbol,
int timeframe,
int shift)double iAOMQL4(string symbol,
int tf,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iAO(symbol,timeframe);
if(handle<0)
{
Print("The iAO object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iAOCalculates the Bill Williams' Awesome oscillator and returns its value.iAOdouble iBearsPower(string symbol,
int timeframe,
int period,
int applied_price,
int shift)double iBearsPowerMQL4(string symbol,
int tf,
int period,
int price,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iBearsPower(symbol,timeframe,period);
if(handle<0)
{
Print("The iBearsPower object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iBearsPowerCalculates the Bears Power indicator and returns its value.iBearsPowerdouble iBands(string symbol,
int timeframe,
int period,
int deviation,
int bands_shift,
int applied_price,
int mode,
int shift)double iBandsMQL4(string symbol,
int tf,
int period,
double deviation,
int bands_shift,
int method,
int mode,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_MA_METHOD ma_method=MethodMigrate(method);
int handle=iBands(symbol,timeframe,period,
bands_shift,deviation,ma_method);
if(handle<0)
{
Print("The iBands object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,mode,shift));
}iBandsCalculates the Bollinger bands indicator and returns its value.iBandsdouble iBandsOnArray(double array[],
int total,
int period,
int deviation,
int bands_shift,
int mode,
int shift)-iBandsOnArrayCalculation of the Bollinger Bands indicator on data stored in a numeric array.double iBullsPower(string symbol,
int timeframe,
int period,
int applied_price,
int shift)double iBullsPowerMQL4(string symbol,
int tf,
int period,
int price,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iBullsPower(symbol,timeframe,period);
if(handle<0)
{
Print("The iBullsPower object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iBullsPowerCalculates the Bulls Power indicator and returns its value.iBullsPowerdouble iCCI(string symbol,
int timeframe,
int period,
int applied_price,
int shift)double iCCIMQL4(string symbol,
int tf,
int period,
int price,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_APPLIED_PRICE applied_price=PriceMigrate(price);
int handle=iCCI(symbol,timeframe,period,price);
if(handle<0)
{
Print("The iCCI object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iCCICalculates the Commodity channel index and returns its value.iCCIdouble iCCIOnArray(double array[],
int total,
int period,
int shift)-iCCIOnArrayCalculation of the Commodity Channel Index on data stored in a numeric array.double iCustom(string symbol,
int timeframe,
string name,
...,
int mode,
int shift)int iCustom(string symbol,
ENUM_TIMEFRAMES period,
string name
...)iCustomCalculates the specified custom indicator and returns its value.iCustomdouble iDeMarker(string symbol,
int timeframe,
int period,
int shift)double iDeMarkerMQL4(string symbol,
int tf,
int period,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iDeMarker(symbol,timeframe,period);
if(handle<0)
{
Print("The iDeMarker object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iDeMarkerCalculates the DeMarker indicator and returns its value.iDeMarkerdouble iEnvelopes(string symbol,
int timeframe,
int ma_period,
int ma_method,
int ma_shift,
int applied_price,
double deviation,
int mode,
int shift)double EnvelopesMQL4(string symbol,
int tf,
int ma_period,
int method,
int ma_shift,
int price,
double deviation,
int mode,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_MA_METHOD ma_method=MethodMigrate(method);
ENUM_APPLIED_PRICE applied_price=PriceMigrate(price);
int handle=iEnvelopes(symbol,timeframe,
ma_period,ma_shift,ma_method,
applied_price,deviation);
if(handle<0)
{
Print("The iEnvelopes object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,mode-1,shift));
}iEnvelopesCalculates the Envelopes indicator and returns its value.iEnvelopesdouble iEnvelopesOnArray(double array[],
int total,
int ma_period,
int ma_method,
int ma_shift,
double deviation,
int mode,
int shift)-iEnvelopesOnArrayCalculation of the Envelopes indicator on data stored in a numeric array.double iForce(string symbol,
int timeframe,
int period,
int ma_method,
int applied_price,
int shift)double iForceMQL4(string symbol,
int tf,
int period,
int method,
int price,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_MA_METHOD ma_method=MethodMigrate(method);
int handle=iForce(symbol,timeframe,period,ma_method,VOLUME_TICK);
if(handle<0)
{
Print("The iForce object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iForceCalculates the Force index and returns its value.iForcedouble iFractals(string symbol,
int timeframe,
int mode,
int shift)double iFractalsMQL4(string symbol,
int tf,
int mode,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iFractals(symbol,timeframe);
if(handle<0)
{
Print("The iFractals object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,mode-1,shift));
}iFractalsCalculates the Fractals and returns its value.iFractalsdouble iGator(string symbol,
int timeframe,
int jaw_period,
int jaw_shift,
int teeth_period,
int teeth_shift,
int lips_period,
int lips_shift,
int ma_method,
int applied_price,
int mode,
int shift)double iGatorMQL4(string symbol,
int tf,
int jaw_period,
int jaw_shift,
int teeth_period,
int teeth_shift,
int lips_period,
int lips_shift,
int method,
int price,
int mode,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_MA_METHOD ma_method=MethodMigrate(method);
ENUM_APPLIED_PRICE applied_price=PriceMigrate(price);
int handle=iGator(symbol,timeframe,jaw_period,jaw_shift,
teeth_period,teeth_shift,
lips_period,lips_shift,
ma_method,applied_price);
if(handle<0)
{
Print("The iGator object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,mode-1,shift));
}iGatorGator oscillator calculation.iGatordouble iIchimoku(string symbol,
int timeframe,
int tenkan_sen,
int kijun_sen,
int senkou_span_b,
int mode,
int shift)double iIchimokuMQL4(string symbol,
int tf,
int tenkan_sen,
int kijun_sen,
int senkou_span_b,
int mode,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iIchimoku(symbol,timeframe,
tenkan_sen,kijun_sen,senkou_span_b);
if(handle<0)
{
Print("The iIchimoku object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,mode-1,shift));
}iIchimokuCalculates the Ichimoku Kinko Hyo and returns its value.iIchimokudouble iBWMFI(string symbol,
int timeframe,
int shift)double iBWMFIMQL4(string symbol,
int tf,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=(int)iBWMFI(symbol,timeframe,VOLUME_TICK);
if(handle<0)
{
Print("The iBWMFI object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iBWMFICalculates the Bill Williams Market Facilitation index and returns its value.iBWMFIdouble iMomentum(string symbol,
int timeframe,
int period,
int applied_price,
int shift)double iMomentumMQL4(string symbol,
int tf,
int period,
int price,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_APPLIED_PRICE applied_price=PriceMigrate(price);
int handle=iMomentum(symbol,timeframe,period,applied_price);
if(handle<0)
{
Print("The iMomentum object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iMomentumCalculates the Momentum indicator and returns its value.iMomentumdouble iMomentumOnArray(double array[],
int total,
int period,
int shift)-iMomentumOnArrayCalculation of the Momentum indicator on data stored in a numeric array.double iMFI(string symbol,
int timeframe,
int period,
int shift)double iMFIMQL4(string symbol,
int tf,
int period,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=(int)iMFI(symbol,timeframe,period,VOLUME_TICK);
if(handle<0)
{
Print("The iMFI object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iMFICalculates the Money flow index and returns its value.iMFIdouble iMA(string symbol,
int timeframe,
int period,
int ma_shift,
int ma_method,
int applied_price,
int shift)double iMAMQL4(string symbol,
int tf,
int period,
int ma_shift,
int method,
int price,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_MA_METHOD ma_method=MethodMigrate(method);
ENUM_APPLIED_PRICE applied_price=PriceMigrate(price);
int handle=iMA(symbol,timeframe,period,ma_shift,
ma_method,applied_price);
if(handle<0)
{
Print("The iMA object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iMACalculates the Moving average indicator and returns its value.iMAdouble iMAOnArray(double array[],
int total,
int period,
int ma_shift,
int ma_method,
int shift)double iMAOnArrayMQL4(double &array[],
int total,
int period,
int ma_shift,
int ma_method,
int shift)
{
double buf[],arr[];
if(total==0) total=ArraySize(array);
if(total>0 && total<=period) return(0);
if(shift>total-period-ma_shift) return(0);
switch(ma_method)
{
case MODE_SMA :
{
total=ArrayCopy(arr,array,0,shift+ma_shift,period);
if(ArrayResize(buf,total)<0) return(0);
double sum=0;
int i,pos=total-1;
for(i=1;i<period;i++,pos--)
sum+=arr[pos];
while(pos>=0)
{
sum+=arr[pos];
buf[pos]=sum/period;
sum-=arr[pos+period-1];
pos--;
}
return(buf[0]);
}
case MODE_EMA :
{
if(ArrayResize(buf,total)<0) return(0);
double pr=2.0/(period+1);
int pos=total-2;
while(pos>=0)
{
if(pos==total-2) buf[pos+1]=array[pos+1];
buf[pos]=array[pos]*pr+buf[pos+1]*(1-pr);
pos--;
}
return(buf[shift+ma_shift]);
}
case MODE_SMMA :
{
if(ArrayResize(buf,total)<0) return(0);
double sum=0;
int i,k,pos;
pos=total-period;
while(pos>=0)
{
if(pos==total-period)
{
for(i=0,k=pos;i<period;i++,k++)
{
sum+=array[k];
buf[k]=0;
}
}
else sum=buf[pos+1]*(period-1)+array[pos];
buf[pos]=sum/period;
pos--;
}
return(buf[shift+ma_shift]);
}
case MODE_LWMA :
{
if(ArrayResize(buf,total)<0) return(0);
double sum=0.0,lsum=0.0;
double price;
int i,weight=0,pos=total-1;
for(i=1;i<=period;i++,pos--)
{
price=array[pos];
sum+=price*i;
lsum+=price;
weight+=i;
}
pos++;
i=pos+period;
while(pos>=0)
{
buf[pos]=sum/weight;
if(pos==0) break;
pos--;
i--;
price=array[pos];
sum=sum-lsum+price*period;
lsum-=array[i];
lsum+=price;
}
return(buf[shift+ma_shift]);
}
default: return(0);
}
return(0);
}double iOsMA(string symbol,
int timeframe,
int fast_ema_period,
int slow_ema_period,
int signal_period,
int applied_price,
int shift)double iOsMAMQL4(string symbol,
int tf,
int fast_ema_period,
int slow_ema_period,
int signal_period,
int price,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_APPLIED_PRICE applied_price=PriceMigrate(price);
int handle=iOsMA(symbol,timeframe,
fast_ema_period,slow_ema_period,
signal_period,applied_price);
if(handle<0)
{
Print("The iOsMA object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iOsMACalculates the Moving Average of Oscillator and returns its value.iOsMAdouble iMACD(string symbol,
int timeframe,
int fast_ema_period,
int slow_ema_period,
int signal_period,
int applied_price,
int mode,
int shift)double iMACDMQL4(string symbol,
int tf,
int fast_ema_period,
int slow_ema_period,
int signal_period,
int price,
int mode,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_APPLIED_PRICE applied_price=PriceMigrate(price);
int handle=iMACD(symbol,timeframe,
fast_ema_period,slow_ema_period,
signal_period,applied_price);
if(handle<0)
{
Print("The iMACD object is not created: Error ",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,mode,shift));
}iMACDCalculates the Moving averages convergence/divergence and returns its value.iMACDdouble iOBV(string symbol,
int timeframe,
int applied_price,
int shift)double iOBVMQL4(string symbol,
int tf,
int price,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iOBV(symbol,timeframe,VOLUME_TICK);
if(handle<0)
{
Print("The iOBV object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iOBVCalculates the On Balance Volume indicator and returns its value.iOBVdouble iSAR(string symbol,
int timeframe,
double step,
double maximum,
int shift)double iSARMQL4(string symbol,
int tf,
double step,
double maximum,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iSAR(symbol,timeframe,step,maximum);
if(handle<0)
{
Print("The iSAR object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iSARCalculates the Parabolic Stop and Reverse system and returns its value.iSARdouble iRSI(string symbol,
int timeframe,
int period,
int applied_price,
int shift)double iRSIMQL4(string symbol,
int tf,
int period,
int price,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_APPLIED_PRICE applied_price=PriceMigrate(price);
int handle=iRSI(symbol,timeframe,period,applied_price);
if(handle<0)
{
Print("The iRSI object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iRSICalculates the Relative strength index and returns its value.iRSIdouble iRSIOnArray(double array[],
int total,
int period,
int shift)-iRSIOnArrayCalculation of the Relative Strength Index on data stored in a numeric array.double iRVI(string symbol,
int timeframe,
int period,
int mode,
int shift)double iRVIMQL4(string symbol,
int tf,
int period,
int mode,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iRVI(symbol,timeframe,period);
if(handle<0)
{
Print("The iRVI object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,mode,shift));
}iRVICalculates the Relative Vigor index and returns its value.iRVIdouble iStdDev(string symbol,
int timeframe,
int ma_period,
int ma_shift,
int ma_method,
int applied_price,
int shift)double iStdDevMQL4(string symbol,
int tf,
int ma_period,
int ma_shift,
int method,
int price,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_MA_METHOD ma_method=MethodMigrate(method);
ENUM_APPLIED_PRICE applied_price=PriceMigrate(price);
int handle=iStdDev(symbol,timeframe,ma_period,ma_shift,
ma_method,applied_price);
if(handle<0)
{
Print("The iStdDev object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iStdDevCalculates the Standard Deviation indicator and returns its value.iStdDevdouble iStdDevOnArray(double array[],
int total,
int ma_period,
int ma_shift,
int ma_method,
int shift)-iStdDevOnArrayCalculation of the Standard Deviation indicator on data stored in a numeric array.double iStochastic(string symbol,
int timeframe,
int%Kperiod,
int%Dperiod,
int slowing,
int method,
int price_field,
int mode,
int shift)double iStochasticMQL4(string symbol,
int tf,
int Kperiod,
int Dperiod,
int slowing,
int method,
int field,
int mode,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
ENUM_MA_METHOD ma_method=MethodMigrate(method);
ENUM_STO_PRICE price_field=StoFieldMigrate(field);
int handle=iStochastic(symbol,timeframe,Kperiod,Dperiod,
slowing,ma_method,price_field);
if(handle<0)
{
Print("The iStochastic object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,mode,shift));
}iStochasticCalculates the Stochastic oscillator and returns its value.iStochasticdouble iWPR(string symbol,
int timeframe,
int period,
int shift)double iWPRMQL4(string symbol,
int tf,
int period,
int shift)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
int handle=iWPR(symbol,timeframe,period);
if(handle<0)
{
Print("The iWPR object is not created: Error",GetLastError());
return(-1);
}
else
return(CopyBufferMQL4(handle,0,shift));
}iWPRCalculates the Larry William's percent range indicator and returns its value.iWPR18. Timeseries AccessMQL4 MQL5 Descriptionint iBars(string symbol,
int timeframe)int iBarsMQL4(string symbol,int tf)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
return(Bars(symbol,timeframe));
}
int iBarsMQL4(string symbol,int tf)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
return(Bars(symbol,timeframe));
}BarsReturns the number of bars on the specified chart.Barsint iBarShift(string symbol,
int timeframe,
datetime time,
bool exact=falseint iBarShiftMQL4(string symbol,
int tf,
datetime time,
bool exact=false)
{
if(time<0) return(-1);
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
datetime Arr[],time1;
CopyTime(symbol,timeframe,0,1,Arr);
time1=Arr[0];
if(CopyTime(symbol,timeframe,time,time1,Arr)>0)
{
if(ArraySize(Arr)>2) return(ArraySize(Arr)-1);
if(time<time1) return(1);
else return(0);
}
else return(-1);
}iBarShiftSearch for bar by open time.CopyTime, ArraySizedouble iClose(string symbol,
int timeframe,
int shift)double iCloseMQL4(string symbol,int tf,int index)
{
if(index < 0) return(-1);
double Arr[];
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(CopyClose(symbol,timeframe, index, 1, Arr)>0)
return(Arr[0]);
else return(-1);
}CloseReturns Close value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.CopyRates, MqlRatesdouble iHigh(string symbol,
int timeframe,
int shift)double iHighMQL4(string symbol,int tf,int index)
{
if(index < 0) return(-1);
double Arr[];
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(CopyHigh(symbol,timeframe, index, 1, Arr)>0)
return(Arr[0]);
else return(-1);
}
HighReturns High value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.CopyRates, MqlRatesint iHighest(string symbol,
int timeframe,
int type,
int count=WHOLE_ARRAY,
int start=0)int iHighestMQL4(string symbol,
int tf,
int type,
int count=WHOLE_ARRAY,
int start=0)
{
if(start<0) return(-1);
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(count<=0) count=Bars(symbol,timeframe);
if(type<=MODE_OPEN)
{
double Open[];
ArraySetAsSeries(Open,true);
CopyOpen(symbol,timeframe,start,count,Open);
return(ArrayMaximum(Open,0,count)+start);
}
if(type==MODE_LOW)
{
double Low[];
ArraySetAsSeries(Low,true);
CopyLow(symbol,timeframe,start,count,Low);
return(ArrayMaximum(Low,0,count)+start);
}
if(type==MODE_HIGH)
{
double High[];
ArraySetAsSeries(High,true);
CopyHigh(symbol,timeframe,start,count,High);
return(ArrayMaximum(High,0,count)+start);
}
if(type==MODE_CLOSE)
{
double Close[];
ArraySetAsSeries(Close,true);
CopyClose(symbol,timeframe,start,count,Close);
return(ArrayMaximum(Close,0,count)+start);
}
if(type==MODE_VOLUME)
{
long Volume[];
ArraySetAsSeries(Volume,true);
CopyTickVolume(symbol,timeframe,start,count,Volume);
return(ArrayMaximum(Volume,0,count)+start);
}
if(type>=MODE_TIME)
{
datetime Time[];
ArraySetAsSeries(Time,true);
CopyTime(symbol,timeframe,start,count,Time);
return(ArrayMaximum(Time,0,count)+start);
//---
}
return(0);
}iHighestReturns the shift of the maximum value over a specific number of periods depending on type.CopyOpen, CopyLow, CopyHigh, CopyClose, CopyTickVolume, CopyTime, ArrayMaximumdouble iLow(string symbol,
int timeframe,
int shift)double iLowMQL4(string symbol,int tf,int index)
{
if(index < 0) return(-1);
double Arr[];
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(CopyLow(symbol,timeframe, index, 1, Arr)>0)
return(Arr[0]);
else return(-1);
}iLowReturns Low value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.CopyRates, MqlRatesint iLowest(string symbol,
int timeframe,
int type,
int count=WHOLE_ARRAY,
int start=0)int iLowestMQL4(string symbol,
int tf,
int type,
int count=WHOLE_ARRAY,
int start=0)
{
if(start<0) return(-1);
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(count<=0) count=Bars(symbol,timeframe);
if(type<=MODE_OPEN)
{
double Open[];
ArraySetAsSeries(Open,true);
CopyOpen(symbol,timeframe,start,count,Open);
return(ArrayMinimum(Open,0,count)+start);
}
if(type==MODE_LOW)
{
double Low[];
ArraySetAsSeries(Low,true);
CopyLow(symbol,timeframe,start,count,Low);
return(ArrayMinimum(Low,0,count)+start);
}
if(type==MODE_HIGH)
{
double High[];
ArraySetAsSeries(High,true);
CopyHigh(symbol,timeframe,start,count,High);
return(ArrayMinimum(High,0,count)+start);
}
if(type==MODE_CLOSE)
{
double Close[];
ArraySetAsSeries(Close,true);
CopyClose(symbol,timeframe,start,count,Close);
return(ArrayMinimum(Close,0,count)+start);
}
if(type==MODE_VOLUME)
{
long Volume[];
ArraySetAsSeries(Volume,true);
CopyTickVolume(symbol,timeframe,start,count,Volume);
return(ArrayMinimum(Volume,0,count)+start);
}
if(type>=MODE_TIME)
{
datetime Time[];
ArraySetAsSeries(Time,true);
CopyTime(symbol,timeframe,start,count,Time);
return(ArrayMinimum(Time,0,count)+start);
}
//---
return(0);
}iLowestReturns the shift of the lowest value over a specific number of periods depending on type.CopyOpen, CopyLow, CopyHigh, CopyClose, CopyTickVolume, CopyTime, ArrayMinimumdouble iOpen(string symbol,
int timeframe,
int shift)double iOpenMQL4(string symbol,int tf,int index)
{
if(index < 0) return(-1);
double Arr[];
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(CopyOpen(symbol,timeframe, index, 1, Arr)>0)
return(Arr[0]);
else return(-1);
}iOpenReturns Open value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.CopyRates, MqlRatesdatetime iTime(string symbol,
int timeframe,
int shift)datetime iTimeMQL4(string symbol,int tf,int index)
{
if(index < 0) return(-1);
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
datetime Arr[];
if(CopyTime(symbol, timeframe, index, 1, Arr)>0)
return(Arr[0]);
else return(-1);
}iTimeReturns Time value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.CopyRates, MqlRatesdouble iVolume(string symbol,
int timeframe,
int shift)int iVolumeMQL4(string symbol,int tf,int index)
{
if(index < 0) return(-1);
long Arr[];
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
if(CopyTickVolume(symbol, timeframe, index, 1, Arr)>0)
return(Arr[0]);
else return(-1);
}iVolumeReturns Tick Volume value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.CopyRates, MqlRates19. Chart OperationsMQL4 MQL5Descriptionvoid HideTestIndicators(bool hide)-HideTestIndicatorsThe function sets a flag hiding indicators called by the Expert Advisor.int Period()ENUM_TIMEFRAMES Period()PeriodReturns the amount of minutes determining the used period (chart timeframe).Periodbool RefreshRates()-RefreshRatesRefreshing of data in pre-defined variables and series arrays.string Symbol()string Symbol()SymbolReturns a text string with the name of the current financial instrument.Symbolint WindowBarsPerChart()int ChartGetInteger(0,CHART_VISIBLE_BARS,0)WindowBarsPerChartFunction returns the amount of bars visible on the chart.ChartGetIntegerstring WindowExpertName()string MQLInfoString(MQL5_PROGRAM_NAME)WindowExpertNameReturns name of the executed expert, script, custom indicator, or library, depending on the MQL4 program, from which this function has been called.MQLInfoStringint WindowFind(string name)int WindowFindMQL4(string name)
{
int window=-1;
if((ENUM_PROGRAM_TYPE)MQLInfoInteger(MQL5_PROGRAM_TYPE)==PROGRAM_INDICATOR)
{
window=ChartWindowFind();
}
else
{
window=ChartWindowFind(0,name);
if(window==-1) Print(__FUNCTION__+"(): Error = ",GetLastError());
}
return(window);
}WindowFindIf indicator with name was found, the function returns the window index containing this specified indicator, otherwise it returns -1.ChartWindowFind, MQLInfoIntegerint WindowFirstVisibleBar()int ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR,0)WindowFirstVisibleBarThe function returns the first visible bar number in the current chart window.ChartGetIntegerint WindowHandle(string symbol,
int timeframe)int WindowHandleMQL4(string symbol,
int tf)
{
ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
long currChart,prevChart=ChartFirst();
int i=0,limit=100;
while(i<limit)
{
currChart=ChartNext(prevChart);
if(currChart<0) break;
if(ChartSymbol(currChart)==symbol
&& ChartPeriod(currChart)==timeframe)
return((int)currChart);
prevChart=currChart;
i++;
}
return(0);
}WindowHandleReturns the system window handle of the specified chart.ChartFirst, ChartNext, ChartSymbol, ChartPeriodbool WindowIsVisible(int index)bool ChartGetInteger(0,CHART_WINDOW_IS_VISIBLE,index)WindowIsVisibleReturns TRUE if the chart subwindow is visible, otherwise returns FALSE.ChartGetIntegerint WindowOnDropped()int ChartWindowOnDropped()WindowOnDroppedReturns window index where expert, custom indicator or script was dropped.ChartWindowOnDroppeddouble WindowPriceMax(int index=0)double ChartGetDouble(0,CHART_PRICE_MAX,index)WindowPriceMaxReturns maximal value of the vertical scale of the specified subwindow of the current chart (0-main chart window, the indicators' subwindows are numbered starting from 1).ChartGetDoubledouble WindowPriceMin(int index=0)double ChartGetDouble(0,CHART_PRICE_MIN,index)WindowPriceMinReturns minimal value of the vertical scale of the specified subwindow of the current chart (0-main chart window, the indicators' subwindows are numbered starting from 1).ChartGetDoubledouble WindowPriceOnDropped()double ChartPriceOnDropped()WindowPriceOnDroppedReturns the price part of the chart point where expert or script was dropped.ChartPriceOnDroppedvoid WindowRedraw()void ChartRedraw(0)WindowRedrawRedraws the current chart forcedly.ChartRedrawbool WindowScreenShot(string filename,
int size_x,
int size_y,
int start_bar=-1,
int chart_scale=-1,
int chart_mode=-1)bool WindowScreenShotMQL4(string filename,
int size_x,
int size_y,
int start_bar=-1,
int chart_scale=-1,
int chart_mode=-1)
{
if(chart_scale>0 && chart_scale<=5)
ChartSetInteger(0,CHART_SCALE,chart_scale);
switch(chart_mode)
{
case 0: ChartSetInteger(0,CHART_MODE,CHART_BARS);
case 1: ChartSetInteger(0,CHART_MODE,CHART_CANDLES);
case 2: ChartSetInteger(0,CHART_MODE,CHART_LINE);
}
if(start_bar<0)
return(ChartScreenShot(0,filename,size_x,size_y,ALIGN_RIGHT));
else
return(ChartScreenShot(0,filename,size_x,size_y,ALIGN_LEFT));
}WindowScreenShotSaves current chart screen shot as a GIF file.ChartSetInteger, ChartScreenShotdatetime WindowTimeOnDropped()datetime ChartTimeOnDropped()WindowTimeOnDroppedReturns the time part of the chart point where expert or script was dropped.ChartTimeOnDroppedint WindowsTotal()int ChartGetInteger(0,CHART_WINDOWS_TOTAL)WindowsTotalReturns count of indicator windows on the chart (including main chart).ChartGetIntegerint WindowXOnDropped()int ChartXOnDropped()WindowXOnDroppedReturns the value at X axis in pixels for the chart window client area point at which the expert or script was dropped.ChartXOnDroppedint WindowYOnDropped()int ChartYOnDropped()WindowYOnDroppedReturns the value at Y axis in pixels for the chart window client area point at which the expert or script was dropped.ChartYOnDroppedbool IsTesting()bool MQLInfoInteger(MQL_TESTER)
bool IsTradeAllowed()bool MQLInfoInteger(MQL_TRADE_ALLOWED)bool IsVisualMode()bool MQLInfoInteger(MQL_VISUAL_MODE)
7
0 1147天前
5533
MT5与MT4到底哪个好用?MT5比MT4强在哪里?阿右来告诉你。一、技术上,MT5同样的服务器硬件资源,可以支持更多的用户同时在线和并发,而且有十倍以上的性能提升,但个人觉得这些和用户关系不大,或者和最终买单的交易商客户也关系不大,因此MT5的用户包是用来单独销售的,也就意味着,这些性能的提升主要不是给交易商客户带来多少成本降低,而是给迈达克自身带来了更多的成本优势。二、MT5对接口的支持非常丰富,可以提供移动端,网页端等各种应用程序的再次开发拓展需求,同时MT5的技术文档等支持也做的更为专业、规范。对开发人员来说,选择MT5会比MT4有优势的多。三、MT5自身就设计了Gateway模块,用于对接外部的交易所和流动性提供商。也就是说买了MT5的交易商,可以不用购买外部的Bridge了,直接拿MT5的gateway就可以对接更多的流动性提供商,但还是和第一个问题一样,GateWay是需要单独收费的。MT5的历史回测功能比MT4功能更加强大,可调控性更强。一、在MT5模式下的策略测试,是一个独立于编程块、交易块的一个单独模块,重视程度显著提高。二、从我们在本地下单,到服务器接收到下单指令,是有一个网络延迟的,这个在你MT4右下角服务器那里可以查看。为了能够完全检验策略在一定延迟环境下的表现,MT5提供了可以自设延时毫秒的功能,以及在不稳定网络环境下的随机延时,这样对策略逻辑的检验就很有效了,也减少了回测和实盘交易的误差。三、MT5历史回测时可选择浮动点差来进行测试,完全符合每次报价的实时点差。而MT4历史回测时只能选择固定点差来进行测试,相对而言并没有那么人性化。四、MT5可以支持多线程优化测试,可以调用局域网内的闲置电脑,或者网络上的电脑(付费)来做策略测试,极大的提高了效率。五、MT5支持多货币对历史测试,这样的话,在MT5上可以研发多货币对冲模型,并检验其效果,MT4是不支持多货币策略回测的。
10
0 1194天前
5045
亲爱的各位老板,首先,这个策略很简单,但不是一个圣杯。策略设置使用布林带(周期 20,偏差 2,移位 0)和随机指标 (14,3,3) 的默认值。很长一段时间我第一次学习外汇时,我非常讨厌随机指标,因为我对这个指标的误解。后来我在自我实验后发现了它(当然还有一些我的理念...... ),这个指标可以帮助我:过滤我的情绪(当我必须开仓或建仓时)过滤我的贪心(想短时间内赚大钱)知道我什么时候可以为我的下一个位置做准备(当然有布林带帮助和K线图反转模式)好的,这是我的简单策略(并且我正在使用此策略基础进行 EA 的开发)。*------- 与上波段交叉(对下波段做同样的操作)买入入场1. 前一根蜡烛(来自当前蜡烛)从下方穿过 BB 上线2. 主随机指标高于信号随机指标3. 当前蜡烛看涨和随机指标低于 80卖出入场1. 前一根蜡烛(来自当前蜡烛)从上方穿过 BB 上方。2. 主要随机指标低于信号随机指标3. 当前蜡烛看跌,随机指标高于 20 止盈:50追踪止损 15止损:50时间框架 H1任何货币。我经常使用的K线图 看涨和看跌吞没。请注意外汇是一项高风险的业务,此策略对我有用,因此风险由您自己承担。no.1 没有入口。(随机指标已经超买区域)no.2卖出入场No.3卖出入场
6
0 1204天前
5067
大家好,我只是想开始一个线程分享迄今为止最成功的外汇交易方法!就这样……很简单。在 1 小时图上,绘制 5/12 EMA。绘制 RSI 设置为 21。当 5/12 向上交叉且 21 RSI 超过 50 时,您将做多。当 5/12 向下交叉并且 21 RSI 低于 50 时,您做空。这种方法被证明至少有 85% 的准确率!我希望这能帮助你们成为更成功的交易者!!!
9
0 1204天前
5257
MT4编程第四课,卧槽!牛B!"躺赢"EA加个手数模式翻25倍!#MT4#MT5#EA#自动化交易#MQ4#MQ5本节课的主要内容是为EA增加一个自适应资金手数的功能,让躺赢更加一步,因为如果使用固定手数的话你还得不停的动手来设置,很麻烦的吧,不是我们躺赢族的作风,我们躺赢就要一躺下就不想起来。视频微信视频号观看,扫码上一个帖子里的二维码。代码下载:躺赢EA手数自适应
3
0 1275天前
5935
本节课主要是用神器九转指标来写一个可以躺赢的ea。神奇九转指标思想来源于技术分析领域著名大师汤姆·迪马克的TD序列,其核心功能为发现当前股价走势的拐点,提高抄底、逃顶的成功率。通过同花顺i问财大数据进行回测显示,神奇九转指标基于个股逃顶和抄底的成功率为68.6%,基于指数逃顶和抄底的成功率为75.6%。神器九转的开仓逻辑如下图:视频观看扫码我的微信视频号观看:源码下载:神奇九转躺赢ea
5
1 1275天前
5098
MT4编程教程教学MQ4语言③加油!淦!学习开仓下单命令!#MT4#MT5#EA#自动化交易本节课主要是学习如何通过MQ4语言来下多单下空单。还是扫码微信视频号观看:!#MT4#MT5#EA#自动化交易本节课源码下载:下单源码
2
0 1279天前