<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — Spread limiter]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/3353/" />
	<updated>2013-06-04T22:55:51Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/3353/spread-limiter/</id>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/20215/#p20215" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Miro, if you&#039;ll convert this, make sure FST&#039;s namespace is used, it&#039;s no use in FSB.</p></blockquote></div><p>This is the reason I choose this indicator to demonstrate the new parameters.<br />As I announced earlier, all new indicators are both compatible with FSB and FST. But that doesn&#039;t mean that there is no separation in functionality.</p><p>There is a new parameter: <strong>IsBacktester</strong>. This param is equal to <strong>true</strong> when the indicator works in FSB and <strong>false</strong> when works in FST.</p><p>You can see for an example: <a href="https://github.com/PopovMP/Forex-Strategy-Builder/blob/master/Source/ForexStrategyBuilder/Indicators/Store/DateFilter.cs">DateFilter</a><br />Date filter works only in FSB. <br />I&#039;m using IsBacktester in constructor to set an warning message when indicator is started in FST.</p><div class="codebox"><pre><code>if (IsBacktester)
   WarningMessage = &quot;This indicator is designed to be used in the backtester only. It doesn&#039;t work in the trader.&quot;;</code></pre></div><p>This warning will be visible only in FST. I cannot demonstrate that because Date Filter is internally banned in FST, but everyone can use this technique in other indicator. </p><br /><p>Later, In Calculation method. I&#039;m using:</p><div class="codebox"><pre><code>if (IsBacktester)
{
    switch (IndParam.ListParam[0].Text)
    {
        case &quot;Do not open positions after&quot;:
            for (int bar = firstBar; bar &lt; Bars; bar++)
                if (Time[bar] &lt; keyDate)
                    values[bar] = 1;
            break;
        ...
    }
}
else
{
    for (int bar = firstBar; bar &lt; Bars; bar++)
        values[bar] = 1;
}</code></pre></div><p>We see that the indicator calculates signals in FSB, but sets 1s for all bars in FST (Indicator confirms both direction trade).</p><p>I&#039;ll use same format but in opposite direction for Spread Limiter:<br />- It will be available for loading in both programs.<br />- It will gives reasonable signals in FST.<br />- It will warn that is not suitable for FSB (when loaded there)<br />- It will not have any effect on backtest in FSB.<br />- It will not be used from Generator. I&#039;ll set <em>IsGeneratable = false;</em> (also new param)</p><p>Why I want to use this format:<br />1. You never know what a user will do. It may put this indicator in FSB.<br />2. It will not prevent strategy written in FST with this indicator to be loaded in FSB.<br />3. We&#039;ll have one set of indicators for all programs.</p><div class="quotebox"><blockquote><p>namespace Forex_Strategy_Trader</p></blockquote></div><p>This namespace is no longer used. We use the following namespaces for all indicators in all three programs.</p><div class="codebox"><pre><code>using System;
using ForexStrategyBuilder.Infrastructure.Entities;
using ForexStrategyBuilder.Infrastructure.Enums;
using ForexStrategyBuilder.Infrastructure.Interfaces;

