<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — Daily Strategy does not open trades because of "closed market"]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/7854/" />
	<updated>2019-06-16T15:36:36Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/7854/daily-strategy-does-not-open-trades-because-of-closed-market/</id>
		<entry>
			<title type="html"><![CDATA[Re: Daily Strategy does not open trades because of "closed market"]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55974/#p55974" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Popov wrote:</cite><blockquote><p>Detecting Tester mode is easy. </p><p>Do that modification work well on all timeframes?</p><br /><p>Fixed `OnTick` function:</p><div class="codebox"><pre><code>void OnTick()
  {
   // Modification: Check if trading is allowed
   if(!IsTesting() &amp;&amp; !MarketInfo(_Symbol, MODE_TRADEALLOWED)) return;

   if(Time[0]&gt;barTime)
     {
      barTime=Time[0];
      OnBar();
     }
  }</code></pre></div></blockquote></div><p>Hi Popov :-). </p><p>I haven&#039;t tested the &#039;On Tick&#039; modification on shorter timeframes as I only trade live on D1....so not sure.</p><p>Thanks for the enhanced code.</p><p>Cheers</p><p>Rich B</p>]]></content>
			<author>
				<name><![CDATA[ats118765]]></name>
				<uri>https://forexsb.com/forum/user/10668/</uri>
			</author>
			<updated>2019-06-16T15:36:36Z</updated>
			<id>https://forexsb.com/forum/post/55974/#p55974</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Daily Strategy does not open trades because of "closed market"]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55968/#p55968" />
			<content type="html"><![CDATA[<p>Detecting Tester mode is easy. </p><p>Do that modification work well on all timeframes?</p><br /><p>Fixed `OnTick` function:</p><div class="codebox"><pre><code>void OnTick()
  {
   // Modification: Check if trading is allowed
   if(!IsTesting() &amp;&amp; !MarketInfo(_Symbol, MODE_TRADEALLOWED)) return;

   if(Time[0]&gt;barTime)
     {
      barTime=Time[0];
      OnBar();
     }
  }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2019-06-16T04:00:14Z</updated>
			<id>https://forexsb.com/forum/post/55968/#p55968</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Daily Strategy does not open trades because of "closed market"]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55967/#p55967" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Popov wrote:</cite><blockquote><p>It is a nice idea. If it works well, I may add it in the standard code.</p></blockquote></div><p>I use this for real and demo accounts in MT4 but not for backtest strategies. Once the code is adjusted it won&#039;t work in Strategy Tester. You therefore need to include 2 types of &#039;On tick&#039; code elements if you want it to work in both MT4 environments (one for strategy tester - eg. the current standard code generated by EA Studio) and this separate code for (live/demo accounts).</p><p>Cheers</p><p>RichB</p>]]></content>
			<author>
				<name><![CDATA[ats118765]]></name>
				<uri>https://forexsb.com/forum/user/10668/</uri>
			</author>
			<updated>2019-06-16T03:56:24Z</updated>
			<id>https://forexsb.com/forum/post/55967/#p55967</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Daily Strategy does not open trades because of "closed market"]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55965/#p55965" />
			<content type="html"><![CDATA[<p>It is a nice idea. If it works well, I may add it in the standard code.</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2019-06-15T18:24:49Z</updated>
			<id>https://forexsb.com/forum/post/55965/#p55965</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Daily Strategy does not open trades because of "closed market"]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55964/#p55964" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>mkowa wrote:</cite><blockquote><div class="quotebox"><cite>ats118765 wrote:</cite><blockquote><p>Try this.</p></blockquote></div><p>Thank you very much. I will try!</p></blockquote></div><p>It is working for me. Thank you very much.</p>]]></content>
			<author>
				<name><![CDATA[mkowa]]></name>
				<uri>https://forexsb.com/forum/user/10574/</uri>
			</author>
			<updated>2019-06-15T17:26:39Z</updated>
			<id>https://forexsb.com/forum/post/55964/#p55964</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Daily Strategy does not open trades because of "closed market"]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55913/#p55913" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ats118765 wrote:</cite><blockquote><p>Try this.</p></blockquote></div><p>Thank you very much. I will try!</p>]]></content>
			<author>
				<name><![CDATA[mkowa]]></name>
				<uri>https://forexsb.com/forum/user/10574/</uri>
			</author>
			<updated>2019-06-13T07:37:23Z</updated>
			<id>https://forexsb.com/forum/post/55913/#p55913</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Daily Strategy does not open trades because of "closed market"]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55908/#p55908" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>mkowa wrote:</cite><blockquote><p>Hi,<br />I downloaded daily data from EURTRY and got some wonderful strategies with EA Studio. However my broker never opens trades because at the beginning of any new daily bar &quot;the market is closed&quot;. A bit later it opens again but the EA is ready for that day then!<br />Is there&nbsp; any possibility to open trades some minutes earlier or later? Or should I try other timeframes?<br />Thank you for helping me outsmarting the brokers who always outsmarting me!</p></blockquote></div><p>Try this.</p><p>Modify the existing code in Metaeditor for the void OnTick() in the Portfolio compilation or single strategy with the following code. Recompile and then run. </p><p>I use this for Pepperstone for D1 as some trades were not initiated on open using the native code from the portfolio compiler.</p><br /><p>void OnTick()<br />&nbsp; {<br />&nbsp; &nbsp;if(Time[0]&gt;barTime &amp;&amp; MarketInfo(_Symbol, MODE_TRADEALLOWED) )<br />&nbsp; &nbsp; &nbsp;{<br />&nbsp; &nbsp; &nbsp; barTime=Time[0];<br />&nbsp; &nbsp; &nbsp; OnBar();<br />&nbsp; &nbsp; &nbsp;}<br />&nbsp; }</p>]]></content>
			<author>
				<name><![CDATA[ats118765]]></name>
				<uri>https://forexsb.com/forum/user/10668/</uri>
			</author>
			<updated>2019-06-13T02:38:06Z</updated>
			<id>https://forexsb.com/forum/post/55908/#p55908</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Daily Strategy does not open trades because of "closed market"]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55905/#p55905" />
			<content type="html"><![CDATA[<p>There is&nbsp; indicator&nbsp; - Entry time&nbsp; that should fix the difficulty</p>]]></content>
			<author>
				<name><![CDATA[Blaiserboy]]></name>
				<uri>https://forexsb.com/forum/user/2491/</uri>
			</author>
			<updated>2019-06-12T22:27:02Z</updated>
			<id>https://forexsb.com/forum/post/55905/#p55905</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Daily Strategy does not open trades because of "closed market"]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55904/#p55904" />
			<content type="html"><![CDATA[<p>Hi,<br />I downloaded daily data from EURTRY and got some wonderful strategies with EA Studio. However my broker never opens trades because at the beginning of any new daily bar &quot;the market is closed&quot;. A bit later it opens again but the EA is ready for that day then!<br />Is there&nbsp; any possibility to open trades some minutes earlier or later? Or should I try other timeframes?<br />Thank you for helping me outsmarting the brokers who always outsmarting me!</p>]]></content>
			<author>
				<name><![CDATA[mkowa]]></name>
				<uri>https://forexsb.com/forum/user/10574/</uri>
			</author>
			<updated>2019-06-12T21:23:40Z</updated>
			<id>https://forexsb.com/forum/post/55904/#p55904</id>
		</entry>
</feed>
