Wednesday, January 14, 2026
HomeStockOpening HTML pages created by the Professional Advisor within the browser -...

Opening HTML pages created by the Professional Advisor within the browser – Different – 14 January 2026

Opens *.htm or *.html pages within the default browser.
Performs a preliminary safety examine:

  1. If the file extension shouldn’t be .htm or .html, it stops working.
  2. Opens pages solely from the file sandbox: from the /MQL5/Recordsdata/ or /Widespread/Recordsdata/ folder.

Utilization:

  1. Create an HTML file along with your Professional Advisor or script and reserve it to /Recordsdata/ folder.
  2. Then name this indicator with the trail from the /Recordsdata/ folder to the specified file and the Widespread or MQL5 folder sort indicator.

Instance code for opening an HTML web page:

int HTMLOpen=-1;
void Open(string file,bool isCommon=true){
   if(HTMLOpen!=INVALID_HANDLE){IndicatorRelease(HTMLOpen);}
   HTMLOpen=iCustom(NULL,0,"HTML_Open.ex5",file,isCommon);
}

Open("check.htm", true);
Open("test1.htm", true);

After that, the web page will open within the browser.

The “HTML_Open” indicator code is small, and anybody can examine its safety:

#property indicator_chart_window
#property indicator_plots 0
sinput string file;
sinput bool isCommon;

int OnInit() { OpenHTML(); return(INIT_FAILED); }
int OnCalculate(const int32_t rates_total, const int32_t prev_calculated,const int32_t start,const double &value[]){return(rates_total);}

#import "shell32.dll"
   int ShellExecuteW( int, string, string, string, string, int );
#import

void OpenHTML() {
   int len= StringLen(file); string web page;
   if(StringSubstr(file, len-4) !=".htm" && StringSubstr(file, len-5) !=".html"){
      Alert("Solely .htm or .html pages allowed! Rename the web page.");
   }
   if ((bool)::MQLInfoInteger(MQL_DLLS_ALLOWED)){
      if(isCommon){
         web page = ::TerminalInfoString(TERMINAL_COMMONDATA_PATH) + "Recordsdata"+file;
      }else{
         web page = ::TerminalInfoString(TERMINAL_DATA_PATH) + "MQL5Recordsdata"+file;
      }
      shell32::ShellExecuteW(0, "Open", web page, NULL, NULL, 3);
   }else{
      Alert("DLL not allowed! Cannot to open HTML web page in browser. Enable the DLL within the settings.");
   }
}

So as to add an indicator to the terminal:

  1. Obtain the hooked up file
  2. Or create a brand new indicator, title it “HTML_Open” and paste the code from this web page into it.
  3. Compile it.

I ask different programmers to touch upon the indicator’s safety. In my view, all vulnerabilities have been closed.

A suggestion for MetaQuotes builders: please add a operate for opening HTML pages within the terminal with related checks.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments