Popgun by tho.schu

426 downloads / 382 views / Created: 24.07.2017
 Average Rating: 0

Indicator Description

Popgun. A small candle whose distance from high to low is less than that of the following candle. The smaller candle is inside.
To determine the direction of the small candle, use CandleColor or CandleDirection (shift: 1).

https://forexsb.com/forum/topic/6774/pop-gun-formation/

Comments

//============================================================== // Forex Strategy Builder // Copyright � Miroslav Popov. All rights reserved. //============================================================== // THIS CODE IS PROVIDED "AS IS" 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. //============================================================== using ForexStrategyBuilder.Infrastructure.Entities; using ForexStrategyBuilder.Infrastructure.Enums; using ForexStrategyBuilder.Infrastructure.Interfaces; namespace ForexStrategyBuilder.Indicators.Store { public class Popgun : Indicator { public Popgun() { IndicatorName = "Popgun"; PossibleSlots = SlotTypes.OpenFilter; IndicatorAuthor = "tho.schu; edited Miroslav Popov`s InsideBar"; IndicatorVersion = "2.0"; IndicatorDescription = "Bundled in FSB distribution."; } public override void Initialize(SlotTypes slotType) { SlotType = slotType; // Setting up the indicator parameters IndParam.IndicatorType = TypeOfIndicator.Additional; // The ComboBox parameters IndParam.ListParam[0].Caption = "Logic"; IndParam.ListParam[0].ItemList = new[] { "Popgun" }; 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 = "Indicator's logic."; // The CheckBox parameters IndParam.CheckParam[0].Caption = "Use previous bar value"; IndParam.CheckParam[0].Enabled = true; IndParam.CheckParam[0].ToolTip = "Use the indicator value from the previous bar."; } public override void Calculate(IDataSet dataSet) { DataSet = dataSet; // Calculation const int firstBar = 1; var insideBAr = new double[Bars]; for (int bar = 2; bar < Bars; bar++) { insideBAr[bar] = ((High[bar - 2] < High[bar - 1]) && (Low[bar - 2] > Low[bar - 1])) ? 1 : 0; } // Saving the components Component = new IndicatorComp[2]; Component[0] = new IndicatorComp { CompName = "Allow long entry", DataType = IndComponentType.AllowOpenLong, ChartType = IndChartType.NoChart, FirstBar = firstBar, Value = insideBAr }; Component[1] = new IndicatorComp { CompName = "Allow short entry", DataType = IndComponentType.AllowOpenShort, ChartType = IndChartType.NoChart, FirstBar = firstBar, Value = insideBAr }; } public override void SetDescription() { EntryFilterLongDescription = "there is an Inside Bar formation"; EntryFilterShortDescription = "there is an Inside Bar formation"; } public override string ToString() { return IndicatorName; } } }
//+--------------------------------------------------------------------+ //| Copyright: (C) 2016 Forex Software Ltd. | //| 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 | //| other applications without a permission. | //| The 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 (C) 2016 Forex Software Ltd." #property link "http://forexsb.com" #property version "2.00" #property strict #include <Forexsb.com/Indicator.mqh> #include <Forexsb.com/Enumerations.mqh> //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class Popgun : public Indicator { public: Popgun(SlotTypes slotType); virtual void Calculate(DataSet &dataSet); }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void Popgun::Popgun(SlotTypes slotType) { SlotType = slotType; IndicatorName = "Popgun"; WarningMessage = ""; IsAllowLTF = true; ExecTime = ExecutionTime_DuringTheBar; IsSeparateChart = false; IsDiscreteValues = false; IsDefaultGroupAll = false; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void Popgun::Calculate(DataSet &dataSet) { Data=GetPointer(dataSet); const int firstBar=1; double insideBar[]; ArrayResize(insideBar,Data.Bars); ArrayInitialize(insideBar,0); for(int bar=2; bar<Data.Bars; bar++) { insideBar[bar]=((Data.High[bar-2]<Data.High[bar-1]) && (Data.Low[bar-2]>Data.Low[bar-1])) ? 1 : 0; } Component[0].CompName = "Allow long entry"; Component[0].DataType = IndComponentType_AllowOpenLong; Component[0].FirstBar = firstBar; ArrayResize(Component[0].Value,Data.Bars); ArrayCopy(Component[0].Value,insideBar); Component[1].CompName = "Allow short entry"; Component[1].DataType = IndComponentType_AllowOpenShort; Component[1].FirstBar = firstBar; ArrayResize(Component[1].Value,Data.Bars); ArrayCopy(Component[1].Value,insideBar); } //+------------------------------------------------------------------+
Risk warning: Forex, spread bets and CFD are leveraged products. They may not be suitable for you as they carry a high degree of risk to your capital and you can lose more than your initial investment. You should ensure you understand all of the risks.
Copyright © 2006 - 2017, Miroslav Popov; Created by Yavor Kirov