<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — How to add shift to bands indicators]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/4551/" />
	<updated>2013-12-09T12:33:31Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/4551/how-to-add-shift-to-bands-indicators/</id>
		<entry>
			<title type="html"><![CDATA[Re: How to add shift to bands indicators]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/22951/#p22951" />
			<content type="html"><![CDATA[<p>That&#039;s weird. It can&#039;t be that it doesn&#039;t work. Hmm...</p><p>Keep my suggestion, shift only the band itself and change the starting point of the for loop like below:</p><div class="codebox"><pre><code>for (int bar = firstBar; bar &lt; Bars - iShift; bar++)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2013-12-09T12:33:31Z</updated>
			<id>https://forexsb.com/forum/post/22951/#p22951</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to add shift to bands indicators]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/22937/#p22937" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>footon wrote:</cite><blockquote><p>Oops, sorry, I misread you. You want bar shifts. </p><p>No need to shift adMa, you should shift the whole band only. </p><p>This should be what you&#039;re looking for.</p><div class="codebox"><pre><code>adUpBand[bar + iShift] = adMA[bar] + mpl* stdDev;
adDnBand[bar + iShift] = adMA[bar] - mpl * stdDev;</code></pre></div></blockquote></div><p>i tried it before but not working !!!</p>]]></content>
			<author>
				<name><![CDATA[ahmedalhoseny]]></name>
				<uri>https://forexsb.com/forum/user/1512/</uri>
			</author>
			<updated>2013-12-09T04:52:12Z</updated>
			<id>https://forexsb.com/forum/post/22937/#p22937</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to add shift to bands indicators]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/22932/#p22932" />
			<content type="html"><![CDATA[<p>Oops, sorry, I misread you. You want bar shifts. </p><p>No need to shift adMa, you should shift the whole band only. </p><p>This should be what you&#039;re looking for.</p><div class="codebox"><pre><code>adUpBand[bar + iShift] = adMA[bar] + mpl* stdDev;
adDnBand[bar + iShift] = adMA[bar] - mpl * stdDev;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2013-12-07T20:08:30Z</updated>
			<id>https://forexsb.com/forum/post/22932/#p22932</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to add shift to bands indicators]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/22931/#p22931" />
			<content type="html"><![CDATA[<p>and this what i have done&nbsp; in the previous post these changes i have done&nbsp; but visually after i plot on screen there are differences !!!!</p><br /><p>I think the problem in the StDev part but couldnot figure how tofix it .</p>]]></content>
			<author>
				<name><![CDATA[ahmedalhoseny]]></name>
				<uri>https://forexsb.com/forum/user/1512/</uri>
			</author>
			<updated>2013-12-07T18:48:08Z</updated>
			<id>https://forexsb.com/forum/post/22931/#p22931</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to add shift to bands indicators]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/22930/#p22930" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>IndParam.NumParam[2].Caption = &quot;Shift&quot;;
            IndParam.NumParam[2].Value = 0;
            IndParam.NumParam[2].Min = 0;
            IndParam.NumParam[2].Max = 200;
            IndParam.NumParam[2].Enabled = true;
            IndParam.NumParam[2].ToolTip = &quot;The number of bars to shift with.&quot;;

            // The CheckBox parameters
            IndParam.CheckParam[0].Caption = &quot;Use previous bar value&quot;;
            IndParam.CheckParam[0].Enabled = true;
            IndParam.CheckParam[0].ToolTip = &quot;Use the indicator value from the previous bar.&quot;;</code></pre></div><div class="codebox"><pre><code>var iShift = (int)IndParam.NumParam[2].Value;
            int prvs = IndParam.CheckParam[0].Checked ? 1 : 0;</code></pre></div><div class="codebox"><pre><code>double[] adMA = MovingAverage(nMA, iShift, maMethod, adPrice);</code></pre></div><div class="codebox"><pre><code>int firstBar = nMA + iShift + prvs + 2;

            for (int bar = nMA; bar &lt; Bars - iShift; bar++)
            {
                double sum = 0;
                for (int i = 0; i &lt; nMA; i++)
                {
                    double delta = (adPrice[bar - i] - adMA[bar]);
                    sum += delta*delta;
                }
                double stdDev = Math.Sqrt(sum/nMA);
                adUpBand[bar + iShift] = adMA[bar + iShift] + mpl* stdDev;
                adDnBand[bar + iShift] = adMA[bar + iShift] - mpl * stdDev;
            }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ahmedalhoseny]]></name>
				<uri>https://forexsb.com/forum/user/1512/</uri>
			</author>
			<updated>2013-12-07T18:36:24Z</updated>
			<id>https://forexsb.com/forum/post/22930/#p22930</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to add shift to bands indicators]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/22928/#p22928" />
			<content type="html"><![CDATA[<p>Ahmed, the best way I think would be to look at other indicators with vertical shift, like Recent Swing High Low. Look how it&#039;s done, and implement it similarly (new for loop after the main one, then add the shift to upper and lower band).</p>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2013-12-07T14:36:58Z</updated>
			<id>https://forexsb.com/forum/post/22928/#p22928</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How to add shift to bands indicators]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/22927/#p22927" />
			<content type="html"><![CDATA[<p>Moving average and Donch channel have shift function by bars <br />but when come to band like bollingerbands it will not work </p><p>i modified the BB indicator with shift function it compiled fine&nbsp; but the logic changed because of StDev not shifted &#039;&#039;i think&#039;&#039;&nbsp; </p><p>How to fix this obstacle</p><p>Regards</p>]]></content>
			<author>
				<name><![CDATA[ahmedalhoseny]]></name>
				<uri>https://forexsb.com/forum/user/1512/</uri>
			</author>
			<updated>2013-12-07T12:46:07Z</updated>
			<id>https://forexsb.com/forum/post/22927/#p22927</id>
		</entry>
</feed>
