<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	
	>
<channel>
	<title>
	Comments on: Hacking a HFT system	</title>
	<atom:link href="https://financial-hacker.com/hacking-hft-systems/feed/" rel="self" type="application/rss+xml" />
	<link>https://financial-hacker.com/hacking-hft-systems/</link>
	<description>A new view on algorithmic trading</description>
	<lastBuildDate>Sun, 06 Mar 2022 08:58:03 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: William		</title>
		<link>https://financial-hacker.com/hacking-hft-systems/#comment-69696</link>

		<dc:creator><![CDATA[William]]></dc:creator>
		<pubDate>Tue, 23 Feb 2021 00:54:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=2359#comment-69696</guid>

					<description><![CDATA[Well, indeed MT4/MT5 (with a little preference for MT4 for the moment). Actually, their prices are all linked. If we base our analysis on a macro view, we will see that the candlesticks are quite the same. When we zoom to the millisecond scale, it is all something else. I have even spotted discrepancies between different servers of a single broker.
Regarding the fact of FPGA based system, it was to avoid the time of transaction of Metatrader. They say MT5 can open more than 100 orders in 1 sec or one order every 9~10ms. It is quite nice but unfortunately, it will be too long for a solid HFT arbitrage strategy most of all if you sum it with latency of back and forth signal. This field of trading requires to save as many ms as possible for which giving this task to the FPGA/SoC would be very competitive. This applies for both latency and triangular arbitrage even if I can barely see a situation in which triangular arbitrage could work considering the high spreads (even 1pip on EURUSD and on USDJPY is quite high if we want to take advantage of currency quotation discrepancies)! So with the fact that we have a substantial latency and the spread, HFT is not the best choice I have at my disposal. For the moment and after not having solved my price acquisition system, I am pursuing another avenue.
By the way, Jcl, please tell me if I am polluting your articles with my comments. So far, I try to stick to the topic.]]></description>
			<content:encoded><![CDATA[<p>Well, indeed MT4/MT5 (with a little preference for MT4 for the moment). Actually, their prices are all linked. If we base our analysis on a macro view, we will see that the candlesticks are quite the same. When we zoom to the millisecond scale, it is all something else. I have even spotted discrepancies between different servers of a single broker.<br />
Regarding the fact of FPGA based system, it was to avoid the time of transaction of Metatrader. They say MT5 can open more than 100 orders in 1 sec or one order every 9~10ms. It is quite nice but unfortunately, it will be too long for a solid HFT arbitrage strategy most of all if you sum it with latency of back and forth signal. This field of trading requires to save as many ms as possible for which giving this task to the FPGA/SoC would be very competitive. This applies for both latency and triangular arbitrage even if I can barely see a situation in which triangular arbitrage could work considering the high spreads (even 1pip on EURUSD and on USDJPY is quite high if we want to take advantage of currency quotation discrepancies)! So with the fact that we have a substantial latency and the spread, HFT is not the best choice I have at my disposal. For the moment and after not having solved my price acquisition system, I am pursuing another avenue.<br />
By the way, Jcl, please tell me if I am polluting your articles with my comments. So far, I try to stick to the topic.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: jcl		</title>
		<link>https://financial-hacker.com/hacking-hft-systems/#comment-69658</link>

		<dc:creator><![CDATA[jcl]]></dc:creator>
		<pubDate>Thu, 18 Feb 2021 15:09:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=2359#comment-69658</guid>

					<description><![CDATA[Since you mention MT4 and MT5, I suppose you want to arbitrage Forex. MT4/MT5 brokers are usually market makers. They don&#039;t have liquidity providers, but produce the prices on their servers. So their prices are all different. Normally they make sure by artificial spread settings and transaction delays that there is no arbitrage opportunity - but there may be exceptions. If you analyzed their price algorithms and knew their data sources, you can maybe take advantage of them even without an FPGA based system.]]></description>
			<content:encoded><![CDATA[<p>Since you mention MT4 and MT5, I suppose you want to arbitrage Forex. MT4/MT5 brokers are usually market makers. They don&#8217;t have liquidity providers, but produce the prices on their servers. So their prices are all different. Normally they make sure by artificial spread settings and transaction delays that there is no arbitrage opportunity &#8211; but there may be exceptions. If you analyzed their price algorithms and knew their data sources, you can maybe take advantage of them even without an FPGA based system.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: William		</title>
		<link>https://financial-hacker.com/hacking-hft-systems/#comment-69647</link>

		<dc:creator><![CDATA[William]]></dc:creator>
		<pubDate>Thu, 18 Feb 2021 02:12:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=2359#comment-69647</guid>

					<description><![CDATA[Hi thank you for your detailed answer. Well, regarding broker arbitrage policy, I already heard stuff like that but didn&#039;t really give a glance at the rules. I hope they are not dishonest enough to kick you out with neither notice, nor mention in the agreement...
As far as I am concerned, there may be 2 main arbitrage techniques both require a very low latency and a very fast system (that is the where the FPGA could intervene even if there is more to take with a latency than a FPGA over a PC system) :
Latency arbitrage which makes you take opportunities on a slow broker with signals coming from a faster broker. The ideal condition would be that all the brokers&#039; prices were exactly the same but with a little time discrepancy between them. As you will have seen in my pictures on the link, this is not that simple... Sometimes a broker shows a price that evolves in a clear direction and the other one doesn&#039;t follow and sometimes they have the same behaviour. So it becomes complicated to infer from this an algorithm that would offer you a 99% winrate. In this case, maybe the AI may give a good help.
The other form of arbitrage that could be used on retail trading systems is triangular arbitrage for which for a very short period of time you will have two of three correlated currency pairs (let&#039;s say EURUSD/GBPUSD/EURGBP) that offers an opportunity .
But when trade on PC, with MT4 , you can&#039;t take arbitrage opportunities fast enough, whereas they say MT5 is suited for HFT and arbitrage techniques. The FPGA (SoC) would be a very good assistant but as you said, we would need the API.

Best regards]]></description>
			<content:encoded><![CDATA[<p>Hi thank you for your detailed answer. Well, regarding broker arbitrage policy, I already heard stuff like that but didn&#8217;t really give a glance at the rules. I hope they are not dishonest enough to kick you out with neither notice, nor mention in the agreement&#8230;<br />
As far as I am concerned, there may be 2 main arbitrage techniques both require a very low latency and a very fast system (that is the where the FPGA could intervene even if there is more to take with a latency than a FPGA over a PC system) :<br />
Latency arbitrage which makes you take opportunities on a slow broker with signals coming from a faster broker. The ideal condition would be that all the brokers&#8217; prices were exactly the same but with a little time discrepancy between them. As you will have seen in my pictures on the link, this is not that simple&#8230; Sometimes a broker shows a price that evolves in a clear direction and the other one doesn&#8217;t follow and sometimes they have the same behaviour. So it becomes complicated to infer from this an algorithm that would offer you a 99% winrate. In this case, maybe the AI may give a good help.<br />
The other form of arbitrage that could be used on retail trading systems is triangular arbitrage for which for a very short period of time you will have two of three correlated currency pairs (let&#8217;s say EURUSD/GBPUSD/EURGBP) that offers an opportunity .<br />
But when trade on PC, with MT4 , you can&#8217;t take arbitrage opportunities fast enough, whereas they say MT5 is suited for HFT and arbitrage techniques. The FPGA (SoC) would be a very good assistant but as you said, we would need the API.</p>
<p>Best regards</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: jcl		</title>
		<link>https://financial-hacker.com/hacking-hft-systems/#comment-69607</link>

		<dc:creator><![CDATA[jcl]]></dc:creator>
		<pubDate>Sun, 14 Feb 2021 12:06:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=2359#comment-69607</guid>

					<description><![CDATA[Thank you. I think forex brokers prevent broker arbitrage mainly by analyzing suspicious trading behavior, and by their business terms. They might kick you out when they suspect you of broker arbitrage. Usually they notice it after a couple days and the arbitrage opportunity will then disappear.

For connecting a FPGA based system to a MT4 or MT5 server you need to analyze their traffic with the terminal. I don&#039;t know if they have a documented API for connecting to their server, but I doubt it.]]></description>
			<content:encoded><![CDATA[<p>Thank you. I think forex brokers prevent broker arbitrage mainly by analyzing suspicious trading behavior, and by their business terms. They might kick you out when they suspect you of broker arbitrage. Usually they notice it after a couple days and the arbitrage opportunity will then disappear.</p>
<p>For connecting a FPGA based system to a MT4 or MT5 server you need to analyze their traffic with the terminal. I don&#8217;t know if they have a documented API for connecting to their server, but I doubt it.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: William		</title>
		<link>https://financial-hacker.com/hacking-hft-systems/#comment-69599</link>

		<dc:creator><![CDATA[William]]></dc:creator>
		<pubDate>Sat, 13 Feb 2021 19:51:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=2359#comment-69599</guid>

					<description><![CDATA[Hi jcl,

So bad that I have found your article this late. As long as I was looking for more answers, I googled &quot;FPGA metatrader4&quot;.

Anyways, this article/blog/study is very interesting.

&quot;Broker arbitrage is theoretically possible with Forex, but difficult because Forex brokers are doing all they can for preventing it.&quot;. What do you mean by that? How would they avoid to follow real price action?

So actually, I am interested in this arbitrage thing and think that the only real way to address arbitrage is FPGAs and SoCs and obviously coupled to a very low latency. I have started a little work in a first place to define whether a strategy can be applied and which should be the brokers to choose to apply it. I have published it on this forum (https://www.forexfactory.com/thread/post/13314153) but I am facing the nasty obstacle of the 15ms resolution, I will probably work out later.

JCL, do you have any idea whether an FPGA/SoC can directly connect to a MetaTrader broker server without using MT4 or MT5?

Thank you for work anyway.]]></description>
			<content:encoded><![CDATA[<p>Hi jcl,</p>
<p>So bad that I have found your article this late. As long as I was looking for more answers, I googled &#8220;FPGA metatrader4&#8221;.</p>
<p>Anyways, this article/blog/study is very interesting.</p>
<p>&#8220;Broker arbitrage is theoretically possible with Forex, but difficult because Forex brokers are doing all they can for preventing it.&#8221;. What do you mean by that? How would they avoid to follow real price action?</p>
<p>So actually, I am interested in this arbitrage thing and think that the only real way to address arbitrage is FPGAs and SoCs and obviously coupled to a very low latency. I have started a little work in a first place to define whether a strategy can be applied and which should be the brokers to choose to apply it. I have published it on this forum (<a href="https://www.forexfactory.com/thread/post/13314153" rel="nofollow ugc">https://www.forexfactory.com/thread/post/13314153</a>) but I am facing the nasty obstacle of the 15ms resolution, I will probably work out later.</p>
<p>JCL, do you have any idea whether an FPGA/SoC can directly connect to a MetaTrader broker server without using MT4 or MT5?</p>
<p>Thank you for work anyway.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: jcl		</title>
		<link>https://financial-hacker.com/hacking-hft-systems/#comment-68074</link>

		<dc:creator><![CDATA[jcl]]></dc:creator>
		<pubDate>Tue, 17 Nov 2020 14:20:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=2359#comment-68074</guid>

					<description><![CDATA[I don&#039;t know if MT4/5 poll data from their servers, but they use polling to pass the data to their EAs or to other platforms.]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know if MT4/5 poll data from their servers, but they use polling to pass the data to their EAs or to other platforms.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Tom		</title>
		<link>https://financial-hacker.com/hacking-hft-systems/#comment-68071</link>

		<dc:creator><![CDATA[Tom]]></dc:creator>
		<pubDate>Tue, 17 Nov 2020 11:15:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=2359#comment-68071</guid>

					<description><![CDATA[You are mentioning the Zorro polling cycle as well as the MT4 polling cycle. Does this mean that the MT4 client actually polls the data from the broker&#039;s server or is it being pushed by the server?

Do you happen to know how the MT5 terminal handles this topic? Is the tickdata being pushed to the MT5 client and subsequently to the Zorro client or is there polling happening as well?

Thanks a lot for the sharing such informative details!]]></description>
			<content:encoded><![CDATA[<p>You are mentioning the Zorro polling cycle as well as the MT4 polling cycle. Does this mean that the MT4 client actually polls the data from the broker&#8217;s server or is it being pushed by the server?</p>
<p>Do you happen to know how the MT5 terminal handles this topic? Is the tickdata being pushed to the MT5 client and subsequently to the Zorro client or is there polling happening as well?</p>
<p>Thanks a lot for the sharing such informative details!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: jcl		</title>
		<link>https://financial-hacker.com/hacking-hft-systems/#comment-68054</link>

		<dc:creator><![CDATA[jcl]]></dc:creator>
		<pubDate>Mon, 16 Nov 2020 14:40:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=2359#comment-68054</guid>

					<description><![CDATA[MT4 ticks have no exchange timestamps. That means the time stamps that you see are the time when Zorro received them. Because the MT4 plugin is not streaming but polled, multiple ticks can come in at the same time. This happens when either Zorro&#039;s polling cycle or the MT4 polling cycle took longer than the time between the ticks. For Zorro you can set up the cycle with the TickTime variable, for MT4 there&#039;s a setting in the EA code. I believe it&#039;s 20 ms by default. It cannot be set much smaller because MT4 will then start choking.]]></description>
			<content:encoded><![CDATA[<p>MT4 ticks have no exchange timestamps. That means the time stamps that you see are the time when Zorro received them. Because the MT4 plugin is not streaming but polled, multiple ticks can come in at the same time. This happens when either Zorro&#8217;s polling cycle or the MT4 polling cycle took longer than the time between the ticks. For Zorro you can set up the cycle with the TickTime variable, for MT4 there&#8217;s a setting in the EA code. I believe it&#8217;s 20 ms by default. It cannot be set much smaller because MT4 will then start choking.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Tom		</title>
		<link>https://financial-hacker.com/hacking-hft-systems/#comment-68031</link>

		<dc:creator><![CDATA[Tom]]></dc:creator>
		<pubDate>Sun, 15 Nov 2020 15:47:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=2359#comment-68031</guid>

					<description><![CDATA[I was referring to live data not historical data. Zorro prints multiple/duplicate ticks with the same timestamp when using below&#039;s code to receive tickdata from two MT4 terminals (this is basically the code from your Simple Broker Arb example).

function tick()
{
	asset(ASSET_A);
	var AskA = priceClose(), BidA = priceClose() - Spread;
	asset(ASSET_B);
	var AskB = priceClose(), BidB = priceClose() - Spread;
		
printf(&quot;\n[%s.%.0f],%.2f,%.2f,%.2f,%.2f,%.i&quot;,strdate(HMS,0),1000.*modf(second(),0),BidA,AskA,BidB,AskB);	
}


I know  MT4 is too slow for actual HFT trading, but still it would be good to know that tickdata received from MT4 via Zorro is reliable and that there is not something wrong. Though, most likely I am the one doing something wrong here ;).

I hope this is not leading too off topic. I would very much appreciate hearing back from you!

Thanks
Tom]]></description>
			<content:encoded><![CDATA[<p>I was referring to live data not historical data. Zorro prints multiple/duplicate ticks with the same timestamp when using below&#8217;s code to receive tickdata from two MT4 terminals (this is basically the code from your Simple Broker Arb example).</p>
<p>function tick()<br />
{<br />
	asset(ASSET_A);<br />
	var AskA = priceClose(), BidA = priceClose() &#8211; Spread;<br />
	asset(ASSET_B);<br />
	var AskB = priceClose(), BidB = priceClose() &#8211; Spread;</p>
<p>printf(&#8220;\n[%s.%.0f],%.2f,%.2f,%.2f,%.2f,%.i&#8221;,strdate(HMS,0),1000.*modf(second(),0),BidA,AskA,BidB,AskB);<br />
}</p>
<p>I know  MT4 is too slow for actual HFT trading, but still it would be good to know that tickdata received from MT4 via Zorro is reliable and that there is not something wrong. Though, most likely I am the one doing something wrong here ;).</p>
<p>I hope this is not leading too off topic. I would very much appreciate hearing back from you!</p>
<p>Thanks<br />
Tom</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: jcl		</title>
		<link>https://financial-hacker.com/hacking-hft-systems/#comment-67936</link>

		<dc:creator><![CDATA[jcl]]></dc:creator>
		<pubDate>Wed, 11 Nov 2020 13:54:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=2359#comment-67936</guid>

					<description><![CDATA[MT4 terminals are not suited for HFT arbitrage, but I think you know that. The reason of the multiple ticks in a backtest is likely that these ticks are also repeated in the historical data - you can check the data with the History script. If there are multiple ticks, there&#039;s a dataparse flag that can be used to filter them out.]]></description>
			<content:encoded><![CDATA[<p>MT4 terminals are not suited for HFT arbitrage, but I think you know that. The reason of the multiple ticks in a backtest is likely that these ticks are also repeated in the historical data &#8211; you can check the data with the History script. If there are multiple ticks, there&#8217;s a dataparse flag that can be used to filter them out.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
