Is it possible to export indicator values ( with OHLC
chart data ) from MetaTrader Terminal 4 for all it's available indicator by MQL4
programme?
I've downloaded historical data, loaded into MT4
, now I want to make MT4
to calculate all indicators it knows ( or do it from an MQL4
-code ) and later do some data mining.
For export, as a trivial unidirectional flow of time does not need to handle individual QUOTE
-stream events, just design all you wish into an MQL4-script
type of code.
Using a MetaEditor
, an integrated IDE, you can get all help even from the very first step, by a built in File->New-[Wizzard]
where you choose to create a Script
type of code and all the needed formal code infrastructure will get setup for you.
You will just add the file-I/O ops and a for
-based loop to visit all bars from your available history, for which you will re-calculate indicator values into the:
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
// _______________________ setup file-IO
...
// _______________________ FOR-looper:
for ( int aBarPTR = Bars - 1; // start with the oldest Bar
aBarPTR < EMPTY; // till the newest Bar
aBarPTR-- // step fwd one-by-one
)
{
// ____________________ calc all values for [aBarPTR]
....
// ____________________ move all values into file-IO
...
}
// _______________________ close file-IO
return
}
And you are done.
The proposed approach works for both of these.
Built-in Indicators
Use MetaEditor
IDE-Help
to have a list of all built-in Indicator names available in your actual Build-version of the MetaTrader Terminal 4 . The scope of implemented indicators may vary.
Enclosed find an excerpt from a custom-syntax highlighting setup, where built-in Indicators were listed separately:
# ______________________________________________________________________
#
# New-MQL4.56789 indicatorFUNCs ________________________Build 950_______
keywordclass.indifunc=\
iAC \
iAD \
iADX \
iAlligator \
iAO \
iATR \
iBands \
iBandsOnArray \
iBearsPower \
iBullsPower \
iBWMFI \
iCCI \
iCCIOnArray \
iCustom \
iDeMarker \
iEnvelopes \
iEnvelopesOnArray \
iForce \
iFractals \
iGator \
iIchimoku \
iMA \
iMACD \
iMAOnArray \
iMFI \
iMomentum \
iMomentumOnArray \
iOBV \
iOsMA \
iRSI \
iRSIOnArray \
iRVI \
iSAR \
iStdDev \
iStdDevOnArray \
iStochastic \
iWPR
# ----------------------------------------------------------------------
Custom Indicators
Use the same Help
for details on how to setup and query values from any other Custom Indicator of your wish. Just the setup is a bit tedious, but doable, examples in the Help
will lead you.