-
What happens when your posted code i becomes 8?
-
Show us your code where you check for a space or a click? Show us your attempt (using the CODE button) and state the nature of your problem.
No free help 2017.04.21Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum 2018.05.12
Friends, I made this code to go quickly through all stocks of interest. Have a look of 3 seconds in each one.
For some of them I would like to make a pause, for example by hitting space or clicking the chart. So the EA stops, I look more carefully then, it continues showing the charts of the next stocks in the list.
How can I do this ?
Thanks!
There are no pauses: clicking on the chart causes the symbol to change:
//+------------------------------------------------------------------+ //| Scrolling Charts.mq5 | //| Copyright © 2020, Vladimir Karputov | //+------------------------------------------------------------------+ #property copyright "Copyright © 2020, Vladimir Karputov" #property link "https://www.mql5.com" #property version "1.00" //--- service keys IDs #define KEY_NUMPAD_5 12 #define KEY_LEFT 37 #define KEY_UP 38 #define KEY_RIGHT 39 #define KEY_DOWN 40 #define KEY_NUMLOCK_DOWN 98 #define KEY_NUMLOCK_LEFT 100 #define KEY_NUMLOCK_5 101 #define KEY_NUMLOCK_RIGHT 102 #define KEY_NUMLOCK_UP 104 //--- input parameters input int Input1=9; //--- string arr_symbols[3] = {"AUDUSD","USDJPY","EURUSD"}; int m_last_index = -1; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { //--- left-clicking on a chart if(id==CHARTEVENT_CLICK) { int arr_size=ArraySize(arr_symbols); int index=m_last_index+1; if(index>=arr_size) index=0; if(ChartSetSymbolPeriod(0,arr_symbols[index],PERIOD_D1)) m_last_index=index; } } //+------------------------------------------------------------------+
Result:

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Friends, I made this code to go quickly through all stocks of interest. Have a look of 3 seconds in each one.
For some of them I would like to make a pause, for example by hitting space or clicking the chart. So the EA stops, I look more carefully then, it continues showing the charts of the next stocks in the list.
How can I do this ?
Thanks!