//+--------------------------------------------------------------------+ //| Copyright: (C) 2014, Miroslav Popov - All rights reserved! | //| Website: http://forexsb.com/ | //| Support: http://forexsb.com/forum/ | //| License: Proprietary under the following circumstances: | //| | //| This code is a part of Forex Strategy Builder. It is free for | //| use as an integral part of Forex Strategy Builder. | //| One can modify it in order to improve the code or to fit it for | //| personal use. This code or any part of it cannot be used in | //| another applications without a permission. Contact information | //| cannot be changed. | //| | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | //| | //| In no event shall the author be liable for any damages whatsoever | //| (including, without limitation, incidental, direct, indirect and | //| consequential damages, damages for loss of business profits, | //| business interruption, loss of business information, or other | //| pecuniary loss) arising out of the use or inability to use this | //| product, even if advised of the possibility of such damages. | //+--------------------------------------------------------------------+ #property copyright "Copyright 2014, Miroslav Popov" #property link "http://forexsb.com" #property version "1.00" #property strict #include #include //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class FishyTurbo : public Indicator { public: FishyTurbo(SlotTypes slotType) { SlotType=slotType; IndicatorName="Fishy Turbo"; WarningMessage = ""; IsAllowLTF = true; ExecTime = ExecutionTime_DuringTheBar; IsSeparateChart = true; IsDiscreteValues = false; IsDeafultGroupAll = false; } virtual void Calculate(DataSet &dataSet); }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void FishyTurbo::Calculate(DataSet &dataSet) { Data=GetPointer(dataSet); // Reading the parameters MAMethod maSmtMethod = (MAMethod)ListParam[1].Index; MAMethod maOscMethod = MAMethod_Weighted; BasePrice basePrice = (BasePrice)ListParam[2].Index; int iSmtPeriod = (int)NumParam[0].Value; int iOscPeriod = (int)NumParam[2].Value; double dLevel = NumParam[1].Value; int iPrvs = CheckParam[0].Checked ? 1 : 0; // Calculation int iFirstBar=iSmtPeriod+iOscPeriod+2; double adBasePrice[]; Price(basePrice,adBasePrice); double adPos[]; ArrayResize(adPos, Data.Bars); ArrayInitialize(adPos,0); double adNeg[]; ArrayResize(adNeg, Data.Bars); ArrayInitialize(adNeg,0); double adRSI[]; ArrayResize(adRSI, Data.Bars); ArrayInitialize(adRSI,0); double adRescaledRSI[]; ArrayResize(adRescaledRSI,Data.Bars); ArrayInitialize(adRescaledRSI,0); double adFishyTurbo[]; ArrayResize(adFishyTurbo,Data.Bars); ArrayInitialize(adFishyTurbo,0); for(int iBar=1; iBar adBasePrice[iBar - 1]) adPos[iBar] = adBasePrice[iBar] - adBasePrice[iBar - 1]; if(adBasePrice[iBar] < adBasePrice[iBar - 1]) adNeg[iBar] = adBasePrice[iBar - 1] - adBasePrice[iBar]; } double adPosMA[]; MovingAverage(iSmtPeriod,0,maSmtMethod,adPos,adPosMA); double adNegMA[]; MovingAverage(iSmtPeriod,0,maSmtMethod,adNeg,adNegMA); for(int iBar=iFirstBar; iBar