- Is there a way to make a 2 Hour Timeframe?
- Keyboard shortcuts
- how to remove the time flag on the bottom of the chart
Hey Folks, is there a way I can switch the shortcut for viewing charts (ctrl+tab) to (alt+1)? Thanks
There is no way to reconfigure this shortcut in MT5 to cycle through charts. And, by the waym Ctrl-Tab is the standard way to cycle through tabs in Windows apps in general.
Maybe you can search for a way to reconfigure the whole Ctrl-Tab key in Windows itself, there are several apps (free and paid) that can do that...
Give it a try.
;)
There is no way to reconfigure this shortcut in MT5 to cycle through charts. And, by the waym Ctrl-Tab is the standard way to cycle through tabs in Windows apps in general.
Maybe you can search for a way to reconfigure the whole Ctrl-Tab key in Windows itself, there are several apps (free and paid) that can do that...
Give it a try.
;)
Thank You will give it a try :)
yes,you can。This indicator change ctrl+tab to KEY_RIGHT。
save as default.tpl ,you can use it anywhere in mt4.
//+------------------------------------------------------------------+
//| myindicator.mq4 |
//| Copyright 2019, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
#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
#property strict
#import "user32.dll"
void keybd_event(int bVk,int bScan,int dwFlags,int dwExtraInfo);
#import
#define REL 0x0002
#define CTRL 17
#define TAB 9
#define SHIFT 16
#define PULS 107
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
writetext("symbol",Symbol()+Period(),600,160,clrDeepPink,50);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
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);
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
//---
}
//+------------------------------------------------------------------+
//| ChartEvent function |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
{
if(id==CHARTEVENT_KEYDOWN)
{
if(lparam==187 || lparam=='6')
{
plusToZoon();
}
}
if(id==CHARTEVENT_KEYDOWN) Print(lparam); //按键检测
// if(id==CHARTEVENT_CLICK)
// {
// Print("The coordinates of the mouse click on the chart are: x = ",sparam," y = ",sparam);
// }
////--- the mouse has been clicked on the graphic object
// if(id==CHARTEVENT_OBJECT_CLICK)
// {
// Print("The mouse has been clicked on the object with name '"+sparam+"'");
// }
//--- the key has been pressed
if(id==CHARTEVENT_KEYDOWN)
{
switch(int(lparam))
{
case KEY_NUMLOCK_LEFT: hou(); break;
case KEY_LEFT: hou(); break;
case KEY_NUMLOCK_UP: fangda(); break;
case KEY_UP: fangda(); break;
case KEY_NUMLOCK_RIGHT: qian(); break;
case KEY_RIGHT: qian(); break;
case KEY_NUMLOCK_DOWN: suoxiao(); break;
case KEY_DOWN: suoxiao(); break;
case KEY_NUMPAD_5: Print("The KEY_NUMPAD_5 has been pressed"); break;
case KEY_NUMLOCK_5: Print("The KEY_NUMLOCK_5 has been pressed"); break;
// case PULS: plusToZoon(); break;
default: Print("Some not listed key has been pressed");
}
ChartRedraw();
}
}
//+------------------------------------------------------------------+
void suoxiao()//缩小K线图周期函数 精简周期
{
ENUM_TIMEFRAMES new_timeframe=PERIOD_CURRENT;
switch(Period())
{
case PERIOD_M5: new_timeframe = PERIOD_M15; break;
case PERIOD_M15: new_timeframe = PERIOD_M15; break;
case PERIOD_M30: new_timeframe = PERIOD_M15; break;
case PERIOD_H1: new_timeframe = PERIOD_M15; break;
case PERIOD_H4: new_timeframe = PERIOD_H1; break;
case PERIOD_D1: new_timeframe = PERIOD_H4; break;
case PERIOD_W1: new_timeframe = PERIOD_D1; break;
case PERIOD_MN1: new_timeframe = PERIOD_W1; break;
}
if(new_timeframe!=PERIOD_CURRENT)
{
ChartSetSymbolPeriod(0,NULL,new_timeframe);
}
writetext("symbol",Symbol()+Period(),60,160,clrDeepPink,50);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void fangda()//放大K线图周期函数
{
ENUM_TIMEFRAMES new_timeframe=PERIOD_CURRENT;
switch(Period())
{
case PERIOD_M5: new_timeframe = PERIOD_M15; break;
case PERIOD_M15: new_timeframe = PERIOD_H1; break;
case PERIOD_M30: new_timeframe = PERIOD_H1; break;
case PERIOD_H1: new_timeframe = PERIOD_H4; break;
case PERIOD_H4: new_timeframe = PERIOD_D1; break;
case PERIOD_D1: new_timeframe = PERIOD_W1; break;
case PERIOD_W1: new_timeframe = PERIOD_W1; break;
case PERIOD_M1: new_timeframe=PERIOD_M15; break;
}
if(new_timeframe!=PERIOD_CURRENT)
{
ChartSetSymbolPeriod(0,NULL,new_timeframe);
}
writetext("symbol",Symbol()+Period(),60,160,clrDeepPink,50);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void writetext(string Labelname,string data,int x,int y,color ColorValue,int FontSize)//通过Object写文字
{
ObjectDelete(Labelname);
ObjectCreate(Labelname,OBJ_LABEL,0,0,0);
ObjectSetText(Labelname,data,FontSize,"Times New Roman",ColorValue);
ObjectSet(Labelname,OBJPROP_CORNER,0);
ObjectSet(Labelname,OBJPROP_XDISTANCE,x);
ObjectSet(Labelname,OBJPROP_YDISTANCE,y);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void qian() //模拟按键 ctrl tab
{
keybd_event(CTRL,0,0,0);
keybd_event(TAB,0,0,0);
keybd_event(CTRL,0,REL,0);
keybd_event(TAB,0,REL,0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void hou() //模拟按键 ctrl tab shiht
{
keybd_event(CTRL,0,0,0);
keybd_event(SHIFT,0,0,0);
keybd_event(TAB,0,0,0);
keybd_event(CTRL,0,REL,0);
keybd_event(SHIFT,0,REL,0);
keybd_event(TAB,0,REL,0);
}
//+------------------------------------------------------------------+
void plusToZoon() //+号放大
{
keybd_event(PULS,0,0,0);
}
//+------------------------------------------------------------------+
...
When you post code please use the CODE button (Alt-S)!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use