Forex Forum - EarnForex
Serving Traders Since 2005
 

Go Back   Forex Forum - EarnForex > Service Forums > Announcements

Announcements Forum related announcements are posted here. Be sure to visit and read the latest news.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 8th October 2011, 15:55
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,542
Thanks: 18
Thanked 20 Times in 16 Posts
Lightbulb Highliting MQL4 and MQL5 Code

Dear Forum users!

I am glad to announce that EarnForex.com Forum now fully supports MQL4 and MQL5 highlighting. If you insert a peace of code, be it indicator, expert advisor, script or something else, written in MQL4 or MQL5, you can now highlight with a simple highlight tag.

For MQL4:
[HIGHLIGHT="MQL4"][/HIGHLIGHT]

For MQL5:
[HIGHLIGHT="MQL5"][/HIGHLIGHT]

Or simply use our special Editor buttons:


WARNING: You might need to refresh the page with Ctrl+F5 in your browser for the Editor buttons to start inserting highlighting syntax.

Our forum is currently the only forum supporting full MQL4/MQL5 highlighting. It closely resembles the highlighting seen in MQL Editor. Even official MetaQuotes forums can't beat us here: MQL4.com's highlighting is a joke, MQL5.com's is good but lacks some features. So, if you need to discuss MQL code, EarnForex.com Forum is your choice. If you want to discuss pink unicorns - choose other forums.

Now, it's recommended to use highlighting when you write your posts. After all, something like this:

Code:
#property copyright "EarnForex.com"
#property link      "http://www.earnforex.com"
#property version   "1.00"

#property description "Displays the Market Profile indicator for the daily trading sessions."

#property indicator_chart_window

input datetime  StartFromDate  = D'';
input bool	    StartFromToday = true;
input int 		DaysToCount    = 2; // Number of days for which to count the Market Profile
input int 		ColorScheme    = 0; // 0 - Blue to Red, 1 - Red to Green, 2 - Green to Blue
input color 	MedianColor    = clrWhite;
input color 	ValueAreaColor = clrWhite;

int DigitsM; 					// Amount of digits normalized for standard 4 and 2 digits after dot
datetime StartDate; 			// Will hold either StartFromDate or Time[0]
double onetick; 				// One normalized pip
int SecondsInPeriod; 		// Will hold calculated amount of seconds in the selected timeframe period
bool FirstRunDone = false; // If true - OnCalculate() was already executed once

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
{
   IndicatorSetString(INDICATOR_SHORTNAME, "MarketProfile");

	// Normalizing the digits to standard 4- and 2-digit quotes
	if (_Digits == 5) DigitsM = 4;
	else if (_Digits == 3) DigitsM = 2;
	else DigitsM = _Digits;

	if (_Period == PERIOD_M30) SecondsInPeriod = 1800;
	if (_Period == PERIOD_M15) SecondsInPeriod = 900;
	if (_Period == PERIOD_M5) SecondsInPeriod = 300;

	onetick = NormalizeDouble(1 / (MathPow(10, DigitsM)), DigitsM);
}
Looks much better when it is highlighted:

MQL5 Code:
#property copyright "EarnForex.com"
#property link      "http://www.earnforex.com"
#property version   "1.00"

#property description "Displays the Market Profile indicator for the daily trading sessions."

#property indicator_chart_window

input datetime  StartFromDate  = D'';
input bool      StartFromToday = true;
input int       DaysToCount    = 2; // Number of days for which to count the Market Profile
input int       ColorScheme    = 0; // 0 - Blue to Red, 1 - Red to Green, 2 - Green to Blue
input color     MedianColor    = clrWhite;
input color     ValueAreaColor = clrWhite;

int DigitsM;                    // Amount of digits normalized for standard 4 and 2 digits after dot
datetime StartDate;             // Will hold either StartFromDate or Time[0]
double onetick;                 // One normalized pip
int SecondsInPeriod;        // Will hold calculated amount of seconds in the selected timeframe period
bool FirstRunDone = false; // If true - OnCalculate() was already executed once

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
{
   IndicatorSetString(INDICATOR_SHORTNAME, "MarketProfile");

    // Normalizing the digits to standard 4- and 2-digit quotes
    if (_Digits == 5) DigitsM = 4;
    else if (_Digits == 3) DigitsM = 2;
    else DigitsM = _Digits;

    if (_Period == PERIOD_M30) SecondsInPeriod = 1800;
    if (_Period == PERIOD_M15) SecondsInPeriod = 900;
    if (_Period == PERIOD_M5) SecondsInPeriod = 300;

    onetick = NormalizeDouble(1 / (MathPow(10, DigitsM)), DigitsM);
}

If you find any bugs or glitches in the MQL highlighting system or would like to suggest some other features, please post your reply here.
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.

Last edited by Enivid; 13th October 2011 at 08:22. Reason: Added warning about Ctrl+F5
Reply With Quote
Reply

Bookmarks

Tags
code, forum, highlighting, mql4, mql5


Currently Active Users Viewing This Thread: 2 (1 members and 1 guests)
Yulich
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
code EA for 15-25$ crn Advertisements 5 24th March 2012 07:49
I'll code indicators, experts. cde.max Advertisements 4 22nd March 2012 06:15
Trading platform with MQL5 samjesse MetaTrader 5 3 31st August 2011 15:08
where i can add alert line in this code ? akram801 MetaTrader Indicators 3 29th May 2011 11:07
New visual tool to create EAs for MT5 in MQL5-No coding required molanis Advertisements 0 27th August 2010 13:49


All times are GMT. The time now is 10:26.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Inactive Reminders By Icora Web Design

SEO by vBSEO 3.3.2