<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — OverflowError in Indicator Chart on main app view]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/1395/" />
	<updated>2010-02-26T22:21:06Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/1395/overflowerror-in-indicator-chart-on-main-app-view/</id>
		<entry>
			<title type="html"><![CDATA[Re: OverflowError in Indicator Chart on main app view]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/4444/#p4444" />
			<content type="html"><![CDATA[<p>Hi Popov,<br />thanks for helping out with my C# code !! Next time I get an error like this, I&#039;ll look for this type of situation first.</p>]]></content>
			<author>
				<name><![CDATA[krog]]></name>
				<uri>https://forexsb.com/forum/user/1692/</uri>
			</author>
			<updated>2010-02-26T22:21:06Z</updated>
			<id>https://forexsb.com/forum/post/4444/#p4444</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: OverflowError in Indicator Chart on main app view]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/4439/#p4439" />
			<content type="html"><![CDATA[<p>Hello Krog,</p><p>First thank you for the informative error report.</p><br /><p>I found a potential mistake in the code and after correction it seems work fine:</p><br /><p><a href="http://www.postimage.org/image.php?v=PqMrYCJ"><span class="postimg"><img src="http://s3.postimage.org/MrYCJ.jpg" alt="http://s3.postimage.org/MrYCJ.jpg" /></span></a></p><br /><p>The bandpass indicator calls its previous values in the calculations:</p><p>double <strong>previous1 </strong>= adBandpass[iBar-1];<br />double <strong>previous2 </strong>= adBandpass[iBar-2];</p><p>double bandpass = .5*(1-alpha)*(price - price2) + beta*(1+alpha)*<strong>previous1 </strong>- alpha*<strong>previous2</strong>;<br />double val = bandpass / Point;<br />adBandpass[iBar] = val;</p><p>If you make a Point correction in the main cycle, each next values of the indicator becomes 1000 times greater than the previous (very rough said) because of:</p><p>double val = bandpass <strong>/ Point</strong>;</p><p>and adBandpass[iBar] very fast becomes <em>Infinity</em>.</p><br /><p>So I removed &quot;/ Point&quot; from the cycle and made the correction after that:</p><div class="codebox"><pre><code>for (int iBar = iFirstBar; iBar &lt; Bars; iBar++)
{

    double price  = (High[iBar] + Low[iBar]) / 2;
    double price2 = (High[iBar-2] + Low[iBar-2]) / 2;

    double previous1 = adBandpass[iBar-1];
    double previous2 = adBandpass[iBar-2];

    double bandpass = .5*(1-alpha)*(price - price2) + beta*(1+alpha)*previous1 - alpha*previous2;
    double val = bandpass;

    adBandpass[iBar] = val;
}

for (int i =0; i&lt; Bars; i++)
    adBandpass[i] /= Point;</code></pre></div><br /><p>By adding this code:<br /></p><div class="codebox"><pre><code>for (int i =0; i&lt; Bars; i++)
    adBandpass[i] /= Point;</code></pre></div><p>After the main calculation cycle.</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2010-02-26T06:31:37Z</updated>
			<id>https://forexsb.com/forum/post/4439/#p4439</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[OverflowError in Indicator Chart on main app view]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/4434/#p4434" />
			<content type="html"><![CDATA[<p>Hi,<br />I coded an indicator for a bandpass filter from the latest issue of TASC. When I set the first component to the indicator values divided by Point (to adjust for the pip value for different crosses), I get a &quot;Overflow Error&quot;, and the Indicator Chart on the main view does not display. If I set the indicator value to divide by Point to a different array for a later component, it works without throwing the error.</p><p>I can workaround the issue. I thought it might be something you would be interested in.&nbsp; Or, it might be something in the way I have coded the indicator.</p><p>I have attached files to repro including:<br />- Custom Indicator .cs file<br />- stategy .xml file<br />- Overflow Error message .txt file (copied and pasted)<br />- screenshot .png of main app<br />- data source .csv file<br />- screenshot of FSB version .png file</p><p>To repro:<br />- copy Bandpass.cs to Custom Indicators<br />- copy bandpass.xml to Strategies<br />- open FSB<br />- Load bandpass.xml</p><p>To workaround:<br />- comment out line 129:&nbsp; adBandpass[iBar] = val;<br />- uncomment line 133:&nbsp; &nbsp; adBandpass[iBar] = bandpass;</p><p>In the Custom Indicator around line 125, I&#039;ve added comments for more info; you can comment and uncomment a couple of lines to repro and avoid the Overflow Error.</p><p>Let me know if you need more info. I am happy to help out.</p>]]></content>
			<author>
				<name><![CDATA[krog]]></name>
				<uri>https://forexsb.com/forum/user/1692/</uri>
			</author>
			<updated>2010-02-26T00:39:35Z</updated>
			<id>https://forexsb.com/forum/post/4434/#p4434</id>
		</entry>
</feed>
