【 mt4编程参考】把MQL4语言介绍的很全很细,做EA开发很棒的文档
语法代码格式
注释
标识符
保留字
数据类型
数据类型概述
Integer 类型
Literal 类型
Boolean 类型
Floating-point number 类型
String 类型
Color 类型
Datetime 类型
运算符和表达式
表达式
算术运算符
赋值运算符
关系运算符
真假运算符
位逻辑运算符
其它运算符
优先级规则
操作符
格式和嵌套
复合操作符
表达式操作符
调用函数操作符
空操作符
停止操作符
继续操作符
返回操作符
条件操作符 if
条件操作符 if-else
选择操作符 switch
循环操作符 while
循环操作符 for
函数
函数定义
函数调用
特殊函数 init()、deinit()和start()
变量
定义变量
定义基本类型
定义附加类型
定义数组类型
内部变量定义
函数参数定义
静态变量定义
全局变量定义
附加变量定义
初始化变量
基本类型
数组类型
外部函数引用
预处理程序
定义常数
编译参数定义
嵌入文件
引入函数或其他模块
账户信息
double AccountBalance()
double AccountCredit()
string AccountCompany()
string AccountCurrency()
double AccountEquity()
double AccountFreeMargin()
int AccountLeverage()
double AccountMargin()
string AccountName()
int AccountNumber()
double AccountProfit()
数组函数
int ArrayBsearch( double array[], double value, int count=WHOLE_ARRAY, int start=0, int direction=MODE_ASCEND)
int ArrayCopy( object& dest[], object source[], int start_dest=0, int start_source=0, int count=WHOLE_ARRAY)
int ArrayCopyRates( double& dest_array[], string symbol=NULL, int timeframe=0)
int ArrayCopySeries( double& array[], int series_index, string symbol=NULL, int timeframe=0)
int ArrayDimension( int array[])
bool ArrayGetAsSeries(object array[])
int ArrayInitialize( double& array[], double value)
bool ArrayIsSeries( object array[])
int ArrayMaximum( double array[], int count=WHOLE_ARRAY, int start=0)
int ArrayMinimum( double array[], int count=WHOLE_ARRAY, int start=0)
int ArrayRange( object array[], int range_index)
int ArrayResize( object& array[], int new_size)
bool ArraySetAsSeries( double& array[], bool set)
int ArraySize( object array[])
int ArraySort( double& array[], int count=WHOLE_ARRAY, int start=0, int sort_dir=MODE_ASCEND)
类型转换函数
string CharToStr( int char_code)
string DoubleToStr( double value, int digits)
double NormalizeDouble( double value, int digits)
double StrToDouble( string value)
int StrToInteger( string value)
datetime StrToTime( string value)
string TimeToStr( datetime value, int mode=TIME_DATE|TIME_MINUTES)
公用函数
void Alert( ... )
string ClientTerminalName()
string CompanyName()
void Comment( ... )
int GetLastError()
int GetTickCount()
void HideTestIndicators(bool hide)
bool IsConnected()
bool IsDemo()
bool IsDllsAllowed()
bool IsLibrariesAllowed()
bool IsStopped()
bool IsTesting()
bool IsTradeAllowed()
double MarketInfo( string symbol, int type)
int MessageBox( string text=NULL, string caption=NULL, int flags=EMPTY)
int Period()
void PlaySound( string filename)
void Print( ... )
bool RefreshRates()
void SendMail( string subject, string some_text)
string ServerAddress()
void Sleep( int milliseconds)
void SpeechText( string text, int lang_mode=SPEECH_ENGLISH)
string Symbol()
int UninitializeReason()
自定义指标函数
void IndicatorBuffers(int count)
int IndicatorCounted()
void IndicatorDigits( int digits)
void IndicatorShortName( string name)
void SetIndexArrow( int index, int code)
bool SetIndexBuffer( int index, double array[])
void SetIndexDrawBegin( int index, int begin)
void SetIndexEmptyValue( int index, double value)
void SetIndexLabel( int index, string text)
void SetIndexShift( int index, int shift)
void SetIndexStyle( int index, int type, int style=EMPTY, int width=EMPTY, color clr=CLR_NONE)
日期时间函数
datetime CurTime( )
int Day()
int DayOfWeek( )
int DayOfYear( )
int Hour()
datetime LocalTime()
int Minute()
int Month()
int Seconds()
int TimeDay( datetime date)
int TimeDayOfWeek( datetime date)
int TimeDayOfYear( datetime date)
int TimeHour( datetime time)
int TimeMinute( datetime time)
int TimeMonth( datetime time)
int TimeSeconds( datetime time)
int TimeYear( datetime time)
int TimeYear( datetime time)
文件处理函数
void FileClose(int handle)
void FileDelete(string filename)
void FileFlush(int handle)
bool FileIsEnding(int handle)
bool FileIsLineEnding( int handle)
int FileOpen( string filename, int mode, int delimiter=';')
int FileOpenHistory( string filename, int mode, int delimiter=';')
int FileReadArray( int handle, object& array[], int start, int count)
double FileReadDouble( int handle, int size=DOUBLE_VALUE)
int FileReadInteger( int handle, int size=LONG_VALUE)
double FileReadNumber( int handle)
string FileReadString( int handle, int length=0)
bool FileSeek( int handle, int offset, int origin)
int FileSize( int handle)
int FileTell( int handle)
int FileWrite( int handle, ... )
int FileWriteArray( int handle, object array[], int start, int count)
int FileWriteDouble( int handle, double value, int size=DOUBLE_VALUE)
int FileWriteInteger( int handle, int value, int size=LONG_VALUE)
int FileWriteString( int handle, string value, int length)
全局变量函数
bool GlobalVariableCheck( string name)
bool GlobalVariableDel( string name)
double GlobalVariableGet( string name)
double GlobalVariableGet( string name)
datetime GlobalVariableSet( string name, double value )
bool GlobalVariableSetOnCondition( string name, double value, double check_value)
void GlobalVariablesDeleteAll( )
数学运算函数
double MathAbs( double value)
double MathArccos( double x)
double MathArcsin( double x)
double MathArctan( double x)
double MathCeil( double x)
double MathCos( double value)
double MathExp( double d)
double MathFloor( double x)
double MathLog( double x)
double MathMax( double value1, double value2)
double MathMin( double value1, double value2)
double MathMod( double value, double value2)
double MathPow( double base, double exponent)
int MathRand( )
double MathRound( double value)
double MathSin( double value)
double MathSqrt( double x)
void MathSrand( int seed)
double MathTan( double x)
物体函数
bool ObjectCreate( string name, int type, int window, datetime time1, double price1, datetime time2=0, double price2=0, datetime time3=0, double price3=0)
bool ObjectDelete( string name)
string ObjectDescription( string name)
int ObjectFind( string name)
double ObjectGet( string name, int index)
string ObjectGetFiboDescription( string name, int index)
int ObjectGetShiftByValue( string name, double value)
double ObjectGetValueByShift( string name, int shift)
bool ObjectMove( string name, int point, datetime time1, double price1)
string ObjectName( int index)
int ObjectsDeleteAll( int window, int type=EMPTY)
bool ObjectSet( string name, int index, double value)
bool ObjectSetFiboDescription( string name, int index, string text)
bool ObjectSetText( string name, string text, int font_size, string font=NULL, color text_color=CLR_NONE)
void ObjectsRedraw( )
int ObjectsTotal( )
int ObjectType( string name)
预定义变量
double Ask
int Bars
double Bid
double Close[]
int Digits
double High[]
double Low[]
double Open[]
double Point
datetime Time[]
double Volume[]
字符串函数
string StringConcatenate( ... )
int StringFind( string text, string matched_text, int start=0)
int StringGetChar( string text, int pos)
int StringLen( string text)
string StringSetChar( string text, int pos, int value)
string StringSubstr( string text, int start, int count=EMPTY)
string StringTrimLeft( string text)
string StringTrimRight( string text)
标准常量
Applied price enumeration价格类型枚举
Drawing shape style enumeration画图形状样式枚举
Error codes错误代码
交易服务器返回的错误
MT4返回的运行错误
Ichimoku Kinko Hyo modes enumeration Ichimoku指标模式枚举
Indicators line identifiers指标线标示符
Market information identifiers市场信息标识
MessageBox return codes消息窗口返回值
MessageBox behavior flags消息窗口行为代码
消息窗口显示图标的类型
消息窗口默认按钮设置
Moving Average method enumeration移动平均线模式枚举
Object properties enumeration物件属性枚举
Object type enumeration物件类型枚举
Object visibility enumeration物件显示枚举
Predefined Arrow codes enumeration预定义箭头代码枚举
Series array identifier系列数组标识符
Special constants特殊常量
Time frame enumeration特殊常量
Trade operation enumeration交易类型
Uninitialize reason codes末初始化理由代码
Wingdings symbols图形符号代码
技术指标调用
double iAC( string symbol, int timeframe, int shift)
double iAD( string symbol, int timeframe, int shift)
double 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 iADX( string symbol, int timeframe, int period, int applied_price, int mode, int shift)
double iATR( string symbol, int timeframe, int period, int shift)
double iAO( string symbol, int timeframe, int shift)
double iBearsPower( string symbol, int timeframe, int period, int applied_price, int shift)
double iBands( string symbol, int timeframe, int period, int deviation, int bands_shift, int applied_price, int mode, int shift)
double iBandsOnArray( double array[], int total, int period, double deviation, int bands_shift, int mode, int shift)
double iBullsPower( string symbol, int timeframe, int period, int applied_price, int shift)
double iCCI( string symbol, int timeframe, int period, int applied_price, int shift)
double iCCIOnArray( double array[], int total, int period, int shift)
double iCustom( string symbol, int timeframe, string name, ... , int mode, int shift)
double iDeMarker( string symbol, int timeframe, int period, int shift)
double iEnvelopes( string symbol, int timeframe, int ma_period, int ma_method, int ma_shift, int applied_price, double deviation, int mode, int shift)
double iEnvelopesOnArray( double array[], int total, int ma_period, int ma_method, int ma_shift, double deviation, int mode, int shift)
double iForce( string symbol, int timeframe, int period, int ma_method, int applied_price, int shift)
double iFractals( string symbol, int timeframe, int mode, int shift)
double 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 iIchimoku( string symbol, int timeframe, int tenkan_sen, int kijun_sen, int senkou_span_b, int mode, int shift)
double iBWMFI( string symbol, int timeframe, int shift)
double iMomentum( string symbol, int timeframe, int period, int applied_price, int shift)
double iMomentumOnArray( double array[], int total, int period, int shift)
double iMFI( string symbol, int timeframe, int period, int shift)
double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)
double iMAOnArray( double array[], int total, int period, int ma_shift, int ma_method, int shift)
double iOsMA( string symbol, int timeframe, int fast_ema_period, int slow_ema_period, int signal_period, int applied_price, int shift)
double iMACD( string symbol, int timeframe, int fast_ema_period, int slow_ema_period, int signal_period, int applied_price, int mode, int shift)
double iOBV( string symbol, int timeframe, int applied_price, int shift)
double iSAR( string symbol, int timeframe, double step, double maximum, int shift)
double iRSI( string symbol, void timeframe, int period, int applied_price, int shift)
double iRSIOnArray( double array[], int total, int period, int shift)
double iRVI( string symbol, int timeframe, int period, int mode, int shift)
double iStdDev( string symbol, int timeframe, int ma_period, int ma_method, int ma_shift, int applied_price, int shift)
double iStdDevOnArray( double array[], int total, int ma_period, int ma_method, int ma_shift, int shift)
double iStochastic( string symbol, int timeframe, int %Kperiod, int %Dperiod, int slowing, int method, int price_field, int mode, int shift)
double iWPR( string symbol, int timeframe, int period, int shift)
int iBars( string symbol, int timeframe)
int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)
double iClose( string symbol, int timeframe, int shift)
double iHigh( string symbol, int timeframe, int shift)
double iLow( string symbol, int timeframe, int shift)
double iOpen( string symbol, int timeframe, int shift)
datetime iTime( string symbol, int timeframe, int shift)
double iVolume( string symbol, int timeframe, int shift)
int Highest( string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0)
int Lowest( string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0)
交易函数
int HistoryTotal( )
bool OrderClose( int ticket, double lots, double price, int slippage, color Color=CLR_NONE)
bool OrderCloseBy( int ticket, int opposite, color Color=CLR_NONE)
double OrderClosePrice( )
datetime OrderCloseTime( )
string OrderComment( )
double OrderCommission( )
bool OrderDelete( int ticket)
datetime OrderExpiration( )
double OrderLots( )
int OrderMagicNumber( )
bool OrderModify( int ticket, double price, double stoploss, double takeprofit, datetime expiration, color arrow_color=CLR_NONE)
double OrderOpenPrice( )
datetime OrderOpenTime( )
void OrderPrint( )
bool OrderSelect( int index, int select, int pool=MODE_TRADES)
int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)
double OrderStopLoss( )
int OrdersTotal( )
int OrdersTotal( )
double OrderSwap( )
string OrderSymbol( )
double OrderTakeProfit( )
int OrderTicket( )
int OrderType( )
窗口函数
double PriceOnDropped( )
datetime TimeOnDropped( )
int WindowFind( string name)
int WindowHandle( string symbol, int timeframe)
bool WindowIsVisible( int index)
int WindowOnDropped( )
int WindowsTotal( )
int WindowXOnDropped( )
感谢分享,很多没看懂[擦汗] 感谢分享 留脚印 存币
感谢分享 留脚印 存币 好东西,还只能看着 好东东。没H币哦[流泪] 感谢分享,很多没看懂 这个一定要学学 谢谢分享 谢谢分享 谢谢分享 谢谢分享 多谢楼主分享,楼主好人!!! 谢谢分享
多谢咯朱分享,楼主好人!! 学习学习 感謝分享 感謝分享 感谢分享 谢谢分享