<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Forex Software — Turning indicators on and off in single strategy]]></title>
		<link>https://forexsb.com/forum/topic/7858/turning-indicators-on-and-off-in-single-strategy/</link>
		<atom:link href="https://forexsb.com/forum/feed/rss/topic/7858/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Turning indicators on and off in single strategy.]]></description>
		<lastBuildDate>Sun, 16 Jun 2019 09:29:04 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Turning indicators on and off in single strategy]]></title>
			<link>https://forexsb.com/forum/post/55971/#p55971</link>
			<description><![CDATA[<p>Hi Popov,</p><p>Why did I not think of that! So simple!</p><p>Thank you for your help I really appreciate it!.</p>]]></description>
			<author><![CDATA[null@example.com (Michael1)]]></author>
			<pubDate>Sun, 16 Jun 2019 09:29:04 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/55971/#p55971</guid>
		</item>
		<item>
			<title><![CDATA[Re: Turning indicators on and off in single strategy]]></title>
			<link>https://forexsb.com/forum/post/55970/#p55970</link>
			<description><![CDATA[<p>If you want to enable or disable separate indicators, add the following flags:</p><div class="codebox"><pre><code>input bool ind0enabled= true; // Indicator MACD Enabled
input bool ind1enabled= true; // Indicator Volume Enabled</code></pre></div><p>And then in `ManageOpen`:</p><div class="codebox"><pre><code>void ManageOpen()
  {
...

   const bool canOpenLong  = (!ind0enabled || ind0long)  &amp;&amp; (!ind1enabled || ind1long);
   const bool canOpenShort = (!ind0enabled || ind0short) &amp;&amp; (!ind1enabled || ind1short);</code></pre></div><br /><p>It works like that:</p><p>The original code gives a signal when both indicators allow it:<br /></p><div class="codebox"><pre><code>   const bool canOpenLong  = ind0long &amp;&amp; ind1long;</code></pre></div><p>Now we change `ind0long` with `(!ind0enabled || ind0long)` and the same for the others.</p><p>If `ind0enabled` is `true` and because we negate the flag, the `||` must check the second rule. The code works as the original one.</p><p>If `ind0enabled` is `false`, it negates to `true` and the code allows the entry no matter the actual indicator signal.</p>]]></description>
			<author><![CDATA[null@example.com (Popov)]]></author>
			<pubDate>Sun, 16 Jun 2019 04:43:42 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/55970/#p55970</guid>
		</item>
		<item>
			<title><![CDATA[Re: Turning indicators on and off in single strategy]]></title>
			<link>https://forexsb.com/forum/post/55969/#p55969</link>
			<description><![CDATA[<p>It is easy:</p><p>Add these two lines at the beginning of the expert, just below `#property strict`:</p><div class="codebox"><pre><code>input bool AllowEntry = true; // Allow Entry
input bool AllowExit  = true; // Allow Exit</code></pre></div><br /><p>Add these checks at the beginning of `ManageOpen` and `ManageClose` functions:</p><div class="codebox"><pre><code>void ManageOpen()
  {
   if (!AllowEntry) return;

....

void ManageClose()
  {
   if (!AllowExit) return;</code></pre></div><br /><p>You will have options for allowing entry or exits at the Expert&#039;s Input.</p><p><span class="postimg"><img src="https://image-holder.forexsb.com/store/expert-advisor-options-for-allow-entry-and-allow-exit.png" alt="https://image-holder.forexsb.com/store/expert-advisor-options-for-allow-entry-and-allow-exit.png" /></span></p>]]></description>
			<author><![CDATA[null@example.com (Popov)]]></author>
			<pubDate>Sun, 16 Jun 2019 04:28:46 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/55969/#p55969</guid>
		</item>
		<item>
			<title><![CDATA[Turning indicators on and off in single strategy]]></title>
			<link>https://forexsb.com/forum/post/55966/#p55966</link>
			<description><![CDATA[<p>Im wondering if someone can help with with this problem.</p><p>I want to be able to turn ON/OFF opening and closing indicators signals given by EA Studio generated stratgies from the strategy properties screen on MT4. Reason being is I am building some EA&#039;s for some friends and they want to be able to play around with what indicators they want to use ie build a EA using EA Studio with RSI,MACD,EMA and they then have the ability to turn off the RSI for example.</p><p>The way I have tried is making the Indictor a bool however if I do this and set to false then no entry signals are created, due to how the manageOpen is coded:</p><p>void ManageOpen()<br />&nbsp; {<br />&nbsp; &nbsp;double ind0val1 = iRSI(NULL,0,Ind0Param0,PRICE_CLOSE,1);<br />&nbsp; &nbsp;bool ind0long&nbsp; = ind0val1 &gt; Ind0Param1 + sigma &amp;&amp; ActivateRSI;<br />&nbsp; &nbsp;bool ind0short = ind0val1 &lt; 100 - Ind0Param1 - sigma ;</p><p>&nbsp; &nbsp;double ind1val1 = iMA(NULL,0,Ind1Param0,0,MODE_LWMA,PRICE_CLOSE,1);<br />&nbsp; &nbsp;double ind1val2 = iMA(NULL,0,Ind1Param1,0,MODE_LWMA,PRICE_CLOSE,1);<br />&nbsp; &nbsp;bool ind1long&nbsp; = ind1val1 &gt; ind1val2 + sigma &amp;&amp; ActivateVWMA;<br />&nbsp; &nbsp;bool ind1short = ind1val1 &lt; ind1val2 - sigma ;</p><p>&nbsp; &nbsp;double ind2val1 = iMACD(NULL,0,Ind2Param0,Ind2Param1,Ind2Param2,PRICE_CLOSE,MODE_MAIN,1);<br />&nbsp; &nbsp;double ind2val2 = iMACD(NULL,0,Ind2Param0,Ind2Param1,Ind2Param2,PRICE_CLOSE,MODE_MAIN,2);<br />&nbsp; &nbsp;double ind2val3 = iMACD(NULL,0,Ind2Param0,Ind2Param1,Ind2Param2,PRICE_CLOSE,MODE_MAIN,3);<br />&nbsp; &nbsp;bool ind2long&nbsp; = ind2val1 &gt; ind2val2 + sigma &amp;&amp; ind2val2 &lt; ind2val3 - sigma &amp;&amp; ActivateMACD;<br />&nbsp; &nbsp;bool ind2short = ind2val1 &lt; ind2val2 - sigma &amp;&amp; ind2val2 &gt; ind2val3 + sigma ;</p><p>&nbsp; &nbsp;double ind3val1 = iMA(NULL,0,Ind3Param0,0,MODE_EMA,PRICE_CLOSE,1);<br />&nbsp; &nbsp;double ind3val2 = iMA(NULL,0,Ind3Param1,0,MODE_EMA,PRICE_CLOSE,1);<br />&nbsp; &nbsp;bool ind3long&nbsp; = ind3val1 &gt; ind3val2 + sigma &amp;&amp; ActivateEMA;<br />&nbsp; &nbsp;bool ind3short = ind3val1 &lt; ind3val2 - sigma ;</p><p>&nbsp; &nbsp;const bool canOpenLong&nbsp; = ind0long &amp;&amp; ind1long &amp;&amp; ind2long &amp;&amp; ind3long;<br />&nbsp; &nbsp;const bool canOpenShort = ind0short &amp;&amp; ind1short &amp;&amp; ind2short &amp;&amp; ind3short;</p><p>&nbsp; &nbsp;if(canOpenLong &amp;&amp; canOpenShort)<br />&nbsp; &nbsp; &nbsp; return;</p><p>&nbsp; &nbsp;if(canOpenLong)<br />&nbsp; &nbsp; &nbsp; OpenPosition(OP_BUY);<br />&nbsp; &nbsp;else if(canOpenShort)<br />&nbsp; &nbsp; &nbsp; OpenPosition(OP_SELL);<br />&nbsp; }</p>]]></description>
			<author><![CDATA[null@example.com (Michael1)]]></author>
			<pubDate>Sun, 16 Jun 2019 03:55:49 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/55966/#p55966</guid>
		</item>
	</channel>
</rss>
