MQL4 - automated forex trading   /  

Code Base

ODL Securities

Code Base  Scripts  Period Converter To post a new code, please log in or register

This script is for
MetaTrader 4
Download MT 4 - 3.5 Mb

Mobile trading!
Buy a license and be mobile in your trading!

Name:
Period Converter
Author: MetaQuotes (2005.11.29 14:17)
Rating: 8
Downloaded: 3641
Download:
 Period_converter.mq4 (6.2 Kb) View
 period_converter.gif (9.8 Kb)


    Use this script to make nonstandard timeframe of symbol based on standard timeframe. For example, to make 3-hours timeframe H3 for selected symbol you should:

  1. Open H1 chart.
  2. Attach to chart 'Period_converter.mq4' MQL4 file from 'Script' folder of 'Navigator' window.
  3. On 'Common' tab check 'Allow DLL imports' and clear 'Confirm DLL function calls' checkbox.
  4. On 'Inputs' properties tab please set 'ExtPeriodMultiplier' variable value to 3 (you'll get H1*3 = H3).
  5. Click OK.
  6. Open H3 chart in offline mode ('File – Open Offline'). H3 chart will be updated every 2 sec (by default) while H1 chart with attached 'Period_converter.mq4' will be opened.

1 comment  To post a new comment, please log in or register
This is awesome...
So far, I only tried it when the market was closed so i haven't actually seen the offline chart being updated (but I like the refresh mechanism)
However, I had to add a short sleep function in order to prevent my CPU from being hogged.

Just before the end of the while loop:
        // [amg]
        // Going to sleep for 50ms, waiting for a new tick to arrive...
        // Otherwise, 100% CPU is incurred
        Sleep(50);
        // [amg]



04.11.2006 19:19 amg