Timeframe Changer Script

 

Hi Traders,

I need your expert help once again, I am trying to put together a simple code to change the timeframes, below is what I did, is working fine but I am getting the message "Do you really want to stop script?" every time I run it, it is a bit annoying. Any advise on how I can get rid of this? Meaning stop the script to show that message every time I run it. I am using this script to change between timeframes with hot keys quickly than using "Enter+H1+Enter" just to used two key for example.

Thanks in advance

Regards

{
//---
  int TF = PERIOD_D1;
  int Chart_ID = 0;
  bool Time_Changer_Result = ChartSetSymbolPeriod(Chart_ID,NULL,TF);
  Print("The change was made:", Time_Changer_Result );  
}
 

I'm not exactly sure, but I think it's probably impossible.

How about incorporating it into the indicator? For example,

#define KEY_UP             38
#define KEY_DOWN           40
:
:
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
   if (id == CHARTEVENT_KEYDOWN)
   {
      if (lparam == KEY_UP)
         ChartSetSymbolPeriod(0, _Symbol, PERIOD_D1);
      else if (lparam == KEY_DOWN)
         ChartSetSymbolPeriod(0, _Symbol, PERIOD_H1);
   }
}
//+------------------------------------------------------------------+
 
Nagisa Unada #:

I'm not exactly sure, but I think it's probably impossible.

How about incorporating it into the indicator? For example,

Nice approach, but you would be cycling only 2 TF
 
Nagisa Unada #:

I'm not exactly sure, but I think it's probably impossible.

How about incorporating it into the indicator? For example,

Nagisa,


Very out of the box thinking! I vow to you! Thanks very much, will try it.


Regards

Reason: