<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — Bug: Swap Type Misinterpretation in Metatrader 5 Data Export Script]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/9870/" />
	<updated>2024-12-24T07:32:02Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/9870/bug-swap-type-misinterpretation-in-metatrader-5-data-export-script/</id>
		<entry>
			<title type="html"><![CDATA[Re: Bug: Swap Type Misinterpretation in Metatrader 5 Data Export Script]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/82208/#p82208" />
			<content type="html"><![CDATA[<p>I&#039;ll check this case.</p><p>Thank you for the report!</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2024-12-24T07:32:02Z</updated>
			<id>https://forexsb.com/forum/post/82208/#p82208</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bug: Swap Type Misinterpretation in Metatrader 5 Data Export Script]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/81581/#p81581" />
			<content type="html"><![CDATA[<p>A function like this could be used to fix the issue:</p><div class="codebox"><pre><code>int MapSwapModeToMT4(int mt5SwapMode) 
{
   switch (mt5SwapMode) 
   {
      case SYMBOL_SWAP_MODE_POINTS:
         return 0; // Same as MT4 &#039;in points&#039;
      case SYMBOL_SWAP_MODE_CURRENCY_SYMBOL:
         return 1; // Same as MT4 &#039;in the symbol base currency&#039;
      case SYMBOL_SWAP_MODE_INTEREST_CURRENT:
         return 2; // Matches &#039;by interest&#039; conceptually
      case SYMBOL_SWAP_MODE_CURRENCY_MARGIN:
         return 3; // Same as MT4 &#039;in the margin currency&#039;
      // Any other cases unique to MT5
      default:
         return 0; // Default to 0 if no MT4 equivalent
   }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[geektrader]]></name>
				<uri>https://forexsb.com/forum/user/1841/</uri>
			</author>
			<updated>2024-10-29T03:29:44Z</updated>
			<id>https://forexsb.com/forum/post/81581/#p81581</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Bug: Swap Type Misinterpretation in Metatrader 5 Data Export Script]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/81580/#p81580" />
			<content type="html"><![CDATA[<p>Hey Mr. Popov,</p><p>I&#039;ve stumbled upon a little hiccup in the Data Export script for Metatrader 5 (Data Export.mq5). </p><p>Here&#039;s the scoop: it seems like there&#039;s a bug where the script misinterprets the swap type. For those familiar, the enumeration of swap types in Metatrader 4 is quite different from that in Metatrader 5.</p><p>In Metatrader 4, the values are as follows:<br />- 0 - in points<br />- 1 - in the symbol&#039;s base currency<br />- 2 - by interest<br />- 3 - in the margin currency</p><p>You can check it out here: <a href="https://book.mql4.com/appendix/marketinfo">https://book.mql4.com/appendix/marketinfo</a></p><p>Expert Advisor Studio aligns with this interpretation in its Symbol settings too. </p><p>Now, in Metatrader 5, the swap types are enumerated differently:<br />- 0 - Swaps disabled (no swaps)<br />- 1 - Swaps are charged in points<br />- 2 - Swaps are charged in money in the base currency of the symbol<br />- 3 - Swaps are charged in money in the margin currency of the symbol<br />- 4 - Swaps are charged in money, in client deposit currency<br />....<br />And so on... For the full list, visit: <a href="https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_swap_mode">https://www.mql5.com/en/docs/constants/ … _swap_mode</a></p><p>This disparity leads to incorrect swap modes being exported in the Metatrader 5 Data Export script. Given these differences in enumeration, the Data Export script for MQ5 should ideally incorporate mappings to align swap types correctly with those in Metatrader 4 and Expert Advisor Studio.</p><p>Thanks for looking into this, and as always, happy trading, everyone!</p><p>Cheers!</p>]]></content>
			<author>
				<name><![CDATA[geektrader]]></name>
				<uri>https://forexsb.com/forum/user/1841/</uri>
			</author>
			<updated>2024-10-29T03:13:13Z</updated>
			<id>https://forexsb.com/forum/post/81580/#p81580</id>
		</entry>
</feed>
