<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — Math.Min ,max question]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/4070/" />
	<updated>2013-03-13T21:02:16Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/4070/mathmin-max-question/</id>
		<entry>
			<title type="html"><![CDATA[Re: Math.Min ,max question]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/18786/#p18786" />
			<content type="html"><![CDATA[<p>Seems to be right. Although I would use the main for loop like in my previous post:<br /></p><div class="codebox"><pre><code>for (int iBar = iFirstBar; iBar &lt; Bars; iBar++)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2013-03-13T21:02:16Z</updated>
			<id>https://forexsb.com/forum/post/18786/#p18786</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Math.Min ,max question]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/18785/#p18785" />
			<content type="html"><![CDATA[<p>thanks fotoon </p><p>So i can write the code for buy setup as follow <br /></p><div class="codebox"><pre><code>public override void Calculate(SlotTypes slotType)
        {
            // Reading the parameters
            int iFirstBar = 16;

            double[] adUp = new double[Bars];
            double[] adDn = new double[Bars];

            for (int iBar = 16; iBar &lt; Bars - 1; iBar++)
            {
                // Long trade
                //1. Today’s low is lower than the previous 15 lows.
                double dMin = double.MaxValue;
                for (int i = 1; i &lt; 16; i++)
                {
                    if (Low[iBar - i] &lt; dMin) dMin = Low[iBar - i];
                }

                if (Low[iBar - 1] &lt; dMin)
                    adUp[iBar] = 1;</code></pre></div><p>&nbsp; </p><p>Is that right !!!!!</p>]]></content>
			<author>
				<name><![CDATA[ahmedalhoseny]]></name>
				<uri>https://forexsb.com/forum/user/1512/</uri>
			</author>
			<updated>2013-03-13T20:53:31Z</updated>
			<id>https://forexsb.com/forum/post/18785/#p18785</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Math.Min ,max question]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/18783/#p18783" />
			<content type="html"><![CDATA[<p>You have to loop through all 15 bars to find the low. </p><p>I&#039;d do something like this, based on Donchian Channel indi:<br /></p><div class="codebox"><pre><code>for (int iBar = iFirstBar; iBar &lt; Bars; iBar++)
            {
                
                double dMin = double.MaxValue;
                for (int i = 1; i &lt; 16; i++)
                {
                    
                    if (Low[iBar - i]  &lt; dMin) dMin = Low[iBar - i];
                
                }
                
                 if (Low[iBar-1] &lt; dMin)
                    long[iBar]=1;
             }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2013-03-13T20:28:06Z</updated>
			<id>https://forexsb.com/forum/post/18783/#p18783</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Math.Min ,max question]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/18782/#p18782" />
			<content type="html"><![CDATA[<p>if Today’s low is lower than the previous 15 lows then buy </p><p>what is the mistake <br /></p><div class="codebox"><pre><code>public override void Calculate(SlotTypes slotType)
        {
            // Reading the parameters
            int iFirstBar = 16;

            double[] adUp = new double[Bars];
        double[] adDn = new double[Bars];

            for (int iBar = 16; iBar &lt; Bars - 1; iBar++)
            {
                // Long trade
                                //1. Today’s low is lower than the previous 15 lows.
                if (Low[iBar - 15] &lt; Math.Min(Low[iBar - 1], Low[iBar - 15]))
                adUp[iBar] = 1;</code></pre></div><br /><p>Thanks in advance</p>]]></content>
			<author>
				<name><![CDATA[ahmedalhoseny]]></name>
				<uri>https://forexsb.com/forum/user/1512/</uri>
			</author>
			<updated>2013-03-13T19:56:35Z</updated>
			<id>https://forexsb.com/forum/post/18782/#p18782</id>
		</entry>
</feed>
