Здравствуйте. Есть ли для metatrader 5 индикатор смены таймфрейма с клавиатуры наподобие индикаторов для metatrader 4 ChangeTimeframe или TF Switcher?
набросал, кажется работает такой индикатор:
//+------------------------------------------------------------------+ //| ChangeTFKeys.mq5 | //| IgorM | //| https://www.mql5.com/ru/users/igorm | //+------------------------------------------------------------------+ #property copyright "IgorM" #property link "https://www.mql5.com/ru/users/igorm" #property version "1.00" #property indicator_chart_window #property indicator_plots 0 //--- input parameters input string Up = "x"; input string Dn = "z"; string _up = Up, _dn = Dn; long up = StringToUpper(_up) ? StringGetCharacter(_up, 0) : -1, dn = StringToUpper(_dn) ? StringGetCharacter(_dn, 0) : -1; int arrOfTF[] = {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 }; //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { if(id != CHARTEVENT_KEYDOWN || (lparam != up && lparam != dn)) return; int pos = ArrayBsearch(arrOfTF, _Period), n = lparam == up ? pos + 1 : pos - 1; if(n < 0 || n >= ArraySize(arrOfTF)) return; ChartSetSymbolPeriod(0, NULL, (ENUM_TIMEFRAMES)arrOfTF[n]); ChartRedraw(); } //+------------------------------------------------------------------+
Спасибо, вроде работает.
Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь