//+------------------------------------------------------------------+ //| Chart_Shift.mq4 | //| Copyright 2014, Rondo | //| http://fx-dollaryen.seesaa.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright 2014, Rondo" #property link "http://fx-dollaryen.seesaa.net/" #property version "1.0" #property description "①全チャートにこのインジケーターをセットします。" #property description "②Tabキーを押すと次のチャートに変更します。" #property indicator_chart_window #define KEY_Tab 9 //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { return(0); } //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam) { if(id == CHARTEVENT_KEYDOWN){ if(lparam == KEY_Tab){ long nextChart = ChartNext(ChartID()); if(nextChart < 0) nextChart = ChartFirst(); ChartBringToTop(nextChart); ChartSymbol(nextChart); } } } //+----------------------------------------------------------------------+ //| Send command to the terminal to display the chart above all others. | //+----------------------------------------------------------------------+ bool ChartBringToTop(const long chart_ID=0) { //--- reset the error value ResetLastError(); //--- show the chart on top of all others if(!ChartSetInteger(chart_ID,CHART_BRING_TO_TOP,0,true)) { //--- display the error message in Experts journal Print(__FUNCTION__+", Error Code = ",GetLastError()); return(false); } //--- successful execution return(true); }