Is there a way to make a 2 Hour Timeframe?

 
Question Is there a way to make a 2 Hour Timeframe on MT4?
 
Yes. Look at the script PeriodConverter. Open it on an H1 chart and select a period multiplier. In this case, select 2. Keep the script running on that chart, so it can update the file it created, as new ticks arrive. In the File menu, select "Open offline" and select the H2 file that PeriodConverter created.
 
Steven Brown:
Yes. Look at the script PeriodConverter. Open it on an H1 chart and select a period multiplier. In this case, select 2. Keep the script running on that chart, so it can update the file it created, as new ticks arrive. In the File menu, select "Open offline" and select the H2 file that PeriodConverter created.
No need for that. In MT5 desktop version on the timeframes right click and choose customize and select whatever timeframe available there.

* i think the same for mt4
 
Amir Yacoby: No need for that. In MT5 desktop version on the timeframes right click and choose customize and select whatever timeframe available there.

* i think the same for mt4

No! MT4 does not have H2 like MT5!

On MT4, if you want to have a live H2 Chart for trading, you need to have a generator (Indicator or EA) to produce the Offline Chart and keep it live by continuously updating the ask/bid prices on it. This is not possible with PeriodConverter because it is a Script (although it is a good starting point as a reference to code your own generator EA or Inidcator).

 
Fernando Carreiro:

No! MT4 does not have H2 like MT5!

On MT4, if you want to have a live H2 Chart for trading, you need to have a generator (Indicator or EA) to produce the Offline Chart and keep it live by continuously updating the ask/bid prices on it. This is not possible with PeriodConverter because it is a Script (although it is a good starting point as a reference to code your own generator EA or Inidcator).

Yeh, I know the generator part. Only after writing I saw the mt4 is used by OP. I left mt4 behind my back long ago, very smart move for the op as well.
 
Amir Yacoby:
No need for that. In MT5 desktop version on the timeframes right click and choose customize and select whatever timeframe available there.

* i think the same for mt4

The question was "Is there a way to make a 2 Hour Timeframe on MT4?"

 
Steven Brown:

The question was "Is there a way to make a 2 Hour Timeframe on MT4?"

Correct. 
 
Fernando Carreiro:

No! MT4 does not have H2 like MT5!

On MT4, if you want to have a live H2 Chart for trading, you need to have a generator (Indicator or EA) to produce the Offline Chart and keep it live by continuously updating the ask/bid prices on it. This is not possible with PeriodConverter because it is a Script (although it is a good starting point as a reference to code your own generator EA or Inidcator).

The script PeriodConverter has a while loop that keeps it running as long as the chart is not closed, and it updates the file it created after calling RefreshRates() every 50 milliseconds. The offline chart is a separate chart that displays the file generated by PeriodConverter.

   while(!IsStopped())
     {
      datetime cur_time=LocalTime();
      //--- check for new rates
      if(RefreshRates())
        {
         time0=Time[0];
         FileSeek(ExtHandle,last_fpos,SEEK_SET);
         //--- is there current bar?
         if(time0<rate.time+periodseconds)
           {
            rate.tick_volume+=(long)Volume[0]-last_volume;
            last_volume=(long)Volume[0]; 
            if(rate.low>Low[0])
               rate.low=Low[0];
            if(rate.high<High[0])
               rate.high=High[0];
            rate.close=Close[0];
           }
         else
           {
            //--- no, there is new bar
            rate.tick_volume+=(long)Volume[1]-last_volume;
            if(rate.low>Low[1])
               rate.low=Low[1];
            if(rate.high<High[1])
               rate.high=High[1];
            //--- write previous bar remains
            FileWriteStruct(ExtHandle,rate);
            last_fpos=FileTell(ExtHandle);
            //----
            rate.time=time0/periodseconds;
            rate.time*=periodseconds;
            rate.open=Open[0];
            rate.low=Low[0];
            rate.high=High[0];
            rate.close=Close[0];
            rate.tick_volume=(long)Volume[0];
            last_volume=rate.tick_volume;
           }
         //----
         FileWriteStruct(ExtHandle,rate);
         FileFlush(ExtHandle);
         //--- target chart is not found yet. it can be opened via Main menu - File - Open offline
         if(chart_id==0)
           {
            long id=ChartFirst();
            while(id>=0)
              {
               //--- find appropriate offline chart
               if(ChartSymbol(id)==Symbol() && ChartPeriod(id)==i_period && ChartGetInteger(id,CHART_IS_OFFLINE))
                 {
                  chart_id=id;
                  ChartSetInteger(chart_id,CHART_AUTOSCROLL,true);
                  ChartSetInteger(chart_id,CHART_SHIFT,true);
                  ChartNavigate(chart_id,CHART_END);
                  ChartRedraw(chart_id);
                  PrintFormat("Chart window [%s,%d] found",Symbol(),i_period);
                  break;
                 }
               //--- enumerate opened charts
               id=ChartNext(id);
              }
           }
         //--- refresh window not frequently than 1 time in 2 seconds
         if(chart_id!=0 && cur_time-last_time>=2)
           {
            ChartSetSymbolPeriod(chart_id,Symbol(),i_period);
            last_time=cur_time;
           }
        }
      Sleep(50); 
     }      
 
Steven Brown: The script PeriodConverter has a while loop that keeps it running as long as the chart is not closed, and it updates the file it created after calling RefreshRates() every 50 milliseconds. The offline chart is a separate chart that displays the file generated by PeriodConverter.
But it does not simulate incoming ticks nor keep the ask/bid prices live as if it were a normal chart, making an EA (or indicator) not run properly on such an Offline Chart, not to mention that calling RefreshRates() every 50 milliseconds is not very efficient when the tick rate can be slower than that value.
 
Fernando Carreiro:
But it does not simulate incoming ticks nor keep the ask/bid prices live as if it were a normal chart, making an EA (or indicator) not run properly on such an Offline Chart, not to mention that calling RefreshRates() every 50 milliseconds is not very efficient when the tick rate can be slower than that value.

Is there a winapi command to trigger the OnTick handler in an offline chart?

 
nicholi shen:Is there a winapi command to trigger the OnTick handler in an offline chart?

Yes! Have a look at my SpreadTracker in the CodeBase.

EDIT: It is old code so it may need to be revised!

EDIT2: Revised code (A -> W)

#import "user32.dll"
   int PostMessageW(int hWnd, int Msg, int wParam, int lParam);
   int RegisterWindowMessageW(string lpString);
#import

void SendFakeTick()
{
   int
      hwnd = WindowHandle( _Symbol, _Period ), // Replace with Symbol and Time-frame of Offline Chart
      msg  = RegisterWindowMessageW( "MetaTrader4_Internal_Message" );

   PostMessageW( hwnd, msg, 2, 1 );

   return;
}