I wanyt to export ADX Indicators in csv can you help me?
- I want an output file from adx
- How to Read and write data from out side the metatrader folder
- How to export file.csv to the specified folder ?
afshar46:
I wanyt to export ADX Indicators in csv can you help me?
I wanyt to export ADX Indicators in csv can you help me?
The documentation is your friend.
https://www.mql5.com/en/docs/files
There are numerous examples.
OR
I would be happy to build it for you for a reasonable price.

Documentation on MQL5: File Functions
- www.mql5.com
File Functions - Reference on algorithmic/automated trading language for MetaTrader 5
can you say a price?
afshar46:
I want to export some indicators to .csv file but it must be for all companies in my list .
I want to export some indicators to .csv file but it must be for all companies in my list .
//+------------------------------------------------------------------+ //| Indicator_export.mq5 | //| Vasileios Zografos | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2013, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" //--- show the window of input parameters when launching the script #property script_show_inputs //--- parameters for receiving data from the terminal input string InpSymbolName="GBPUSD"; // currency pair input ENUM_TIMEFRAMES InpSymbolPeriod=PERIOD_M30; // time frame input int InpFastEMAPeriod=12; // fast EMA period input int InpSlowEMAPeriod=26; // slow EMA period input int InpSignalPeriod=9; // difference averaging period input ENUM_APPLIED_PRICE InpAppliedPrice=PRICE_CLOSE; // price type input datetime InpDateStart=D'2014.01.01 00:00'; // data copying start date //--- parameters for writing data to file input string InpFileName="MACD.csv"; // file name input string InpDirectoryName="Data"; // directory name //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { datetime date_finish; // data copying end date bool sign_buff[]; // signal array (true - buy, false - sell) datetime time_buff[]; // array of signals' arrival time int sign_size=0; // signal array size double macd_buff[]; // array of indicator values datetime date_buff[]; // array of indicator dates int macd_size=0; // size of indicator arrays //--- end time is the current time date_finish=TimeCurrent(); //--- receive MACD indicator handle ResetLastError(); int macd_handle=iMACD(InpSymbolName,InpSymbolPeriod,InpFastEMAPeriod,InpSlowEMAPeriod,InpSignalPeriod,InpAppliedPrice); if(macd_handle==INVALID_HANDLE) { //--- failed to receive indicator handle PrintFormat("Error when receiving indicator handle. Error code = %d",GetLastError()); return; } //--- being in the loop until the indicator calculates all its values while(BarsCalculated(macd_handle)==-1) Sleep(10); // pause to allow the indicator to calculate all its values //--- copy the indicator values for a certain period of time ResetLastError(); if(CopyBuffer(macd_handle,0,InpDateStart,date_finish,macd_buff)==-1) { PrintFormat("Failed to copy indicator values. Error code = %d",GetLastError()); return; } //--- copy the appropriate time for the indicator values ResetLastError(); if(CopyTime(InpSymbolName,InpSymbolPeriod,InpDateStart,date_finish,date_buff)==-1) { PrintFormat("Failed to copy time values. Error code = %d",GetLastError()); return; } //--- free the memory occupied by the indicator IndicatorRelease(macd_handle); //--- receive the buffer size macd_size=ArraySize(macd_buff); //--- analyze the data and save the indicator signals to the arrays ArrayResize(sign_buff,macd_size-1); ArrayResize(time_buff,macd_size-1); for(int i=1;i<macd_size;i++) { //--- buy signal if(macd_buff[i-1]<0 && macd_buff[i]>=0) { sign_buff[sign_size]=true; time_buff[sign_size]=date_buff[i]; sign_size++; } //--- sell signal if(macd_buff[i-1]>0 && macd_buff[i]<=0) { sign_buff[sign_size]=false; time_buff[sign_size]=date_buff[i]; sign_size++; } } //--- open the file for writing the indicator values (if the file is absent, it will be created automatically) ResetLastError(); int file_handle=FileOpen(InpDirectoryName+"//"+InpFileName,FILE_READ|FILE_WRITE|FILE_CSV); if(file_handle!=INVALID_HANDLE) { PrintFormat("%s file is available for writing",InpFileName); PrintFormat("File path: %s\\Files\\",TerminalInfoString(TERMINAL_DATA_PATH)); //--- first, write the number of signals FileWrite(file_handle,sign_size); //--- write the time and values of signals to the file for(int i=0;i<sign_size;i++) FileWrite(file_handle,time_buff[i],sign_buff[i]); //--- close the file FileClose(file_handle); PrintFormat("Data is written, %s file is closed",InpFileName); } else PrintFormat("Failed to open %s file, Error code = %d",InpFileName,GetLastError()); }

Automated Trading and Strategy Testing
- www.mql5.com
MQL5: language of trade strategies built-in the MetaTrader 5 Trading Platform, allows writing your own trading robots, technical indicators, scripts and libraries of functions

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register