14 October 2016
14 October 2016
Added tooltips for the Buy, Sell and Close buttons in trade dialogs. The tooltips contain information about the security to be bought or sold during the operation, to help beginners understand the trading process.
An MQL5 version of the ALGLIB numerical analysis library has been included into the Standard Library.
Library Features
How to Use
ALGLIB files are located in \MQL5\Include\Math\Alglib. To use the functions, add the main library file into your program:
Mathematical statistics functions have been included into the Standard Library. MQL5 now provides the functionality of the R language, which is one of the best tools for statistical data processing and analysis.
Library Features
The statistical library contains functions for calculating the statistical characteristics of data, as well as functions for operations with statistical distributions:
How to Use
The statistical library files are located in \MQL5\Include\Math\Stat. To use the library, add the file with required functions into your program, for example:
#include <Math\Stat\Binomal.mqh> #include <Math\Stat\Cauchy.mqh>
The detailed description of the library functions is available in the article Statistical Distributions in MQL5 - Taking the Best of R.
The MQL5 version of the Fuzzy library has been included into the Standard Library. The Fuzzy library implements Mamdani and Sugeno fuzzy inference systems.
Library Features
How to Use
Fuzzy Library files are located in \MQL5\Include\Math\Fuzzy. To use the library, add the file with required functions into your program, for example:
#include <Math\Fuzzy\mamdanifuzzysystem.mqh> #include <Math\Fuzzy\sugenofuzzysystem.mqh>
A detailed description of the library is available in the Code Base: Fuzzy - library for developing fuzzy models
long FileLoad( const string filename, // [in] File name void &buffer[], // [out] An array to which the file is read uint common_flag=0 // [in] 0 - search for the file in the Files folder of the terminal, FILE_COMMON - search in the common directory of terminals ); bool FileSave( const string filename, // [in] File name const void &buffer[], // [in] An array to which the file is saved uint common_flag=0 // [in] 0 - create a file in the Files folder of the terminal, FILE_COMMON - create in the common directory of terminals );An example of how to write ticks to a file and then read them:
//--- input parameters input int ticks_to_save=1000; // Number of ticks //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { string filename=_Symbol+"_ticks.bin"; MqlTick ticks[]; //--- int copied=CopyTicks(_Symbol,ticks,COPY_TICKS_ALL,0,ticks_to_save); if(copied!=-1) { PrintFormat(" CopyTicks(%s) copied %d ticks",_Symbol,copied); //--- If the tick history is synchronized, the error code is equal to zero if(!GetLastError()==0) PrintFormat("%s: Ticks are not synchronized. Error=",_Symbol,copied,_LastError); //--- Writing ticks to a file if(!FileSave(filename,ticks,FILE_COMMON)) PrintFormat("FileSave() failed, error=%d",GetLastError()); } else PrintFormat("Failed CopyTicks(%s), Error=",_Symbol,GetLastError()); //--- Now reading the ticks back to the file ArrayFree(ticks); long count=FileLoad(filename,ticks,FILE_COMMON); if(count!=-1) { Print("Time\tBid\tAsk\tLast\tVolume\tms\tflags"); for(int i=0;i<count;i++) { PrintFormat("%s.%03I64u:\t%G\t%G\t%G\t%I64u\t0x%04x", TimeToString(ticks[i].time,TIME_DATE|TIME_SECONDS),ticks[i].time_msc%1000, ticks[i].bid,ticks[i].ask,ticks[i].last,ticks[i].volume,ticks[i].flags); } } }
//--- Candlesticks painted in the same color #property indicator_label1 "One color candles" #property indicator_type1 DRAW_CANDLES //--- Only one color is specified, so all candlesticks are the same color #property indicator_color1 clrGreenIf two colors are specified, one color is used for candlestick edges, the other one is used for the body.
//--- The color of the candlesticks differs from the color of shadows #property indicator_label1 "Two color candles" #property indicator_type1 DRAW_CANDLES //--- Candlestick edges and shadows are green, body is white #property indicator_color1 clrGreen,clrWhiteIf three colors are specified, one color is used for candlestick edges, two other colors are used for the bodies of bullish and bearish candlesticks.
//--- The color of the candlesticks differs from the color of shadows #property indicator_label1 "One color candles" #property indicator_type1 DRAW_CANDLES //--- Candlestick edges and shadows are green, the body of a bullish candle is white, the body of a bearish candle is red #property indicator_color1 clrGreen,clrWhite,clrRedThe DRAW_CANDLES style allows setting custom colors of candlesticks. All colors can also be changed dynamically while the indicator is running, using the function PlotIndexSetInteger(drawing_index_DRAW_CANDLES, PLOT_LINE_COLOR, modifier_number, color) where modifier_number can have the following values:
//--- Setting the color of edges and shadows PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,clrBlue); //--- Setting the color of the bullish candlestick body PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,clrGreen); //--- Setting the color of the bearish candlestick body PlotIndexSetInteger(0,PLOT_LINE_COLOR,2,clrRed);
Updated documentation.