input ENUM_TIMEFRAMES TimeFrames[]=

 

Hello

I am a beginner in coding. I want to ask:

Why when i put"input" this code dose not work?

string symbols[]= {  "GBPUSD"};
ENUM_TIMEFRAMES TimeFrames[]={PERIOD_M1,  PERIOD_M2,  PERIOD_M3,  PERIOD_M4,  PERIOD_M5,  PERIOD_M6,PERIOD_M10, PERIOD_M12, PERIOD_M15, PERIOD_M20, PERIOD_M30, PERIOD_H1,PERIOD_H2,  PERIOD_H3,  PERIOD_H4,  PERIOD_H6,  PERIOD_H8,  PERIOD_H12,PERIOD_D1,  PERIOD_W1,  PERIOD_MN1};


input string symbols[]= {  "البحري"}; // "GBPUSD","EURUSD", "البحري
input ENUM_TIMEFRAMES TimeFrames[]={PERIOD_CURRENT,PERIOD_M1,  PERIOD_M2,  PERIOD_M3,  PERIOD_M4,  PERIOD_M5,  PERIOD_M6,PERIOD_M10, PERIOD_M12, PERIOD_M15, PERIOD_M20, PERIOD_M30, PERIOD_H1,PERIOD_H2,  PERIOD_H3,  PERIOD_H4,  PERIOD_H6,  PERIOD_H8,  PERIOD_H12,PERIOD_D1,  PERIOD_W1,  PERIOD_MN1};

I know it is about this [] array, but how can i solve this problem? 

 
Ahmed Abd El Aziz :

Hello

I am a beginner in coding. I want to ask:

Why when i put"input" this code dose not work?


I know it is about this [] array, but how can i solve this problem? 

You just need to read the message in the 'Errors' tab:

array is not allowed as input   


You need to do something like this:

//--- input parameters
input string   InpSymbols  ="EURUSD;USDJPY;GBPUSD";
//---
string      m_array_symbols[]; // dynamic array
//---

and already in OnInit (using StringSplit) fill your array 'm_array_symbols'

Documentation on MQL5: String Functions / StringSplit
Documentation on MQL5: String Functions / StringSplit
  • www.mql5.com
StringSplit - String Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: