Period Converter Optimized Indicator For MT4

Period Converter Optimized Indicator For MT4

Table Of Contents:

  1. Period Converter Optimized Indicator For MT4
  2. Installere Period Converter Optimized Indicator For MT4
  3. Parametere for Period Converter Optimized Indicator For MT4
  4. Buffere av Period Converter Optimized Indicator For MT4
  5. Hoveddeler av koden

Period Converter Optimized Indicator For MT4 er en tilpasset versjon av MT4 standardperiodekonvertering. Den støtter sanntid forfriskende, og legger mindre belastning på CPU-en.

FREE Period Converter Optimized Indicator

Download the FREE Period Converter Optimized Indicator for MT4.

To receive my email 100% sure: 
Put my email on your whitelist!

 

Partially Automated Trading Besides Your Day Job

Alerts In Real-Time When Divergences Occur

 

Installere Period Converter Optimized Indicator For MT4

Etter at du har lastet ned indikatoren via skjemaet over, må du pakke ut zip-filen. Deretter må du kopiere filen Period_Converter_Opt.mq4 til mappen MQL4Indicators for din MT4 installasjon. Etter det kan du starte MT4 på nytt, så vil du kunne se indikatoren i listen over indikatorer.

Parametere for Period Converter Optimized Indicator For MT4

Period Converter Optimized Indicator For MT4 har 7 parametere som skal konfigureres.

extern double  Version = 1.4;             // code version extern string  BuildInfo = "2005.12.24 by Denne e-postadressen er beskyttet mot programmer som samler e-postadresser. Du må aktivere javaskript for å kunne se den."; extern int     PeriodMultiplier = 2;      // new period multiplier factor extern int     OutputCSVFile = 0;         // also output CSV file? extern int     UpdateInterval = 0;        // update interval in milliseconds, zero means update real-time. extern bool    Enabled = true; extern bool    Debug = false; 

Buffere av Period Converter Optimized Indicator For MT4

Period Converter Optimized Indicator For MT4 inneholder 0 buffere.

Hoveddeler av koden

so you have to apply every converter script again after restarting, quite annoying.  This one fixed all above problems: 1. Real-time updating or custom interval millisecond level updating. 2. Low CPU cost, average 5%-10% or less. 3. Works as an indicator, so can be saved and reloaded during restart.  4. There is no one converter per chart limitation as it is not script    any more, you can only use one window as source to generate as many    new timeframe chart as possible. 5. Auto updating if there is new history block loaded.  II. How to use: Copy the mq4 file to your MT4 indicators folder (expertsindicators) to install it as an indicator, NOT script. then in the custom indicator  list, attach period_converter_opt to the chart you want. It support 4 parameters: PeriodMultiplier:    new period multiplier factor, default is 2 UpdateInterval:      update interval in milliseconds,                       zero means update real-time. default is zero. Enabled:             You can disable it without remove it with this option.  Other parameters are comments or for debugging, it is safe to ignore them.  Also Make sure you have Allow Dll imports option checked in common tab or it won t work  After that, File- gt Open Offline to open the generated offline data. then the offline data will be updated automatically.  As long as you keep the source chart open and the converter indicator  running, the generated chart including indicators inside will always  be updated. also you can close the generated chart and open again  later from File- gt Open Offline without problem.  If you want to quit MT4, you can leave those offline chart as other normal online charts. when you start MT4 next time, those charts will also be loaded and updated.   III. Notes: 1. Do NOT uncheck the "offline chart" option in offline chart common properties.    or after MT4 restart, it will treat that chart as online chart and request    the data from server, resulting empty chart window. 2. You can attach more than one converter to same window with different     PeriodMultiplier, e.g: you can attach 3 converter with     PeriodMultiplier = 2, 4, 10 to M1 to generate M2, M4, M10 at the same time.    It is even ok to use the M1 chart to generate Hourly chart like H2, which    only cost a few more CPU resource during initial conversion. but usually     most server don t have much data for those short period. resulting the     generated data isn t long enough for long period. so it is suggested     to use Hourly/Daily charts as source when needed. 3. The real-time updating mode updates quotes as fast as possible, but as    this is done via script, and MT will skip calling start() function when    your PC is busy and lots of quotes income. anyway, this seldom happen,    and you can at least get 10 updates each seconds which is much more    than enough. 4. The offline chart don t have a bid line showing in chart, but all data    in the chart including the indicators is still being updated,     so don t worry. you can show the bid line by unclick the "offline chart"     option in chart properties. but which don t helps much and if you forget    to check "offline chart" option before exit. it will cause errors and    become empty on next startup. you have to close the window and open    again from File- gt Open offline, which don t worth the trouble.  IV. History: 2005.12.24  1.4      faster to detect if data changed by removing float point                       operations, added support to output CSV file in real time.                      OutputCSVFile = 0 means no CSV.                      OutputCSVFile = 1 means CSV + HST                      OutputCSVFile = 2 CSV only, no HST .                      (useful if you want to generate CSV for builtin periods)                      CSV Filename will be the same as HST file except the extension.                      added safe checking for PeriodMultiplier. 2005.12.04  1.3      Fixed missing data when there is large amount of data                      loaded in several blocks, and support auto updating                      when new history is loaded. 2005.11.29  1.2      Additional fix for missing data and server changing. 2005.11.29  1.1      Fixed missing partial data after restart.                      Reinitialize after changing server or data corrupted. 2005.11.28  1.0      Initial release */   extern double  Version = 1.4;             // code version extern string  BuildInfo = "2005.12.24 by Denne e-postadressen er beskyttet mot programmer som samler e-postadresser. Du må aktivere javaskript for å kunne se den."; extern int     PeriodMultiplier = 2;      // new period multiplier factor extern int     OutputCSVFile = 0;         // also output CSV file? extern int     UpdateInterval = 0;        // update interval in milliseconds, zero means update real-time. extern bool    Enabled = true; extern bool    Debug = false;  int      FileHandle = -1; int      CSVHandle = -1; int      NewPeriod = 0;  #define OUTPUT_HST_ONLY    0 #define OUTPUT_CSV_HST     1 #define OUTPUT_CSV_ONLY    2   #define  CHART_CMD_UPDATE_DATA            33324  void DebugMsg(string msg) {    if (Debug) Alert(msg); }  int init() {    //safe checking for PeriodMultiplier.    if (PeriodMultiplier  lt = 1) {       //only output CSV file       PeriodMultiplier = 1;       OutputCSVFile = 2;    }    NewPeriod = Period() * PeriodMultiplier;    if (OpenHistoryFile()  lt  0) return (-1);    WriteHistoryHeader();    UpdateHistoryFile(Bars-1, true);    UpdateChartWindow();    return (0); }  void deinit() {    //Close file handle    if(FileHandle  gt =  0) {        FileClose(FileHandle);        FileHandle = -1;     }    if (CSVHandle  gt = 0) {       FileClose(CSVHandle);       CSVHandle = -1;     } }   int OpenHistoryFile() {    string name;        name = Symbol() + NewPeriod;    if (OutputCSVFile != OUTPUT_CSV_ONLY) {       FileHandle = FileOpenHistory(name + ".hst", FILE_BIN|FILE_WRITE);       if (FileHandle  lt  0) return(-1);    }    if (OutputCSVFile != OUTPUT_HST_ONLY) {       CSVHandle = FileOpen(name + ".csv", FILE_CSV|FILE_WRITE,  , );       if (CSVHandle  lt  0) return(-1);    }    return (0); }  int WriteHistoryHeader() {    string c_copyright;    int    i_digits = Digits;    int    i_unused[13] = {0};    int    version = 400;        if (FileHandle  lt  0) return (-1);    c_copyright = "(C)opyright 2003, MetaQuotes Software Corp.";    FileWriteInteger(FileHandle, version, LONG_VALUE);    FileWriteString(FileHandle, c_copyright, 64);    FileWriteString(FileHandle, Symbol(), 12);    FileWriteInteger(FileHandle, NewPeriod, LONG_VALUE);    FileWriteInteger(FileHandle, i_digits, LONG_VALUE);    FileWriteInteger(FileHandle, 0, LONG_VALUE);       //timesign    FileWriteInteger(FileHandle, 0, LONG_VALUE);       //last_sync    FileWriteArray(FileHandle, i_unused, 0, ArraySize(i_unused));    return (0); }   static double d_open, d_low, d_high, d_close, d_volume; static int i_time;  void WriteHistoryData() {    if (FileHandle  gt = 0) {       FileWriteInteger(FileHandle, i_time, LONG_VALUE);       FileWriteDouble(FileHandle, d_open, DOUBLE_VALUE);       FileWriteDouble(FileHandle, d_low, DOUBLE_VALUE);       FileWriteDouble(FileHandle, d_high, DOUBLE_VALUE);       FileWriteDouble(FileHandle, d_close, DOUBLE_VALUE);       FileWriteDouble(FileHandle, d_volume, DOUBLE_VALUE);    }    if (CSVHandle  gt = 0) {       int i_digits = Digits;              FileWrite(CSVHandle,          TimeToStr(i_time, TIME_DATE),          TimeToStr(i_time, TIME_MINUTES),          DoubleToStr(d_open, i_digits),           DoubleToStr(d_high, i_digits),           DoubleToStr(d_low, i_digits),           DoubleToStr(d_close, i_digits),           d_volume);    } }  int UpdateHistoryFile(int start_pos, bool init = false) {    static int last_fpos, csv_fpos;    int i, ps;        //   if (FileHandle  lt  0) return (-1);    // normalize open time    ps = NewPeriod * 60;       i_time = Time[start_pos]/ps;    i_time *=  ps;    if (init) {          //first time, init data          d_open = Open[start_pos];          d_low = Low[start_pos];          d_high = High[start_pos];          d_close = Close[start_pos];          d_volume = Volume[start_pos];                                     i = start_pos - 1;          if (FileHandle  gt = 0) last_fpos = FileTell(FileHandle);          if (CSVHandle  gt = 0) csv_fpos = FileTell(CSVHandle);    } else {          i = start_pos;          if (FileHandle  gt = 0) FileSeek(FileHandle,last_fpos,SEEK_SET);          if (CSVHandle  gt = 0) FileSeek(CSVHandle, csv_fpos, SEEK_SET);    }    if (i  lt  0) return (-1);     int cnt = 0;    int LastBarTime;    //processing bars    while (i  gt = 0) {       LastBarTime = Time[i];        //a new bar       if (LastBarTime  gt =  i_time+ps) {          //write the bar data          WriteHistoryData();          cnt++;          i_time = LastBarTime/ps;          i_time *= ps;          d_open = Open[i];          d_low = Low[i];          d_high = High[i];          d_close = Close[i];          d_volume = Volume[i];       } else {          //no new bar          d_volume +=  Volume[i];          if (Low[i] lt d_low) d_low = Low[i];          if (High[i] gt d_high) d_high = High[i];          d_close = Close[i];             }       i--;    }        //record last_fpos before writing last bar.    if (FileHandle  gt = 0) last_fpos = FileTell(FileHandle);    if (CSVHandle  gt = 0) csv_fpos = FileTell(CSVHandle);        WriteHistoryData();    cnt++;    d_volume -=  Volume[0];        //flush the data writen    if (FileHandle  gt = 0) FileFlush(FileHandle);    if (CSVHandle  gt = 0) FileFlush(CSVHandle);    return (cnt); }  int UpdateChartWindow() {    static int hwnd = 0;     if (FileHandle  lt  0) {       //no HST file opened, no need updating.       return (-1);    }    if(hwnd == 0) {       //trying to detect the chart window for updating       hwnd = WindowHandle(Symbol(), NewPeriod);    }    if(hwnd!= 0) {       if (IsDllsAllowed() == false) {          //DLL calls must be allowed          DebugMsg("Dll calls must be allowed");          return (-1);       }       if (PostMessageA(hwnd,WM_COMMAND,CHART_CMD_UPDATE_DATA,0) == 0) {          //PostMessage failed, chart window closed          hwnd = 0;       } else {          //PostMessage succeed          return (0);       }    }    //window not found or PostMessage failed    return (-1); }  //| program start function                                           | int start() 

 

About Me

I'm Mike Semlitsch the owner of PerfectTrendSystem.com. My trading career started in 2007. Since 2013 I have helped thousands of traders to take their trading to the next level. Many of them are now constantly profitable traders. 

The following performance was achieved by me while trading live in front of hundreds of my clients:

Connect With Me:  

Results From 5 Months!
This service starts soon! Be the first who get's notified when it begins!

This FREE Indicator Can Transform
Your Trading!

FREE Indicator + Telegram Group


Request the Ultimate Double Top/Bottom Indicator which is used by 10,000+ traders.