namespace ForexStrategyBuilder.Indicators.Store
{
    public class DateFilter : Indicator
    {
        ...
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2013-06-04T22:55:51Z</updated>
			<id>https://forexsb.com/forum/post/20215/#p20215</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/20211/#p20211" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Blaiserboy wrote:</cite><blockquote><p>Wow, Footon, you have been a great contributor to FSB and FST. Thanks muchly for all you have added.</p></blockquote></div><p>Thank you, Dave! But couple of days ago you said you didn&#039;t saw my indi corner indis until recently, now you say you&#039;re seeing the spread limiter for the first time, what have you been up to, mate? <img src="https://forexsb.com/forum/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2013-06-04T21:27:24Z</updated>
			<id>https://forexsb.com/forum/post/20211/#p20211</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/20210/#p20210" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Popov wrote:</cite><blockquote><p>I come here from the Feature Request forum of FSB.<br />This indicator does not make sense for FSB since FSB uses constant Spread value for the whole data series, but I can convert it in the new indicators format for FST. I&#039;ll use it&nbsp; to demonstrate some new indicator parameters.</p></blockquote></div><p>I believe the request wasn&#039;t done for FSB (the requestor is advanced user of FSB and knows it can&#039;t be achieved in FSB) but for FST. This indicator in particular is for FST. FSB won&#039;t load the indi. </p><p>Indi reads this:<br /></p><div class="codebox"><pre><code>namespace Forex_Strategy_Trader</code></pre></div><p>Miro, if you&#039;ll convert this, make sure FST&#039;s namespace is used, it&#039;s no use in FSB.</p>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2013-06-04T21:24:29Z</updated>
			<id>https://forexsb.com/forum/post/20210/#p20210</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/20208/#p20208" />
			<content type="html"><![CDATA[<p>I come here from the Feature Request forum of FSB.<br />This indicator does not make sense for FSB since FSB uses constant Spread value for the whole data series, but I can convert it in the new indicators format for FST. I&#039;ll use it&nbsp; to demonstrate some new indicator parameters.</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2013-06-04T21:15:00Z</updated>
			<id>https://forexsb.com/forum/post/20208/#p20208</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/20207/#p20207" />
			<content type="html"><![CDATA[<p>Wow, Footon, you have been a great contributor to FSB and FST. Thanks muchly for all you have added.</p>]]></content>
			<author>
				<name><![CDATA[Blaiserboy]]></name>
				<uri>https://forexsb.com/forum/user/2491/</uri>
			</author>
			<updated>2013-06-04T21:14:28Z</updated>
			<id>https://forexsb.com/forum/post/20207/#p20207</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/15000/#p15000" />
			<content type="html"><![CDATA[<p>Thank you for the feedback!</p>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2012-06-15T10:04:10Z</updated>
			<id>https://forexsb.com/forum/post/15000/#p15000</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/14998/#p14998" />
			<content type="html"><![CDATA[<p>footon, thank you very much for the indicator. it works perfectly well.</p>]]></content>
			<author>
				<name><![CDATA[ldnfx]]></name>
				<uri>https://forexsb.com/forum/user/5948/</uri>
			</author>
			<updated>2012-06-15T05:43:03Z</updated>
			<id>https://forexsb.com/forum/post/14998/#p14998</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/14818/#p14818" />
			<content type="html"><![CDATA[<p>sorry for that. i&#039;m now testing it on FST</p>]]></content>
			<author>
				<name><![CDATA[ldnfx]]></name>
				<uri>https://forexsb.com/forum/user/5948/</uri>
			</author>
			<updated>2012-06-07T19:52:26Z</updated>
			<id>https://forexsb.com/forum/post/14818/#p14818</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/14815/#p14815" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ldnfx wrote:</cite><blockquote><p>indi is not working. FSB doesnt see it<br /><a href="http://postimage.org/image/bdr1e98kd/"><span class="postimg"><img src="http://s14.postimage.org/bdr1e98kd/spread.jpg" alt="http://s14.postimage.org/bdr1e98kd/spread.jpg" /></span></a></p></blockquote></div><p>It is meant only for FST. It cannot be used with FSB, as in FSB spread is a constant value.</p>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2012-06-07T17:13:26Z</updated>
			<id>https://forexsb.com/forum/post/14815/#p14815</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/14814/#p14814" />
			<content type="html"><![CDATA[<p>indi is not working. FSB doesnt see it<br /><a href="http://postimage.org/image/bdr1e98kd/"><span class="postimg"><img src="http://s14.postimage.org/bdr1e98kd/spread.jpg" alt="http://s14.postimage.org/bdr1e98kd/spread.jpg" /></span></a></p>]]></content>
			<author>
				<name><![CDATA[ldnfx]]></name>
				<uri>https://forexsb.com/forum/user/5948/</uri>
			</author>
			<updated>2012-06-07T16:11:34Z</updated>
			<id>https://forexsb.com/forum/post/14814/#p14814</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/14806/#p14806" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>increases/decreases part is very tricky</p></blockquote></div><p>The problem is that Spread is not a series of values. We have only one, current value.<br /></p><div class="codebox"><pre><code>for (int iBar = 1; iBar &lt; Bars; iBar++)
    showspread[iBar] = spread / point;</code></pre></div><p>The code above do not make it a series. It puts last Spread value in each cell of the array.</p><p>There is not&nbsp; an easy way to compare Spread values. Even we cannot compare current spread with the previous bar one.</p><p>An indicator cannot hold an array with statistics about the spread. It will be reset many times because its constructor is called in various events.</p><p>It&#039;s possible only if FST or expert collects Spread stats and indicator has access to it.</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2012-06-07T03:52:22Z</updated>
			<id>https://forexsb.com/forum/post/14806/#p14806</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/14805/#p14805" />
			<content type="html"><![CDATA[<p>Ldnfx, please find the spread indi below. The first 4 logic conditions are there, increases/decreases part is very tricky for me (altough I&#039;m interested in this also), the indi should somehow &quot;remember&quot; the values which come in tick by tick and then compare them to determine increase/decrease. I believe it&#039;s achievable, but I lack the knowledge and experience of doing this.&nbsp; </p><p>Thank you!</p>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2012-06-07T00:03:39Z</updated>
			<id>https://forexsb.com/forum/post/14805/#p14805</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/14786/#p14786" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>I still do not understand why Spread declaration gives the context error, in the source it is declared as an instrument property next to others like Digits and Point, which both work very well.</p></blockquote></div><p><strong>Spread</strong> is not included in base class &quot;Indicator&quot; and you cannot access it directly as Digits and Point. You can use <strong>Data.InstrProperties.Spread</strong> instead.</p><p>You can use Point directly because it is declared in Indicator class:<br /></p><div class="codebox"><pre><code>protected static double Point { get { return Data.InstrProperties.Point; } }</code></pre></div><p>I&#039;ll also add the Spread in next releases like that:<br /></p><div class="codebox"><pre><code>protected static double Spread{ get { return Data.InstrProperties.Spread; } }</code></pre></div><p>You can use what is better for you:<br /> Spread gives a number as 32;<br /> Ask - Bid gives 0.00032.</p><div class="quotebox"><blockquote><p>The info panel is really not updating, if chart is opened, then maybe 2-3 times with the incoming ticks the spread changes and then it freezes</p></blockquote></div><p>Info panel updates on a new bar or when you move the mouse over the chart.</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2012-06-06T04:37:23Z</updated>
			<id>https://forexsb.com/forum/post/14786/#p14786</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/14782/#p14782" />
			<content type="html"><![CDATA[<p>Alright, I got the indi working, but one issue:</p><p>The info panel is really not updating, if chart is opened, then maybe 2-3 times with the incoming ticks the spread changes and then it freezes, if tabs are toggled and chart is brought back for viewing, info panel updates. It might not be a huge problem when internally it&#039;s always up to speed to the current spread, so am I right in assuming that the indi has always the latest spread value, even though it doesn&#039;t update it in the info panel?</p><p>I still do not understand why Spread declaration gives the context error, in the source it is declared as an instrument property next to others like Digits and Point, which both work very well.</p>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2012-06-05T19:03:24Z</updated>
			<id>https://forexsb.com/forum/post/14782/#p14782</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Spread limiter]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/14772/#p14772" />
			<content type="html"><![CDATA[<p>Try this way:</p><div class="codebox"><pre><code>double bid = Data.Bid;
double ask = Data.Ask;

// Calculation
double spread = ask - bid;
int firstBar = 1;

// Calculation of the logic
double[] spreads = new double[Bars];
for (int bar = firstBar; bar &lt; Bars; bar++)
     spreads[bar] = spread;</code></pre></div><p><span class="postimg"><img src="http://i.imgur.com/EkBtm.png" alt="http://i.imgur.com/EkBtm.png" /></span></p><p>Prototype is attached below.</p><p>Note: Info panel is not updated at every tick I think, but spread must be correct.</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2012-06-05T05:13:51Z</updated>
			<id>https://forexsb.com/forum/post/14772/#p14772</id>
		</entry>
</feed>
