<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Financial Blog &#187; MQL</title>
	<atom:link href="https://fx1.net/blog/category/mql/feed/" rel="self" type="application/rss+xml" />
	<link>https://fx1.net/blog</link>
	<description>Forex, Futures, Programming</description>
	<lastBuildDate>Fri, 06 Mar 2015 16:13:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1</generator>
	<item>
		<title>Draw History Trades to MT4 Chart</title>
		<link>https://fx1.net/blog/draw-history-trades-to-mt4-chart/</link>
		<comments>https://fx1.net/blog/draw-history-trades-to-mt4-chart/#comments</comments>
		<pubDate>Mon, 12 Jan 2015 11:54:29 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[MQL]]></category>
		<category><![CDATA[draw]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[mql]]></category>

		<guid isPermaLink="false">https://fx1.net/blog/?p=2107</guid>
		<description><![CDATA[To evaluate someones trading style, its important to see trades visually on chart. Services such as myfxbook or signalauditor does very good analyse of trades and their metrics but to [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3>To evaluate someones trading style, its important to see trades visually on chart. Services such as myfxbook or signalauditor does very good analyse of trades and their metrics but to see trades visually gives you other perspective!</h3>
<h2>Objective</h2>
<p>We want to write an indicator which can draw all our history trades from current account to chart. This indicator will draw EURUSD History Trades to EURUSD Chart, it will filter Symbols automatically. Beside this you can filter trades by their MAGICNUMBER or/and Comments (by Input parameters). filterMAGIC input parameters needs to be -1 if you want include all trades. filterComment needs to be empty string to include all trades, otherwise specifify substring of comment or Magicnumber of trades you want to have displayed</p>
<h2>Screenshoots</h2>
<p><a href="https://fx1.net/blog/wp-content/uploads/2015/01/history1.jpg"><img src="https://fx1.net/blog/wp-content/uploads/2015/01/history1-1024x453.jpg" alt="history1" width="1024" height="453" class="alignnone size-large wp-image-2110" /></a></p>
<p><a href="https://fx1.net/blog/wp-content/uploads/2015/01/history2.jpg"><img src="https://fx1.net/blog/wp-content/uploads/2015/01/history2-1024x453.jpg" alt="history2" width="1024" height="453" class="alignnone size-large wp-image-2111" /></a></p>
<h2>Source code</h2>
<p>
Basic MQL Code is:</p>
<pre class="brush: php; title: ; notranslate">
#property copyright &quot;Fx1 Inc, 2015&quot;
#property link      &quot;Fx1.net&quot;
#property version   &quot;1.00&quot;
#property strict
#property indicator_chart_window

extern   int      filterMAGIC=-1; 
extern   string   filterComment=&quot;&quot;;
extern   color    BuyColor = Gold;
extern   color    SellColor = Tomato;

int   OnInit() { ObjectsDeleteAll(0,0,OBJ_TREND);   return(INIT_SUCCEEDED);  }
void  OnDeinit(const int reason)  { ObjectsDeleteAll(0,0,OBJ_TREND); }

int LastBar=-1;

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &amp;time[],
                const double &amp;open[],
                const double &amp;high[],
                const double &amp;low[],
                const double &amp;close[],
                const long &amp;tick_volume[],
                const long &amp;volume[],
                const int &amp;spread[])
  {

   if (Time[1]!=LastBar)
   {
      for(int i=0;i&lt;OrdersHistoryTotal();i++)
         {
         if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
         if (OrderSymbol()==Symbol())
         if (filterMAGIC&lt;0 || OrderMagicNumber()==filterMAGIC)
         if (filterComment==&quot;&quot; || StringFind(OrderComment(),filterComment)&gt;-1)
            {
               while (!DrawTrade(OrderTicket())) {}
            }
         }
      LastBar=Time[1];      
  }

   return(rates_total);
}





bool DrawTrade(int Ticket)
{
if (OrderSelect(Ticket,SELECT_BY_TICKET,MODE_HISTORY))
     {         
      string nam=&quot;DrawnTrade_&quot;+DoubleToStr(Ticket,0);          
      if(!ObjectCreate(0,nam,OBJ_TREND,0,OrderOpenTime(),OrderOpenPrice(),OrderCloseTime(),OrderClosePrice()))
        {            
        ObjectSet(nam, OBJPROP_RAY, 0);
        ObjectSet(nam, OBJPROP_COLOR, OrderType()==OP_BUY ? BuyColor : SellColor);
        ObjectSet(nam, OBJPROP_WIDTH, 3);            
        return(true);
        }      
        else{
        return(false);
        }    
     }
return(true);
}
</pre>
<p>This is a Metatrader4 Indicator code, simply copy&#038;paste it into your Metaeditor as Indicator and you are done, for lazy people download it from <a href='/blog/files/fx1.DrawHistoryTrades.mq4'>here</a></p>
</p>
<h2>Comments</h2>
<p>This small code will give you insight about trading style. I am using this code with Investor Password on my Trading Terminal to analyse trades from friends or even myself. This feature needs to be implemented into Metatrader natively. Enjoy using it.</p>
]]></content:encoded>
			<wfw:commentRss>https://fx1.net/blog/draw-history-trades-to-mt4-chart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Put any Image with mt4gui</title>
		<link>https://fx1.net/blog/put-any-image-with-mt4gui/</link>
		<comments>https://fx1.net/blog/put-any-image-with-mt4gui/#comments</comments>
		<pubDate>Fri, 09 Jan 2015 07:05:10 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[MQL]]></category>
		<category><![CDATA[mt4gui]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[mql]]></category>

		<guid isPermaLink="false">https://fx1.net/blog/?p=2063</guid>
		<description><![CDATA[Do you want to put your logo as image and impress your clients with your programming-skills? Mt4gui is perfect tool to master this Requirements We assume you use mt4gui framework, [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3>Do you want to put your logo as image and impress your clients with your programming-skills? Mt4gui is perfect tool to master this</h3>
<h2>Requirements</h2>
<p>
We assume you use <a href='http://mt4gui.com'>mt4gui framework</a>, assume you understand basic concepts of this framework, if not give it a try. Mt4gui is a library which can use MQL Developers have button, checkbox, radiobox, image, label etc on their charts and capture those events such as clicked.
</p>
<h2>Requirements</h2>
<p>
There are few requirements with this approach:</br></p>
<ol>
<li>image needs to have BITMAP (.bmp) format</li>
<li>image cannot be transparent and they will cover underlying ohlc chart, i don´t recommend huge images </li>
<li>image needs to be present inside Terminal folder where terminal.exe is inside, if you want to deploy it to your clients, you need to make sure you copy the .bmp file into terminal folder with installer software. Of course you could also tell your clients to put the .bmp file into this folder but if we assume most of clients are novice, it might end up by a mess. I recommend to use a software such as <a href='https://fx1.net/easetup.php'>EASetup</a> to install Metatrader clients.</li>
<li>Images does not have any events. So you cannot detect a clicked event for example</li>
</ol>
<p/>
<h2>Howto</h2>
<p>
Very basic MQL code is:</p>
<pre class="brush: php; title: ; notranslate">
#include &lt;mt4gui2.mqh&gt;

int hwnd,image1;

int OnInit()
{
  hwnd = WindowHandle(Symbol(),Period());	
  guiRemoveAll(hwnd);		
  image1 = guiAdd(hwnd,&quot;image&quot;,100,100,0,0,&quot;fx1logo.bmp&quot;);
  return(INIT_SUCCEEDED);
}

int deinit()
{
  // Very important to cleanup and remove all gui items from chart   
  if (hwnd&gt;0) guiRemoveAll(hwnd);  
  guiCleanup(hwnd); 
  return(0);
}
  
void OnTick()
{  
 // ..... your code ....
}
</pre>
</p>
<p>
Result:<br />
<img src="https://fx1.net/blog/wp-content/uploads/2015/01/mt4guiimage.bmp" alt="mt4guiimage" width="970" height="327" class="alignnone size-full wp-image-2071" />
</p>
<h2>Easy World</h2>
<p>
It is very easy to add images with mt4gui. You can display your logo for few seconds and then remove it with guiRemove(hwnd,image1) command simply and it is gone. The dimentions of bmp file will be applied automatically, you dont need to know the dimentions, just the location.
</p>
<h2>Lets go more advanced</h2>
<p><iframe width="860" height="455" src="//www.youtube.com/embed/srODOeYNQf0" frameborder="0" allowfullscreen></iframe></p>
<p>Code is easier than you think</p>
<pre class="brush: php; title: ; notranslate">
#include &lt;mt4gui2.mqh&gt;

int hwnd,image1,xpos=100;

int OnInit()
{
  hwnd = WindowHandle(Symbol(),Period());	
  guiRemoveAll(hwnd);		
  image1 = guiAdd(hwnd,&quot;image&quot;,xpos,100,0,0,&quot;train.bmp&quot;);  
  EventSetMillisecondTimer(10);
  return(INIT_SUCCEEDED);
}

int deinit()
{
  // Very important to cleanup and remove all gui items from chart   
  if (hwnd&gt;0) guiRemoveAll(hwnd);  
  guiCleanup(hwnd); 
  return(0);
}
  
void OnTick() {  }

void OnTimer()
{  
 long width;
 if (ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0,width))
 {
   guiSetPos(hwnd,image1,xpos++,100);
   if (xpos&gt;width) xpos=0;
 } 
}
</pre>
]]></content:encoded>
			<wfw:commentRss>https://fx1.net/blog/put-any-image-with-mt4gui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iCustom Indicator with MQLLock</title>
		<link>https://fx1.net/blog/icustom-indicator-with-mqllock/</link>
		<comments>https://fx1.net/blog/icustom-indicator-with-mqllock/#comments</comments>
		<pubDate>Fri, 02 Jan 2015 08:56:51 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[MQL]]></category>
		<category><![CDATA[Mqllock]]></category>
		<category><![CDATA[icustom]]></category>
		<category><![CDATA[mql]]></category>
		<category><![CDATA[mqllock]]></category>

		<guid isPermaLink="false">https://fx1.net/blog/?p=1997</guid>
		<description><![CDATA[I was asked if a mqllock protected indicator can be loaded with iCustom from another Strategy or Indicator which is not protected.. Setup for Test I have taken ForceIndex Indicator [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3>I was asked if a mqllock protected indicator can be loaded with iCustom from another Strategy or Indicator which is not protected..</h3>
<h2 id=underline>Setup for Test</h2>
<p>I have taken <a href='http://ta.mql4.com/indicators/oscillators/force_index'>ForceIndex</a> Indicator to get started, then submitted it to mqllock using <a href='https://mqllock.com/start/'>https://mqllock.com/start/</a> and after several minutes i had a protected version. I have installed Protected version to my computer and applied both (protected and original to chart to see if it works after protection)</p>
<p><img src="https://fx1.net/blog/wp-content/uploads/2015/01/forceindex.png" alt="forceindex" width="846" height="500" class="alignnone size-full wp-image-2001" /></p>
<p>All seems to work well so far with open license. Now its time to write a test mql code like seen:</p>
<pre class="brush: php; title: ; notranslate">
void OnTick()
{

   // Original Indicator with iCustom
   double Ret1 = iCustom(Symbol(),Period(),&quot;ForceIndex&quot;,13,0,0,0,0);   
   // Protected Indicator with iCustom
   double Ret2 = iCustom(Symbol(),Period(),&quot;MQLLock_5200_ForceIndex_rev1&quot;,13,0,0,0,0);
   
   // Output
   Print(&quot;Original = &quot;+DoubleToStr(Ret1,2)+&quot; Protected = &quot;+DoubleToStr(Ret2,2));      
}
</pre>
<p>As you see i am calling original indicator with iCustom and Protected one with iCustom. <a href='http://docs.mql4.com/indicators/icustom'>Manual page for iCustom</a> is very well written and worth to check.
</p>
<h2  id=underline>It works!</h2>
<p>The results are very well like seen here on output; Original called iCustom values are exactly same as Protected version:
</p>
<p><img src="https://fx1.net/blog/wp-content/uploads/2015/01/to-1024x254.png" alt="to" width="700" height="174" class="alignnone size-large wp-image-2004" /></p>
<p>I have tried same with Account Number Licensing, it has worked too same good. As last test i have removed the license on mqllock administration panel and restarted the Metatrader4 Terminal, it has closed the terminal with insufficient license error! All works perfectly. </p>
<h2  id=underline>Conclusion</h2>
<p>MQLLock protected indicators applied to chart or called from iCustom works perfectly. No issues at all. All Features are compatible. Enjoy it</p>
]]></content:encoded>
			<wfw:commentRss>https://fx1.net/blog/icustom-indicator-with-mqllock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hassle with mql5.com Trading Signal Subscription</title>
		<link>https://fx1.net/blog/hassle-with-mql5-com-trading-signal-subscription/</link>
		<comments>https://fx1.net/blog/hassle-with-mql5-com-trading-signal-subscription/#comments</comments>
		<pubDate>Mon, 29 Dec 2014 15:17:43 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[MQL]]></category>
		<category><![CDATA[Signals]]></category>
		<category><![CDATA[mql]]></category>
		<category><![CDATA[mql5.com]]></category>
		<category><![CDATA[Signal]]></category>
		<category><![CDATA[SignalSubscriber]]></category>

		<guid isPermaLink="false">https://fx1.net/blog/?p=1958</guid>
		<description><![CDATA[This post is about problems on mql5.com site to subscribe signals. I will also introduce how to solve these problems MT4 Terminal requires Signal Search Feature There are around 2000 [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3>This post is about problems on mql5.com site to subscribe signals. I will also introduce how to solve these problems</h3>
<h2 id=underline>MT4 Terminal requires Signal Search Feature</h2>
<p>
There are around 2000 Signals in mql5.com Signal Database for MT4. Imagine you have found a &#8220;good&#8221; signal and want to subscribe to it from your terminal. You can click to Subscribe button on web and your browser will open MT4 Terminal with request to subscribe. But imagine if you have multiple MT4 Terminals installed (most of us have done) then your browser will open always same browser (usually first of last installed Terminal).
</p>
<p>
You may try to search the signal from Signals Tab inside MT4 Terminal. The problem here is that you cannot find your signal easly among thousands of signals! Metatrader4 definetly needs a search signal feature.
</p>
<p><img src="https://fx1.net/blog/wp-content/uploads/2014/12/SignalOnMt4-1024x198.jpg" alt="SignalOnMt4" width="700" height="135" class="alignnone size-large wp-image-1969" /></p>
<p>
I have also tried to Subscribe to Signals with MQL Script. Since Build > 620 they have introduced <a href='http://docs.mql4.com/signals'>&#8220;Trade Signal Commands&#8221;</a>, they look very promising at first sight. I have tried following code:
</p>
<pre class="brush: php; title: ; notranslate">
void OnStart()
  {
  int total=SignalBaseTotal();
  long signalid = 74156;
//--- process all signals
   for(int i=0;i&lt;total;i++)
     {
      //--- select the signal by index
      if(SignalBaseSelect(i))
        {
         //--- get signal properties
         long   id    =SignalBaseGetInteger(SIGNAL_BASE_ID);          // signal id
         long   pips  =SignalBaseGetInteger(SIGNAL_BASE_PIPS);        // profit in pips
         long   subscr=SignalBaseGetInteger(SIGNAL_BASE_SUBSCRIBERS); // number of subscribers
         string name  =SignalBaseGetString(SIGNAL_BASE_NAME);         // signal name
         double price =SignalBaseGetDouble(SIGNAL_BASE_PRICE);        // signal price
         //--- print all profitable free signals with subscribers
         if(price==0.0 &amp;&amp; pips&gt;0 &amp;&amp; subscr&gt;0)
            PrintFormat(&quot;id=%d, name=\&quot;%s\&quot;, pips=%d, subscribers=%d&quot;,id,name,pips,subscr);
        }
      else PrintFormat(&quot;Error in call of SignalBaseSelect. Error code=%d&quot;,GetLastError());
     }
  ResetLastError();
  if (SignalSubscribe(signalid))
  {
   Print(&quot;Success&quot;);
  }
  else 
  {
   Print(&quot;Error : &quot;+GetLastError());
  }
  }</pre>
<p>
Result: it throw me around 120 signals out of 2000 available. Different brokers deliver different signals. Moreover SignalSubscribe() command fails with 4060 error if you run it as Script(Operation not permitted). For more details about this problem i have opened a <a href='https://www.mql5.com/en/forum/38736'>forum thread</a>. Update: Signalsubscribe seems to work as Expert Advisor but i think its too insecure to be able to subscribe to signals from an Expert Advisor. To subscribe to any signal you would need to enter SignalID as external parameter and EA would subscribe for you.
</p>
<p>
Conclusion: It is not easy to subscribe in multi mt4 environment to pre-choosen signal providers feed without external tools. I really hope that Metaquotes implements search functionality into MT4.
</p>
<h2  id=underline>Find SignalID</h2>
<p>
SignalID is an unique identified which is assigned to every unique signal at mql5.com site. SignalID is usually carried in URL to load signals. For example; the Signal &#8216;Lol&#8217; has SignalID 47702, we can read this from url <a href='https://www.mql5.com/en/signals/47702'>https://www.mql5.com/en/signals/<span style='background: orange; color: black'>47702</a></a>. Of course you could use <a href='http://docs.mql4.com/signals'>Signal Enumerating functions</a> to find your Signal and use
<pre>long   id    =SignalBaseGetInteger(SIGNAL_BASE_ID);</pre>
<p> to search the Identified, but as i mentioned this function is not working properly (probably not yet)
</p>
<h2  id=underline>Manual Approach</h2>
<p>
You can initiate a subscription with Parameters sent to MT4 Terminal easly. Here is how:
</p>
<ol style='border-left: 3px solid orange; padding-left: 50px; margin-left: 15px'>
<li>Make sure your MT4 Terminal you want to start subscription is logged in with your mql5.com credentials &#038; has enough credit on account, deposit more, if you don´t</li>
<li>You open Command Line Interface (cmd.exe) </li>
<li>Go into the folder with cd command </li>
<li>type
<pre>terminal.exe "mql4buy://signal/subscribe/12345.fx1"</pre>
<p> and press Enter. You replace 12345 with your favorite SignalID.<br />
<img src="https://fx1.net/blog/wp-content/uploads/2014/12/subscribemanual.jpg" alt="subscribemanual" width="674" height="176" class="alignnone size-full wp-image-1977" /></li>
<li>Wait several seconds, your terminal will popup with Subscribe confirmation dialog</li>
</ol>
<h2  id=underline>Automatic: SignalSubscriber</h2>
<p>
I have written small utility for myself you can type SignalID and select Terminal to subscribe and it will start subscription dialog with Terminal automatically. This tool does not automate all process, you still need to confirm subscription with your mql5.com login. You will also need a Terminal which supports Signals and enough credit.<br />
<img src="https://fx1.net/blog/wp-content/uploads/2014/12/autosubscribe.jpg" alt="autosubscribe" width="578" height="444" class="alignnone size-full wp-image-1991" /><br />
You can download this tool <a href='/blog/files/SignalSubscriber.exe'>here</a>
</p>
<p>
I am using SignalSubscriber tool myself and so far very nice tool, it helps me to subscribe signals rapidly.
</p>
<h3>Hope to have helped to save you guys time &#038; money</h3>
]]></content:encoded>
			<wfw:commentRss>https://fx1.net/blog/hassle-with-mql5-com-trading-signal-subscription/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
