<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Forex Software — Fishy turbo]]></title>
		<link>https://forexsb.com/forum/topic/4970/fishy-turbo/</link>
		<atom:link href="https://forexsb.com/forum/feed/rss/topic/4970/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Fishy turbo.]]></description>
		<lastBuildDate>Tue, 09 Sep 2014 13:34:16 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Fishy turbo]]></title>
			<link>https://forexsb.com/forum/post/26270/#p26270</link>
			<description><![CDATA[<p>Good for you <img src="https://forexsb.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>If there are no objections I&#039;ll substitute the indicator in the repo.</p>]]></description>
			<author><![CDATA[null@example.com (footon)]]></author>
			<pubDate>Tue, 09 Sep 2014 13:34:16 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/26270/#p26270</guid>
		</item>
		<item>
			<title><![CDATA[Re: Fishy turbo]]></title>
			<link>https://forexsb.com/forum/post/26268/#p26268</link>
			<description><![CDATA[<p>THIS IS MY VERSION</p><br /><br /><div class="codebox"><pre><code>//==============================================================
// Forex Strategy Builder
// Copyright © Miroslav Popov. All rights reserved.  - CORRECTED
//==============================================================
// THIS CODE IS PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE.
//==============================================================
/*
Indicator Description
Basically this indicator is a smoothend RSI indicator with some exponential multiplier in order to extract the
swinging oscillating feature of the RSI. It&#039;s a powerful oscillating indicator.
*/

using System;
using System.Drawing;
using ForexStrategyBuilder.Infrastructure.Entities;
using ForexStrategyBuilder.Infrastructure.Enums;
using ForexStrategyBuilder.Infrastructure.Interfaces;

namespace ForexStrategyBuilder.Indicators.Store
{
    public class FishyTurbo : Indicator
    {
        public FishyTurbo()
        {
            // General properties
            IndicatorName  = &quot;Fishy Turbo&quot;;
            PossibleSlots  = SlotTypes.OpenFilter | SlotTypes.CloseFilter;
            SeparatedChart = true;
            SeparatedChartMinValue = -1;
            SeparatedChartMaxValue = 1;

            IndicatorAuthor = &quot;Denny Imanuel&quot;;
            IndicatorVersion = &quot;2.0&quot;;
            IndicatorDescription = &quot;A custom indicator for FSB and FST.&quot;;
        }

        public override void Initialize(SlotTypes slotType)
        {
            SlotType = slotType;

            // The ComboBox parameters
            IndParam.ListParam[0].Caption = &quot;Logic&quot;;
            IndParam.ListParam[0].ItemList = new string[]
            {
                &quot;The Fishy Turbo rises&quot;,
                &quot;The Fishy Turbo falls&quot;,
                &quot;The Fishy Turbo is higher than the Level line&quot;,
                &quot;The Fishy Turbo is lower than the Level line&quot;,
                &quot;The Fishy Turbo crosses the Level line upward&quot;,
                &quot;The Fishy Turbo crosses the Level line downward&quot;,
                &quot;The Fishy Turbo changes its direction upward&quot;,
                &quot;The Fishy Turbo changes its direction downward&quot;
            };
            IndParam.ListParam[0].Index    = 0;
            IndParam.ListParam[0].Text     = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
            IndParam.ListParam[0].Enabled  = true;
            IndParam.ListParam[0].ToolTip  = &quot;Logic of application of the indicator.&quot;;

            IndParam.ListParam[1].Caption  = &quot;Smoothing method&quot;;
            IndParam.ListParam[1].ItemList = Enum.GetNames(typeof(MAMethod));
            IndParam.ListParam[1].Index    = (int)MAMethod.Smoothed;
            IndParam.ListParam[1].Text     = IndParam.ListParam[1].ItemList[IndParam.ListParam[1].Index];
            IndParam.ListParam[1].Enabled  = true;
            IndParam.ListParam[1].ToolTip  = &quot;The Moving Average method used for smoothing the RSI value.&quot;;

            IndParam.ListParam[2].Caption  = &quot;Base price&quot;;
            IndParam.ListParam[2].ItemList = Enum.GetNames(typeof(BasePrice));
            IndParam.ListParam[2].Index    = (int)BasePrice.Close;
            IndParam.ListParam[2].Text     = IndParam.ListParam[2].ItemList[IndParam.ListParam[2].Index];
            IndParam.ListParam[2].Enabled  = true;
            IndParam.ListParam[2].ToolTip  = &quot;The price the RSI is based on.&quot;;

            // The NumericUpDown parameters
            IndParam.NumParam[0].Caption   = &quot;Smoothing period&quot;;
            IndParam.NumParam[0].Value     = 5;
            IndParam.NumParam[0].Min       = 1;
            IndParam.NumParam[0].Max       = 200;
            IndParam.NumParam[0].Enabled   = true;
            IndParam.NumParam[0].ToolTip   = &quot;The period of smoothing of the RSI value.&quot;;

            IndParam.NumParam[1].Caption   = &quot;Level&quot;;
            IndParam.NumParam[1].Value     = 0;
            IndParam.NumParam[1].Min       = -1;
            IndParam.NumParam[1].Max       = 1;
            IndParam.NumParam[1].Point     = 2;
            IndParam.NumParam[1].Enabled   = true;
            IndParam.NumParam[1].ToolTip   = &quot;A critical level (for the appropriate logic).&quot;;

            IndParam.NumParam[2].Caption   = &quot;Oscillating Period&quot;;
            IndParam.NumParam[2].Value     = 5;
            IndParam.NumParam[2].Min       = 1;
            IndParam.NumParam[2].Max       = 200;
            IndParam.NumParam[2].Enabled   = true;
            IndParam.NumParam[2].ToolTip   = &quot;A critical level (for the appropriate logic).&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;;
        }

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;
            
            // Reading the parameters
            MAMethod  maSmtMethod   = (MAMethod)IndParam.ListParam[1].Index;
            MAMethod  maOscMethod   = MAMethod.Weighted;
            BasePrice basePrice     = (BasePrice)IndParam.ListParam[2].Index;
            int       iSmtPeriod    = (int)IndParam.NumParam[0].Value;
            int          iOscPeriod    = (int)IndParam.NumParam[2].Value;
            double    dLevel        = IndParam.NumParam[1].Value;
            int       iPrvs         = IndParam.CheckParam[0].Checked ? 1 : 0;

            // Calculation
            int      iFirstBar   = iSmtPeriod + iOscPeriod + 2;
            double[] adBasePrice = Price(basePrice);
            double[] adPos       = new double[Bars];
            double[] adNeg       = new double[Bars];
            double[] adRSI       = new double[Bars];
            double[] adRescaledRSI = new double[Bars];
            double[] adFishyTurbo  = new double[Bars];

            for (int iBar = 1; iBar &lt; Bars; iBar++)
            {
                if (adBasePrice[iBar] &gt; adBasePrice[iBar - 1]) adPos[iBar] = adBasePrice[iBar] - adBasePrice[iBar - 1];
                if (adBasePrice[iBar] &lt; adBasePrice[iBar - 1]) adNeg[iBar] = adBasePrice[iBar - 1] - adBasePrice[iBar];
            }

            double[] adPosMA = MovingAverage(iSmtPeriod, 0, maSmtMethod, adPos);
            double[] adNegMA = MovingAverage(iSmtPeriod, 0, maSmtMethod, adNeg);

            for (int iBar = iFirstBar; iBar &lt; Bars; iBar++)
            {
                if (adNegMA[iBar] == 0)
                    adRSI[iBar] = 100;
                else
                    adRSI[iBar] = 100 - (100 / (1 + adPosMA[iBar] / adNegMA[iBar]));
                adRescaledRSI[iBar] = (adRSI[iBar]-50)/10;
            }
            
            double[] adSmoothedRSI = MovingAverage(iOscPeriod, 0, maOscMethod, adRescaledRSI);

            for (int iBar = iFirstBar; iBar &lt; Bars; iBar++)
            {
               adFishyTurbo[iBar] = (Math.Exp(2*adSmoothedRSI[iBar])-1)/(Math.Exp(2*adSmoothedRSI[iBar])+1);
            }
            
            // Saving the components
            Component = new IndicatorComp[3];

            Component[0] = new IndicatorComp();
            Component[0].CompName   = &quot;Fishy Turbo&quot;;
            Component[0].DataType   = IndComponentType.IndicatorValue;
            Component[0].ChartType  = IndChartType.Line;
            Component[0].ChartColor = Color.RoyalBlue;
            Component[0].FirstBar   = iFirstBar;
            Component[0].Value      = adFishyTurbo;

            Component[1] = new IndicatorComp();
            Component[1].ChartType  = IndChartType.NoChart;
            Component[1].FirstBar   = iFirstBar;
            Component[1].Value      = new double[Bars];

            Component[2] = new IndicatorComp();
            Component[2].ChartType  = IndChartType.NoChart;
            Component[2].FirstBar   = iFirstBar;
            Component[2].Value      = new double[Bars];

            // Sets the Component&#039;s type
            if (SlotType == SlotTypes.OpenFilter)
            {
                Component[1].DataType = IndComponentType.AllowOpenLong;
                Component[1].CompName = &quot;Is long entry allowed&quot;;
                Component[2].DataType = IndComponentType.AllowOpenShort;
                Component[2].CompName = &quot;Is short entry allowed&quot;;
            }
            else if (SlotType == SlotTypes.CloseFilter)
            {
                Component[1].DataType = IndComponentType.ForceCloseLong;
                Component[1].CompName = &quot;Close out long position&quot;;
                Component[2].DataType = IndComponentType.ForceCloseShort;
                Component[2].CompName = &quot;Close out short position&quot;;
            }

            // Calculation of the logic
            IndicatorLogic indLogic = IndicatorLogic.It_does_not_act_as_a_filter;

            switch (IndParam.ListParam[0].Text)
            {
                case &quot;The Fishy Turbo rises&quot;:
                    indLogic = IndicatorLogic.The_indicator_rises;
                    SpecialValues = new double[1] { 0 };
                    break;

                case &quot;The Fishy Turbo falls&quot;:
                    indLogic = IndicatorLogic.The_indicator_falls;
                    SpecialValues = new double[1] { 0 };
                    break;

                case &quot;The Fishy Turbo is higher than the Level line&quot;:
                    indLogic = IndicatorLogic.The_indicator_is_higher_than_the_level_line;
                    SpecialValues = new double[2] { dLevel,   -  dLevel };
                    break;

                case &quot;The Fishy Turbo is lower than the Level line&quot;:
                    indLogic = IndicatorLogic.The_indicator_is_lower_than_the_level_line;
                    SpecialValues = new double[2] { dLevel,   -  dLevel };
                    break;

                case &quot;The Fishy Turbo crosses the Level line upward&quot;:
                    indLogic = IndicatorLogic.The_indicator_crosses_the_level_line_upward;
                    SpecialValues = new double[2] { dLevel,   -  dLevel };
                    break;

                case &quot;The Fishy Turbo crosses the Level line downward&quot;:
                    indLogic = IndicatorLogic.The_indicator_crosses_the_level_line_downward;
                    SpecialValues = new double[2] { dLevel,   -  dLevel };
                    break;

                case &quot;The Fishy Turbo changes its direction upward&quot;:
                    indLogic = IndicatorLogic.The_indicator_changes_its_direction_upward;
                    SpecialValues = new double[1] { 0 };
                    break;

                case &quot;The Fishy Turbo changes its direction downward&quot;:
                    indLogic = IndicatorLogic.The_indicator_changes_its_direction_downward;
                    SpecialValues = new double[1] { 0 };
                    break;
            }

            OscillatorLogic(iFirstBar, iPrvs, adFishyTurbo, dLevel,   -  dLevel, ref Component[1], ref Component[2], indLogic);
        }

        public override void SetDescription()
        {
            string sLevelLong  = IndParam.NumParam[1].ValueToString;
            string sLevelShort = IndParam.NumParam[1].AnotherValueToString( - IndParam.NumParam[1].Value);

            EntryFilterLongDescription  = &quot;the &quot; + ToString() + &quot; &quot;;
            EntryFilterShortDescription = &quot;the &quot; + ToString() + &quot; &quot;;
            ExitFilterLongDescription   = &quot;the &quot; + ToString() + &quot; &quot;;
            ExitFilterShortDescription  = &quot;the &quot; + ToString() + &quot; &quot;;

            switch (IndParam.ListParam[0].Text)
            {
                case &quot;The Fishy Turbo rises&quot;:
                    EntryFilterLongDescription  += &quot;rises&quot;;
                    EntryFilterShortDescription += &quot;falls&quot;;
                    ExitFilterLongDescription   += &quot;rises&quot;;
                    ExitFilterShortDescription  += &quot;falls&quot;;
                    break;

                case &quot;The Fishy Turbo falls&quot;:
                    EntryFilterLongDescription  += &quot;falls&quot;;
                    EntryFilterShortDescription += &quot;rises&quot;;
                    ExitFilterLongDescription   += &quot;falls&quot;;
                    ExitFilterShortDescription  += &quot;rises&quot;;
                    break;

                case &quot;The Fishy Turbo is higher than the Level line&quot;:
                    EntryFilterLongDescription  += &quot;is higher than the Level &quot; + sLevelLong;
                    EntryFilterShortDescription += &quot;is lower than the Level &quot;  + sLevelShort;
                    ExitFilterLongDescription   += &quot;is higher than the Level &quot; + sLevelLong;
                    ExitFilterShortDescription  += &quot;is lower than the Level &quot;  + sLevelShort;
                    break;

                case &quot;The Fishy Turbo is lower than the Level line&quot;:
                    EntryFilterLongDescription  += &quot;is lower than the Level &quot;  + sLevelLong;
                    EntryFilterShortDescription += &quot;is higher than the Level &quot; + sLevelShort;
                    ExitFilterLongDescription   += &quot;is lower than the Level &quot;  + sLevelLong;
                    ExitFilterShortDescription  += &quot;is higher than the Level &quot; + sLevelShort;
                    break;

                case &quot;The Fishy Turbo crosses the Level line upward&quot;:
                    EntryFilterLongDescription  += &quot;crosses the Level &quot; + sLevelLong  + &quot; upward&quot;;
                    EntryFilterShortDescription += &quot;crosses the Level &quot; + sLevelShort + &quot; downward&quot;;
                    ExitFilterLongDescription   += &quot;crosses the Level &quot; + sLevelLong  + &quot; upward&quot;;
                    ExitFilterShortDescription  += &quot;crosses the Level &quot; + sLevelShort + &quot; downward&quot;;
                    break;

                case &quot;The Fishy Turbo crosses the Level line downward&quot;:
                    EntryFilterLongDescription  += &quot;crosses the Level &quot; + sLevelLong  + &quot; downward&quot;;
                    EntryFilterShortDescription += &quot;crosses the Level &quot; + sLevelShort + &quot; upward&quot;;
                    ExitFilterLongDescription   += &quot;crosses the Level &quot; + sLevelLong  + &quot; downward&quot;;
                    ExitFilterShortDescription  += &quot;crosses the Level &quot; + sLevelShort + &quot; upward&quot;;
                    break;

                case &quot;The Fishy Turbo changes its direction upward&quot;:
                    EntryFilterLongDescription  += &quot;changes its direction upward&quot;;
                    EntryFilterShortDescription += &quot;changes its direction downward&quot;;
                    ExitFilterLongDescription   += &quot;changes its direction upward&quot;;
                    ExitFilterShortDescription  += &quot;changes its direction downward&quot;;
                    break;

                case &quot;The Fishy Turbo changes its direction downward&quot;:
                    EntryFilterLongDescription  += &quot;changes its direction downward&quot;;
                    EntryFilterShortDescription += &quot;changes its direction upward&quot;;
                    ExitFilterLongDescription   += &quot;changes its direction downward&quot;;
                    ExitFilterShortDescription  += &quot;changes its direction upward&quot;;
                    break;
            }
        }

        public override string ToString()
        {
            return IndicatorName +
                (IndParam.CheckParam[0].Checked ? &quot;* (&quot; : &quot; (&quot;) +
                IndParam.ListParam[1].Text         + &quot;, &quot; + // Smoothing method
                IndParam.ListParam[2].Text         + &quot;, &quot; + // Base price
                IndParam.NumParam[0].ValueToString + &quot;, &quot; + // Smoothing period
                IndParam.NumParam[2].ValueToString + &quot;)&quot;;   // Oscillating period
        }
    }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (dkg11hu)]]></author>
			<pubDate>Tue, 09 Sep 2014 10:16:43 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/26268/#p26268</guid>
		</item>
		<item>
			<title><![CDATA[Re: Fishy turbo]]></title>
			<link>https://forexsb.com/forum/post/26264/#p26264</link>
			<description><![CDATA[<p>Indeed, a little oversight from Denny. Good catch! </p><p>Should be fixed below.</p>]]></description>
			<author><![CDATA[null@example.com (footon)]]></author>
			<pubDate>Mon, 08 Sep 2014 23:45:34 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/26264/#p26264</guid>
		</item>
		<item>
			<title><![CDATA[Fishy turbo]]></title>
			<link>https://forexsb.com/forum/post/26262/#p26262</link>
			<description><![CDATA[<p>I might be wrong, but I am afraid that this indivator has got an erroneous short logic that results in a Level greater than 1.</p><p>As Fishy turbo level must be GE (-1) &amp; LE (1), in case it is e.g. (-1) the short logic results in 3 as it is calculated as 2 - Dlevel, where Dlevel is (-1)</p><p>------------------------------------------------</p>]]></description>
			<author><![CDATA[null@example.com (dkg11hu)]]></author>
			<pubDate>Mon, 08 Sep 2014 20:56:11 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/26262/#p26262</guid>
		</item>
	</channel>
</rss>
