<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — Use previous bar value (UPBV) question]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/8336/" />
	<updated>2020-04-13T19:32:40Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/8336/use-previous-bar-value-upbv-question/</id>
		<entry>
			<title type="html"><![CDATA[Re: Use previous bar value (UPBV) question]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/60193/#p60193" />
			<content type="html"><![CDATA[<p>Yes, Pinbar M is mine. The setting of PBV you see in FSB affects it in no way. Signal bar is not shifted, neither it is delayed. It uses closed bars, which value is known. And therefore it calculates and works reliably.</p>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2020-04-13T19:32:40Z</updated>
			<id>https://forexsb.com/forum/post/60193/#p60193</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Use previous bar value (UPBV) question]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/60191/#p60191" />
			<content type="html"><![CDATA[<p>As I said before, some indicators apply the PBV later, when they actually calculate the signals. If you see the ATRStop indicator, it first calculates ATR and then uses the PBV when calculates the signal array `atrStop`.</p><p><a href="https://image-holder.forexsb.com/store/atr-stop-upbv.png"><span class="postimg"><img src="https://image-holder.forexsb.com/store/atr-stop-upbv-thumb.png" alt="https://image-holder.forexsb.com/store/atr-stop-upbv-thumb.png" /></span></a></p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2020-04-13T16:54:53Z</updated>
			<id>https://forexsb.com/forum/post/60191/#p60191</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Use previous bar value (UPBV) question]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/60189/#p60189" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>footon wrote:</cite><blockquote><p>It is C#, not C++ <img src="https://forexsb.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Can you give a real example from the indicators? It would help to explain better.</p><p>Secondly, previous bar value comes in to play in the logic calculation, where trading signals are raised. In some custom indis you might find PBV cut out and taken into account already in the indi value calculation block.</p><p>Thirdly, if only open prices are used in the calculation, PBV is not used, in FSB PBV is automatically switched off. If, for example, there are other price points used in addition (or without open prices), PBV is a must.</p><p>Taking into account those points above, in your abstract example case nr 1 doesn&#039;t seem to need the use of PBV, but the 2nd case needs it.</p><p>Finally, I would not describe it as a &quot;shift&quot;. It is extremely vital necessity for having a reliable and reproducible backtest result. It is a matter of using the latest <span class="bbu">confirmed</span> datapoints! It doesn&#039;t shift, but uses latest closed values, which do not change.</p></blockquote></div><p>Thanks for detailed answers!</p><p><span class="bbu">Example of indicator 1)</span> - Pinbar M (uses only Bar-1 values):<br /> for (int iBar = 1; iBar &lt; Bars; iBar++)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Math.Abs(Close[iBar - 1] - Open[iBar - 1]) &lt; iPERCENT * 0.01 * (High[iBar - 1] - Low[iBar - 1]))<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; doji[iBar] = 1;</p><br /><p><span class="bbu">Example of indicator 2)</span> - ATR (AverageTrueRange) - (uses High[bar], Low[bar]):<br /> for (int bar = 1; bar &lt; Bars; bar++)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; atr[bar] = Math.Max(High[bar], Close[bar - 1]) - Math.Min(Low[bar], Close[bar - 1]);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; atr = MovingAverage(period, 0, maMethod, atr);</p>]]></content>
			<author>
				<name><![CDATA[Finmod123]]></name>
				<uri>https://forexsb.com/forum/user/11348/</uri>
			</author>
			<updated>2020-04-13T13:25:33Z</updated>
			<id>https://forexsb.com/forum/post/60189/#p60189</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Use previous bar value (UPBV) question]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/60187/#p60187" />
			<content type="html"><![CDATA[<p>In addition to Footon&#039;s explanations, I may add that there is a difference between the values of the plotted line and the actual signals. The indicators show and plots their lines without PBV in order to look like as the MetaTrader indicators in the chart. The PBV is used when the indicator calculates the trading signals.</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2020-04-13T12:52:23Z</updated>
			<id>https://forexsb.com/forum/post/60187/#p60187</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Use previous bar value (UPBV) question]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/60186/#p60186" />
			<content type="html"><![CDATA[<p>It is C#, not C++ <img src="https://forexsb.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Can you give a real example from the indicators? It would help to explain better.</p><p>Secondly, previous bar value comes in to play in the logic calculation, where trading signals are raised. In some custom indis you might find PBV cut out and taken into account already in the indi value calculation block.</p><p>Thirdly, if only open prices are used in the calculation, PBV is not used, in FSB PBV is automatically switched off. If, for example, there are other price points used in addition (or without open prices), PBV is a must.</p><p>Taking into account those points above, in your abstract example case nr 1 doesn&#039;t seem to need the use of PBV, but the 2nd case needs it.</p><p>Finally, I would not describe it as a &quot;shift&quot;. It is extremely vital necessity for having a reliable and reproducible backtest result. It is a matter of using the latest <span class="bbu">confirmed</span> datapoints! It doesn&#039;t shift, but uses latest closed values, which do not change.</p>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2020-04-13T12:42:17Z</updated>
			<id>https://forexsb.com/forum/post/60186/#p60186</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Use previous bar value (UPBV) question]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/60185/#p60185" />
			<content type="html"><![CDATA[<p>Hello traders!</p><p>I have noticed 2 different versions of indicators by C++ code: <br />1) Indicator [bar] = Function of O, H, L, C [bar-1, bar-2, bar-3…..]<br />2) Indicator [bar] = Function of O,H, L, C [bar, bar-1, bar-2, bar-3,...]<br /><span class="bbu"><br />Question:</span><br />If we use UPBV=true and indicator 1): will the result be shifted by 2 bars ? (1 bar in C++ code and 1 bar by means of UPBV = true)</p>]]></content>
			<author>
				<name><![CDATA[Finmod123]]></name>
				<uri>https://forexsb.com/forum/user/11348/</uri>
			</author>
			<updated>2020-04-13T12:26:37Z</updated>
			<id>https://forexsb.com/forum/post/60185/#p60185</id>
		</entry>
</feed>
