<?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>MQLmagazine.com &#187; MetaTrader5</title>
	<atom:link href="http://mqlmagazine.com/category/metatrader5/feed/" rel="self" type="application/rss+xml" />
	<link>http://mqlmagazine.com</link>
	<description>All things MetaTrader</description>
	<lastBuildDate>Sat, 10 Jul 2010 14:57:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tick Data &amp; Charting : Why Not a Level II MetaTrader ?</title>
		<link>http://mqlmagazine.com/metatrader5/tick-data-charting-why-not-a-level-ii-metatrader/</link>
		<comments>http://mqlmagazine.com/metatrader5/tick-data-charting-why-not-a-level-ii-metatrader/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 19:34:35 +0000</pubDate>
		<dc:creator>Bogdan Caramalac, MQLmagazine sr.editor</dc:creator>
				<category><![CDATA[MetaTrader5]]></category>

		<guid isPermaLink="false">http://mqlmagazine.com/?p=1482</guid>
		<description><![CDATA[[Versiunea romaneasca] [MQLmagazine.com in romana] [English edition]
You should view this article as a continuation of the one about Progress Apama, because it brings institutional issues to MetaTrader5. If you look at that Statistical Arbitrage strategy, you&#8217;ll see it doesn&#8217;t have but an execution at 1-2 seconds at most. So, that doesn&#8217;t seem HFT at all. [...]]]></description>
			<content:encoded><![CDATA[<p><a title="[Versiunea romaneasca]" href="http://mqlmagazine.com/ro/metatrader5/tick-data-charting-de-ce-nu-un-metatrader-de-nivel-ii/" target="_top">[Versiunea romaneasca]</a> <a title="[MQLmagazine.com in romana]" href="http://mqlmagazine.com/ro" target="_top">[MQLmagazine.com in romana]</a> <a title="[English edition]" href="http://mqlmagazine.com" target="_top">[English edition]</a></p>
<p>You should view this article as a continuation of the one about Progress Apama, because it brings institutional issues to MetaTrader5. If you look at that Statistical Arbitrage strategy, you&#8217;ll see it doesn&#8217;t have but an execution at 1-2 seconds at most. So, that doesn&#8217;t seem HFT at all. But becomes HFT in the context of running this in 500 instances &#8211; because it will have hundreds of executions per second. However, if you keep up to 10-20 instances, is something that <strong>MetaTrader5 can handle</strong>.</p>
<p>That strategy inspired me to think about an indicator that draws tick charts. Sure, you can view a tick chart, but in the Market Watch, by clicking on &#8220;Tick Chart&#8221; near &#8220;Symbols&#8221;. But what if you want to see more than one at a time? So I wrote an indicator to do it. However I did it quite poor, and Rosh (Rashid Umarov) came to the rescue. This is the indicator body, modified after inserting levels:</p>

<div class="wp_codebox"><table width="100%" ><tr id="p14822"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
</pre></td><td class="code" id="p1482code2"><pre class="mql5" style="font-family:monospace;"><span style="color: #808080;">//+------------------------------------------------------------------+</span>
<span style="color: #808080;">//|                                                        Ticks.mq5 |</span>
<span style="color: #808080;">//|                        Copyright 2010, MetaQuotes Software Corp. |</span>
<span style="color: #808080;">//|                                              http://www.mql5.com |</span>
<span style="color: #808080;">//+------------------------------------------------------------------+</span>
<span style="color: #339900;">#property copyright &quot;2010, MetaQuotes Software Corp.&quot;</span>
<span style="color: #339900;">#property link      &quot;http://www.mql5.com&quot;</span>
<span style="color: #339900;">#property version   &quot;1.00&quot;</span>
<span style="color: #339900;">#property indicator_separate_window</span>
<span style="color: #339900;">#property indicator_buffers 2</span>
<span style="color: #339900;">#property indicator_plots   2</span>
<span style="color: #808080;">//--- plot Bid</span>
<span style="color: #339900;">#property indicator_label1  &quot;Bid&quot;</span>
<span style="color: #339900;">#property indicator_type1   DRAW_LINE</span>
<span style="color: #339900;">#property indicator_color1  Blue</span>
<span style="color: #339900;">#property indicator_style1  STYLE_SOLID</span>
<span style="color: #339900;">#property indicator_width1  1</span>
<span style="color: #808080;">//--- plot Ask</span>
<span style="color: #339900;">#property indicator_label2  &quot;Ask&quot;</span>
<span style="color: #339900;">#property indicator_type2   DRAW_LINE</span>
<span style="color: #339900;">#property indicator_color2  Red</span>
<span style="color: #339900;">#property indicator_style2  STYLE_SOLID</span>
<span style="color: #339900;">#property indicator_width2  1</span>
<span style="color: #339900;">#property indicator_level0  0.00</span>
<span style="color: #339900;">#property indicator_level1  0.00</span>
<span style="color: #339900;">#property indicator_level2  0.00</span>
<span style="color: #339900;">#property indicator_level3  0.00</span>
<span style="color: #339900;">#property indicator_level4  0.00</span>
<span style="color: #339900;">#property indicator_level5  0.00</span>
<span style="color: #339900;">#property indicator_level6  0.00</span>
<span style="color: #339900;">#property indicator_level7  0.00</span>
<span style="color: #339900;">#property indicator_level8  0.00</span>
<span style="color: #339900;">#property indicator_level9  0.00</span>
<span style="color: #339900;">#property indicator_level10  0.00</span>
<span style="color: #339900;">#property indicator_level11  0.00</span>
<span style="color: #339900;">#property indicator_level12  0.00</span>
<span style="color: #339900;">#property indicator_level13  0.00</span>
<span style="color: #339900;">#property indicator_level14  0.00</span>
<span style="color: #339900;">#property indicator_level15  0.00</span>
<span style="color: #808080;">//--- input parameters</span>
<span style="color: #0000ff;">input</span> <span style="color: #0000ff;">int</span>      number_of_ticks<span style="color: #000080;">=</span><span style="color: #008000;">1000</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">input</span> <span style="color: #0000ff;">int</span>      points_indent<span style="color: #000080;">=</span><span style="color: #008000;">10</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">input</span> <span style="color: #0000ff;">int</span>      LevelsCount<span style="color: #000080;">=</span><span style="color: #008000;">7</span><span style="color: #008080;">;</span>
<span style="color: #808080;">//--- indicator buffers</span>
<span style="color: #0000ff;">double</span>         BidBuffer<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">double</span>         AskBuffer<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
<span style="color: #808080;">//+------------------------------------------------------------------+</span>
<span style="color: #808080;">//| Custom indicator initialization function                         |</span>
<span style="color: #808080;">//+------------------------------------------------------------------+</span>
<span style="color: #0000ff;">int</span> OnInit<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
<span style="color: #808080;">//--- indicator buffers mapping</span>
   <span style="color: #8a2be2;">SetIndexBuffer</span><span style="color: #008000;">&#40;</span>0,BidBuffer,<span style="color: #333399;">INDICATOR_DATA</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
   <span style="color: #8a2be2;">SetIndexBuffer</span><span style="color: #008000;">&#40;</span>1,AskBuffer,<span style="color: #333399;">INDICATOR_DATA</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
   <span style="color: #8a2be2;">PlotIndexSetDouble</span><span style="color: #008000;">&#40;</span>0,PLOT_EMPTY_VALUE,0<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
   <span style="color: #8a2be2;">PlotIndexSetDouble</span><span style="color: #008000;">&#40;</span>1,PLOT_EMPTY_VALUE,0<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
   <span style="color: #8a2be2;">IndicatorSetString</span><span style="color: #008000;">&#40;</span><span style="color: #333399;">INDICATOR_SHORTNAME</span>,<span style="color: #8a2be2;">Symbol</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">+</span><span style="color: #008080;">&quot; Tick Chart&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #808080;">//---</span>
   <span style="color: #0000ff;">return</span><span style="color: #008000;">&#40;</span>0<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>
<span style="color: #808080;">//+------------------------------------------------------------------+</span>
<span style="color: #808080;">//| Custom indicator iteration function                              |</span>
<span style="color: #808080;">//+------------------------------------------------------------------+</span>
<span style="color: #0000ff;">int</span> OnCalculate<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> rates_total,
                <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> prev_calculated,
                <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">datetime</span> <span style="color: #000040;">&amp;</span>time<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span>,
                <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">double</span> <span style="color: #000040;">&amp;</span>open<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span>,
                <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">double</span> <span style="color: #000040;">&amp;</span>high<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span>,
                <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">double</span> <span style="color: #000040;">&amp;</span>low<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span>,
                <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">double</span> <span style="color: #000040;">&amp;</span>close<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span>,
                <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">long</span> <span style="color: #000040;">&amp;</span>tick_volume<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span>,
                <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">long</span> <span style="color: #000040;">&amp;</span>volume<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span>,
                <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> <span style="color: #000040;">&amp;</span>spread<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
   <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">int</span> ticks<span style="color: #000080;">=</span><span style="color: #008000;">0</span><span style="color: #008080;">;</span>
<span style="color: #808080;">//---</span>
   <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>ticks<span style="color: #000080;">==</span>0<span style="color: #008000;">&#41;</span>
     <span style="color: #008000;">&#123;</span>
      <span style="color: #8a2be2;">ArrayInitialize</span><span style="color: #008000;">&#40;</span>AskBuffer,0<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
      <span style="color: #8a2be2;">ArrayInitialize</span><span style="color: #008000;">&#40;</span>BidBuffer,0<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
     <span style="color: #008000;">&#125;</span>
   setMaxMinPrice<span style="color: #008000;">&#40;</span>ticks,points_indent<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #808080;">//--- CopyRates</span>
   MqlTick last_tick<span style="color: #008080;">;</span>
   <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span><span style="color: #8a2be2;">SymbolInfoTick</span><span style="color: #008000;">&#40;</span><span style="color: #8a2be2;">Symbol</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>,last_tick<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
     <span style="color: #008000;">&#123;</span>
      BidBuffer<span style="color: #008000;">&#91;</span>ticks<span style="color: #008000;">&#93;</span><span style="color: #000080;">=</span>last_tick.<span style="color: #007788;">bid</span><span style="color: #008080;">;</span>
      AskBuffer<span style="color: #008000;">&#91;</span>ticks<span style="color: #008000;">&#93;</span><span style="color: #000080;">=</span>last_tick.<span style="color: #007788;">ask</span><span style="color: #008080;">;</span>
      <span style="color: #0000ff;">int</span> shift<span style="color: #000080;">=</span>rates_total<span style="color: #000040;">-</span>1<span style="color: #000040;">-</span>ticks<span style="color: #008080;">;</span>
      ticks<span style="color: #000040;">++</span><span style="color: #008080;">;</span>
      BidBuffer<span style="color: #008000;">&#91;</span>rates_total<span style="color: #000040;">-</span>1<span style="color: #008000;">&#93;</span><span style="color: #000080;">=</span>last_tick.<span style="color: #007788;">bid</span><span style="color: #008080;">;</span>
      AskBuffer<span style="color: #008000;">&#91;</span>rates_total<span style="color: #000040;">-</span>1<span style="color: #008000;">&#93;</span><span style="color: #000080;">=</span>last_tick.<span style="color: #007788;">ask</span><span style="color: #008080;">;</span>
      <span style="color: #8a2be2;">PlotIndexSetInteger</span><span style="color: #008000;">&#40;</span>0,<span style="color: #333399;">PLOT_SHIFT</span>,shift<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
      <span style="color: #8a2be2;">PlotIndexSetInteger</span><span style="color: #008000;">&#40;</span>1,<span style="color: #333399;">PLOT_SHIFT</span>,shift<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
      <span style="color: #8a2be2;">Comment</span><span style="color: #008000;">&#40;</span><span style="color: #008080;">&quot;Bid =&quot;</span>,last_tick.<span style="color: #007788;">bid</span>,<span style="color: #008080;">&quot;   Ask =&quot;</span>,last_tick.<span style="color: #007788;">ask</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
     <span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #808080;">//--- return value of prev_calculated for next call</span>
   <span style="color: #0000ff;">return</span><span style="color: #008000;">&#40;</span>rates_total<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>
<span style="color: #808080;">//+------------------------------------------------------------------+</span>
<span style="color: #808080;">//| set Maximum and Minimum for an indicator window based on last values</span>
<span style="color: #808080;">//+------------------------------------------------------------------+</span>
<span style="color: #0000ff;">void</span> setMaxMinPrice<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> last_values,<span style="color: #0000ff;">int</span> indent<span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
   <span style="color: #0000ff;">int</span> dgs<span style="color: #008080;">;</span>
   <span style="color: #0000ff;">double</span> dist<span style="color: #008080;">;</span>
   <span style="color: #0000ff;">int</span> visiblebars<span style="color: #000080;">=</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span><span style="color: #008000;">&#41;</span><span style="color: #8a2be2;">ChartGetInteger</span><span style="color: #008000;">&#40;</span>0,<span style="color: #333399;">CHART_VISIBLE_BARS</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
   <span style="color: #0000ff;">int</span> depth<span style="color: #000080;">=</span><span style="color: #8a2be2;">MathMin</span><span style="color: #008000;">&#40;</span>last_values,visiblebars<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
   <span style="color: #0000ff;">int</span> startindex<span style="color: #000080;">=</span>last_values<span style="color: #000040;">-</span>depth<span style="color: #008080;">;</span>
   <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>startindex<span style="color: #000080;">&lt;</span>0<span style="color: #008000;">&#41;</span> startindex<span style="color: #000080;">=</span><span style="color: #008000;">0</span><span style="color: #008080;">;</span>
   <span style="color: #0000ff;">int</span> max_index<span style="color: #000080;">=</span><span style="color: #8a2be2;">ArrayMaximum</span><span style="color: #008000;">&#40;</span>AskBuffer,startindex,depth<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
   max_index<span style="color: #000080;">=</span>max_index<span style="color: #000080;">&gt;=</span>0<span style="color: #008080;">?</span>max_index<span style="color: #008080;">:</span><span style="color: #008000;">0</span><span style="color: #008080;">;</span>
   <span style="color: #0000ff;">int</span> min_index<span style="color: #000080;">=</span><span style="color: #8a2be2;">ArrayMinimum</span><span style="color: #008000;">&#40;</span>BidBuffer,startindex,depth<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
   min_index<span style="color: #000080;">=</span>min_index<span style="color: #000080;">&gt;=</span>0<span style="color: #008080;">?</span>min_index<span style="color: #008080;">:</span><span style="color: #008000;">0</span><span style="color: #008080;">;</span>
   <span style="color: #0000ff;">double</span> MaxPrice<span style="color: #000080;">=</span>AskBuffer<span style="color: #008000;">&#91;</span>max_index<span style="color: #008000;">&#93;</span><span style="color: #000040;">+</span>indent<span style="color: #000040;">*</span><span style="color: #ff00ff;">_Point</span><span style="color: #008080;">;</span>
   <span style="color: #0000ff;">double</span> MinPrice<span style="color: #000080;">=</span>BidBuffer<span style="color: #008000;">&#91;</span>min_index<span style="color: #008000;">&#93;</span><span style="color: #000040;">-</span>indent<span style="color: #000040;">*</span><span style="color: #ff00ff;">_Point</span><span style="color: #008080;">;</span>
   <span style="color: #8a2be2;">IndicatorSetDouble</span><span style="color: #008000;">&#40;</span><span style="color: #333399;">INDICATOR_MAXIMUM</span>,MaxPrice<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
   <span style="color: #8a2be2;">IndicatorSetDouble</span><span style="color: #008000;">&#40;</span><span style="color: #333399;">INDICATOR_MINIMUM</span>,MinPrice<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
   dgs<span style="color: #000080;">=</span><span style="color: #8a2be2;">SymbolInfoInteger</span><span style="color: #008000;">&#40;</span><span style="color: #8a2be2;">Symbol</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>,<span style="color: #333399;">SYMBOL_DIGITS</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
   dist<span style="color: #000080;">=</span><span style="color: #8a2be2;">NormalizeDouble</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#40;</span>MaxPrice<span style="color: #000040;">-</span>MinPrice<span style="color: #008000;">&#41;</span><span style="color: #000040;">/</span><span style="color: #008000;">&#40;</span>LevelsCount<span style="color: #000040;">+</span>1<span style="color: #008000;">&#41;</span>, dgs<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
   <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i<span style="color: #000080;">=</span><span style="color: #008000;">0</span><span style="color: #008080;">;</span>i<span style="color: #000080;">&lt;</span>LevelsCount<span style="color: #008080;">;</span>i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span>
      <span style="color: #008000;">&#123;</span>
       <span style="color: #8a2be2;">IndicatorSetDouble</span><span style="color: #008000;">&#40;</span><span style="color: #333399;">INDICATOR_LEVELVALUE</span>,i,MinPrice<span style="color: #000040;">+</span>dist<span style="color: #000040;">*</span><span style="color: #008000;">&#40;</span>i<span style="color: #000040;">+</span>1<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
      <span style="color: #008000;">&#125;</span> 
  <span style="color: #008000;">&#125;</span>
<span style="color: #808080;">//+------------------------------------------------------------------+</span></pre></td></tr></table></div>

<p>As a tick indicator, it looks okay. But what if you want to put something else on it, like Moving Averages, Bollinger Bands, or even monitoring spreads, like in the Progress Apama strategy window? That means you have to write over and over again, newer and newer indicators, just to show you what you need. Sure, tick calculations are easy from inside an EA &#8211; they will happen mostly in the OnTick() event &#8211; but you need indicators to help you visualize the strategy, even if their practical application will be most of the time unnecesary, due to separate calculus in the EA. But keep in mind that <strong>there is no tick history. Such indicators draw from scratch.</strong> So if you want to see something longer, at least now, when the Strategy Tester is not available to run the indicator on, you have to give it time to display, it&#8217;s not instant as for other indicators.</p>
<p>So, <strong>if tick data would be available, meaning PERIOD_TICK also,</strong> then some good things for us might appear, as:<br />
a. No need to write special indicators for tick level.<br />
b. Tick level charts appear rightaway and span for entire history.<br />
c. Tick history will make the backtester more accurate, because the backtester doesn&#8217;t have to invent ticks to cover such ares.<br />
d. <em>(drawback):</em> <strong>Huge hard drive space occupied by history, larger memory requirements.</strong></p>
<p>What does it mean for MetaQuotes:<br />
a. Change in history and data aggregation, starting from tick to make the rest, not from M1, keeping M1 as a data source for old history, where tick data was not available;<br />
b. Light modification to data access functions (fields such as openbid, openask, closebid, closeask in MqlRates etc).<br />
c. Light modifications to the backtester;<br />
d. <strong>MetaTrader branded as a near institutional platform.</strong></p>
<p>Why should we want this? Well, why the big boys don&#8217;t use bar charts? After all, <strong>there are no surprises on tick charts</strong> &#8211; and we will investigate this some other time &#8211; so you won&#8217;t fear that a spider leg bar will touch your stop loss in a middle of good looking trend. </p>
<p>Thing is, if you have Level II available, and if you automate it, you are very close to the HFT realm. In fact, what is being blamed today is not the entire algorithmic trading &#8211; because they never think about users of MetaTrader, E-Signal or even NeoTicker &#8211; but the institutional , unfair (to be read &#8220;colocated&#8221;) trading. At the surface, the discussion is about computerized vs manual trading. But these , both sides of the conflict, act on the Level II, with the possibility to quote and be filled (i.e. buy at bid, sell at ask), and pay tiny fees for these trades. Thing is, if we&#8217;d benefit Level II plus MetaTrader automation, with lower brokerage fees, some forms of HFT would become applicable. This is a thing that probably remained hidden, the fact that <strong>low latency trading</strong> seems to be not the same thing as <strong>high frequency trading</strong>, even if the terms are used interchangeably. I believe that algorithmic Level II trading can be designed to be HFT even if it doesn&#8217;t benefit from low latency execution. Problem is, traders were indoctrinated so much with Level I, that is very hard to make Level II trading accepted. Because <strong>Level I trading has a &#8220;buy or sell now, and see later if you were right&#8221; mentality</strong>, whether <strong>Level II has a &#8220;see this, quote it, if get filled, close later&#8221; mentality</strong>. The same &#8220;later&#8221; has different meanings, Level I &#8220;later&#8221; means from minutes to up, usually hours, whether Level II later means &#8220;seconds&#8221; (for normal traders) , or &#8220;milliseconds&#8221; for hedge fund systems. Trailing stop is tighter on Level II, trails pip by pip. And all is meant to make <strong>real time money</strong>. Not in a few hours, and not tomorrow or not next week. But rather, see equity going up a few times per minute. This gives a way higher degree of confort, way higher than in Level I, where you can watch losses accumulating creepy for hours or days. What is most often forgot in trading, is that trading strategies are not for robots that can wait an ethernity to improve their trading styles. <strong>Life happens in real time</strong>. <strong>We are not immortal</strong> and beyond it, <strong>youth is damn short</strong>. This is one of the drivers for cutting down the latency. On one hand, it is the need to be filled before the competition, on other hand, more and more profits per a lesser and lesser time unit means fatter salaries for management&#8230; While this, even the most rational and successful traders that on Level I cannot exceed some limits of the yield. Essentially, the Level II automated systems have this job, to compress the time, and get similar yields as the ones from Level I, but in a hundredth or lesser time. But these yields are relative and small, when looked upon from inside the hedge fund industry. Because, the system&#8217;s results are relative to the average liquidity used. That is, a lot of liquidity will remain unused, but has to return yield. And while diversification is way to use more liquidity, the time span is the other side of the coin, because one trade a second is a thing, and a hundred trades in the same second, spanning lots of microseconds each, is another thing. On another hand, HFT platforms cost shameful amounts of money, and smaller institutions do not afford them, because a lot of the yields from the market go on platform costs and PhD salaries. Now you understand why a Level II MetaTrader, even if not low latency, is important? As Irene Aldridge admits too, <strong>for the buy side, there aren&#8217;t many companies yet selling products</strong>. In fact, if we exclude Strategy Runner, X-Trader and Ninja Trader, I can&#8217;t think at others. X-Trader has the automation pretty institutional in terms of costs, and Strategy Runner is so cryptic that you have to pay lots of cash for development. None of these platforms integrate options, however, and making a market in options, getting filled there, is a great way to make economies, as option spreads can be really high.</p>
<p>After all, if look on the MQL5 forum, you can see that MetaQuotes at least seems to commit to <strong>make MetaTrader 5 the best trading terminal in the world</strong>. If MetaTrader5 becomes <strong>Level II ready</strong> (remember the old motherboards with the <strong>Prescott ready</strong> sticker ?) and by generating an increased awareness about the importance of tick level action in the retail trading community, it might determine changes on brokerage levels.<br />
As brokers will give more access to tight spread ECNs, the spreads will go down, and actually the spread based model might become even extinct, replaced by a commission model &#8211; and I mean small commissions, small enough for the trader to feel that he trades in an ECN not just a retail feed that brands commission instead of spread. This way a lot of strategies from the institutional levels would become portable to MetaTrader and retail world &#8211; which will probably become &#8220;institutional with big latency&#8221;, or, more important for retail traders, <strong>FREE, easy-to-deploy HFT solution that is not low-latency based</strong>. The problem is, that commissions are driven by volume. The larger the volume, the smaller the commissions. However, at least forex traders are heavily leveraged. (Yes, the americans will soon not be able to do this anymore). Being highly leveraged, small losses are still hitting the equity hard. How much could you support commission losses until volume becomes high enough to get rebates and jump to profit? Let&#8217;s not forget, the global economy is in recession, and brokers, as any regular business in this word, live off sales&#8230; Which makes them more open for innovation, offering from low to tiny commissions&#8230;</p>
<p>On another hand, how could MT be used as a Level II platform the way it is? Sure, the OrderSend() can be used in a Level II manner, but without tick data, and with a backtester that just models ticks, instead of using ticks for real? I guess not. Tick data is a must if the station would be rebranded to a Level II station.<br />
However, there are things to do until there, as MetaQuotes still has older homeworks to complete : the Strategy Tester, a better OnTrade() syntax, the Depth Of Market view and of course the OnBookEvent(). When all of these will be completed, MT5 will be so far that you&#8217;ll forget about the old MT4 candies, I&#8217;m sure about that&#8230;</p>
<p><em>But if the retail community won&#8217;t ask for more bang for the buck, nothing will be achieved, cause <strong>automated</strong> Level II is something they are not likely to slip <strong>for free</strong></em>.</p>
<div class='dd_after'><table><tr><td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://mqlmagazine.com/metatrader5/tick-data-charting-why-not-a-level-ii-metatrader/&amp;t=Tick+Data+%26+Charting+%3A+Why+Not+a+Level+II+MetaTrader+%3F&amp;s=compact' height='18' width='120' frameborder='0' scrolling='no'></iframe></td><td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://mqlmagazine.com/metatrader5/tick-data-charting-why-not-a-level-ii-metatrader/&amp;title=Tick+Data+%26+Charting+%3A+Why+Not+a+Level+II+MetaTrader+%3F&amp;t=2' height='18' width='120' frameborder='0' scrolling='no'></iframe></td><td><script type='text/javascript'><!--yahooBuzzArticleHeadline=Tick+Data+%26+Charting+%3A+Why+Not+a+Level+II+MetaTrader+%3F;//--></script><script type='text/javascript' src='http://d.yimg.com/ds/badge2.js' badgetype='small-votes'></script></td><td><iframe src='http://api.tweetmeme.com/button.js?url=http://mqlmagazine.com/metatrader5/tick-data-charting-why-not-a-level-ii-metatrader/&amp;source=&amp;style=compact' height='20' width='90' frameborder='0' scrolling='no'></iframe></td><td><script type='text/javascript'> var fbShare = {url: 'http://mqlmagazine.com/metatrader5/tick-data-charting-why-not-a-level-ii-metatrader/',size:'small'}</script> <script type='text/javascript' src='http://widgets.fbshare.me/files/fbshare.js'></script></td></tr></table></div><!-- Generated by Digg Digg plugin, 
    Author : Yong Mook Kim
    Website : http://www.mkyong.com/blog/digg-digg-wordpress-plugin/ -->]]></content:encoded>
			<wfw:commentRss>http://mqlmagazine.com/metatrader5/tick-data-charting-why-not-a-level-ii-metatrader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Debugger &#8211; a Novelty of MT5</title>
		<link>http://mqlmagazine.com/metatrader5/the-debugger-a-novelty-of-mt5/</link>
		<comments>http://mqlmagazine.com/metatrader5/the-debugger-a-novelty-of-mt5/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 20:05:34 +0000</pubDate>
		<dc:creator>Bogdan Baltatu, MQLmagazine editor</dc:creator>
				<category><![CDATA[MetaTrader5]]></category>

		<guid isPermaLink="false">http://mqlmagazine.com/?p=1253</guid>
		<description><![CDATA[[Versiunea romaneasca] [MQLmagazine.com in romana] [English edition]
One of the upgrades brought by MetaQuotes to the MetaEditor IDE is the introduction of a debugger.
Across this article I&#8217;ll use the article ‘error’ as a reference to the conceptual code errors such as wrongly written conditions or wrongly written calculus expressions&#8230; Warning: don&#8217;t mistake them with the errors [...]]]></description>
			<content:encoded><![CDATA[<p><a title="[Versiunea romaneasca]" href="http://mqlmagazine.com/ro/metatrader5/debuggerul-o-noutate-in-mt5/" target="_top">[Versiunea romaneasca]</a> <a title="[MQLmagazine.com in romana]" href="http://mqlmagazine.com/ro" target="_top">[MQLmagazine.com in romana]</a> <a title="[English edition]" href="http://mqlmagazine.com" target="_top">[English edition]</a></p>
<p>One of the upgrades brought by MetaQuotes to the MetaEditor IDE is the introduction of a debugger.</p>
<p>Across this article I&#8217;ll use the article ‘error’ as a reference to the conceptual code errors such as wrongly written conditions or wrongly written calculus expressions&#8230; Warning: don&#8217;t mistake them with the errors signaled by the compiler.</p>
<p>For the ones that don&#8217;t know , the purpose of the debugger is to run line by line to code in order to find conceptual programming errors, and to watch the values of the variables realtime.</p>
<p>In MT4, that lacked a debugger, the programmers were using the Print function to find the errors in the code, this being the single method available. This method is difficult to use and the time needed to find the error is way larger compared to using a debugger, because Prin needed a recompilation every time, re-attaching the EA and reading in logs. If we were calling functions giving a wrong result , because they were badly written, we had to go inside that function and attach Print lines to see where were the errors. After repairs, the code had to be cleaned up of redundant Print lines used to find the error.</p>
<p>Right now the debugger works only to test scripts, but we think it will be integrated with the Strategy Tester to work with experts. This is needed also because several buggy EA modules may be run only in rare market conditions, that will not appear while forward testing, but will be revealed while backtesting.</p>
<p>Now the things got simpler, from the same window you can follow the program being run line by line.</p>
<p>In order to use the debugger we have to call the <strong>DebugBreak()</strong> function where we want the normal execution stopped in order to start execution line by line. If we attach such a script to a chart, this will not stop running, as it will be stopped only if it&#8217;s started with the debug mode of the MetaEditor.</p>
<p>To start the script for debugging we have to press Debug->Start or F5 key or it&#8217;s dedicated button in the special bar dedicated to the debugger, bar which contains other 3 buttons for passing thru the code.</p>
<p><img src="http://mqlmagazine.com/wp-content/uploads/2010/02/MT5Debugger.PNG" alt="MT5Debugger" title="MT5Debugger" width="690" height="803" class="alignnone size-full wp-image-1266" /></p>
<p>The group of buttons from the rectangle labeled 1 are the 6 buttons used at debugging. The first 3 buttons are getting in and out from the debug mode, but also to pause. The last 3 buttons are for passing the code in other manners, in the debug mode:</p>
<p>- passing thru the code by Step Into (F11) we go line by line but we enter the functions referred. For instance if we are with the cursor on the line &#8216;p=prod(a,b)&#8217; and we push Step Into then the cursor will go into the &#8216;prod&#8217; function and we will be be able to go line by line thru the code of this function;</p>
<p>- passing thru the code by Step Over (F10) we go line by line thru the code but the debugger will jump over called functions (these will be executed, but not line by line in a debug mode).</p>
<p>- Step Out should make the debugger get out of the function where the cursor is, and not close the debug mode, thing which is happening now.</p>
<p>The green arrow labeled with 2 is the current line. If we push F10 (Step Over), the arrow will move to the next line.</p>
<p>Running a code in the Debug mode a new page opens within the Toolbox pageframe, which is divided in two (areas 3 and 4).</p>
<p>In area 3 we see the name of the file that&#8217;s being run, the name of the function and the number of the line where we are in the debug mode.</p>
<p>Area 4 is similar to the Watch window from Borland C++ / Borland Pascal or other older IDEs , where can be watched realtime the values and types of variables.</p>
<p>In picture above in area 4 we have 3 variables which we follow : a, s and p. The variable &#8216;a&#8217; has the value of 5 because we passed the line &#8216;a=5&#8242; where we are initializing it. The variable &#8216;p&#8217; has the value 0, because this is the default value taken by the integer variables when they are defined, while &#8217;s&#8217; is undefined, because that&#8217;s the stop where the execution is stopped, right before it being declared.</p>
<p>These being said I wish you luck writing codes and debugging them.</p>
<div class='dd_after'><table><tr><td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://mqlmagazine.com/metatrader5/the-debugger-a-novelty-of-mt5/&amp;t=The+Debugger+-+a+Novelty+of+MT5&amp;s=compact' height='18' width='120' frameborder='0' scrolling='no'></iframe></td><td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://mqlmagazine.com/metatrader5/the-debugger-a-novelty-of-mt5/&amp;title=The+Debugger+-+a+Novelty+of+MT5&amp;t=2' height='18' width='120' frameborder='0' scrolling='no'></iframe></td><td><script type='text/javascript'><!--yahooBuzzArticleHeadline=The+Debugger+-+a+Novelty+of+MT5;//--></script><script type='text/javascript' src='http://d.yimg.com/ds/badge2.js' badgetype='small-votes'></script></td><td><iframe src='http://api.tweetmeme.com/button.js?url=http://mqlmagazine.com/metatrader5/the-debugger-a-novelty-of-mt5/&amp;source=&amp;style=compact' height='20' width='90' frameborder='0' scrolling='no'></iframe></td><td><script type='text/javascript'> var fbShare = {url: 'http://mqlmagazine.com/metatrader5/the-debugger-a-novelty-of-mt5/',size:'small'}</script> <script type='text/javascript' src='http://widgets.fbshare.me/files/fbshare.js'></script></td></tr></table></div><!-- Generated by Digg Digg plugin, 
    Author : Yong Mook Kim
    Website : http://www.mkyong.com/blog/digg-digg-wordpress-plugin/ -->]]></content:encoded>
			<wfw:commentRss>http://mqlmagazine.com/metatrader5/the-debugger-a-novelty-of-mt5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

