RecentSwingHighLowXStepped by Naya

53 downloads / 34 views / Created: 08.06.2025
 Average Rating: 0

Indicator Description

A version of RecentSwingHighLowX with numerical parameters expressed in list parameter steps.

Comments

using System; using System.Drawing; using ForexStrategyBuilder.Infrastructure.Entities; using ForexStrategyBuilder.Infrastructure.Enums; using ForexStrategyBuilder.Infrastructure.Interfaces; namespace ForexStrategyBuilder.Indicators.Store { public class RecentSwingHighLowXstepped : Indicator { public RecentSwingHighLowXstepped() { IndicatorName = "Recent Swing High Low X Stepped"; PossibleSlots = SlotTypes.Open | SlotTypes.OpenFilter | SlotTypes.Close | SlotTypes.CloseFilter; IndicatorAuthor = "NAYA,+237674724684"; IndicatorVersion = "1.0"; IndicatorDescription = "Custom with unified bars, bar shift, and new swing rise/fall logics with stepped vertical shift - All List Parameters"; } public override void Initialize(SlotTypes slotType) { SlotType = slotType; // The ComboBox parameters IndParam.ListParam[0].Caption = "Logic"; if (slotType == SlotTypes.Open) IndParam.ListParam[0].ItemList = new[] { "Enter long at swing high", "Enter long at swing low" }; else if (slotType == SlotTypes.OpenFilter) IndParam.ListParam[0].ItemList = new[] { "The bar opens below swing high", "The bar opens above swing high", "The bar opens below swing low", "The bar opens above swing low", "The bar opens below swing high after opening above it", "The bar opens above swing high after opening below it", "The bar opens below swing low after opening above it", "The bar opens above swing low after opening below it", "Swing high rises", "Swing high falls", "Swing low rises", "Swing low falls" }; else if (slotType == SlotTypes.Close) IndParam.ListParam[0].ItemList = new[] { "Exit long at swing high", "Exit long at swing low" }; else if (slotType == SlotTypes.CloseFilter) IndParam.ListParam[0].ItemList = new[] { "The bar closes below swing high", "The bar closes above swing high", "The bar closes below swing low", "The bar closes above swing low", "Swing high rises", "Swing high falls", "Swing low rises", "Swing low falls" }; else IndParam.ListParam[0].ItemList = new[] { "Not Defined" }; IndParam.ListParam[0].Index = 0; IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[0]; IndParam.ListParam[0].Enabled = true; IndParam.ListParam[0].ToolTip = "Logic of application of the indicator"; // Vertical Shift as List Parameter IndParam.ListParam[1].Caption = "Vertical Shift"; var verticalShift = new System.Collections.Generic.List(); for (int i = -2000; i <= 2000; i += 100) verticalShift.Add(i.ToString()); IndParam.ListParam[1].ItemList = verticalShift.ToArray(); IndParam.ListParam[1].Index = 20; // Default to 0 (index 20 in -2000 to 2000 range) IndParam.ListParam[1].Text = IndParam.ListParam[1].ItemList[IndParam.ListParam[1].Index]; IndParam.ListParam[1].Enabled = true; IndParam.ListParam[1].ToolTip = "The vertical shift in steps of 100 points."; // Bars as List Parameter IndParam.ListParam[2].Caption = "Bars"; var barsList = new System.Collections.Generic.List(); for (int i = 1; i <= 50; i += 1) barsList.Add(i.ToString()); IndParam.ListParam[2].ItemList = barsList.ToArray(); IndParam.ListParam[2].Index = 1; // Default to 2 bars (index 1) IndParam.ListParam[2].Text = IndParam.ListParam[2].ItemList[IndParam.ListParam[2].Index]; IndParam.ListParam[2].Enabled = true; IndParam.ListParam[2].ToolTip = "Number of bars to the left and right to confirm a swing."; // Bar Shift as List Parameter IndParam.ListParam[3].Caption = "Bar Shift"; var barShiftList = new System.Collections.Generic.List(); for (int i = 0; i <= 100; i += 2) barShiftList.Add(i.ToString()); IndParam.ListParam[3].ItemList = barShiftList.ToArray(); IndParam.ListParam[3].Index = 0; // Default to 0 shift IndParam.ListParam[3].Text = IndParam.ListParam[3].ItemList[IndParam.ListParam[3].Index]; IndParam.ListParam[3].Enabled = true; IndParam.ListParam[3].ToolTip = "How many bars to shift the swing levels forward."; } public override void Calculate(IDataSet dataSet) { DataSet = dataSet; int previous = 0; double shiftPrice = int.Parse(IndParam.ListParam[1].Text) * Point; int bars = int.Parse(IndParam.ListParam[2].Text); int barShift = int.Parse(IndParam.ListParam[3].Text); // Compute raw swing arrays double[] upperRaw = new double[Bars]; double[] lowerRaw = new double[Bars]; int firstRaw = 2 * bars + 1; for (int bar = firstRaw; bar < Bars; bar++) { int candidate = bar - (bars + 1); bool isHigh = true; bool isLow = true; // Left side check for (int i = 1; i <= bars; i++) { if (High[candidate] < High[candidate - i]) isHigh = false; if (Low[candidate] > Low[candidate - i]) isLow = false; } // Right side check for (int i = 1; i <= bars; i++) { if (High[candidate] <= High[candidate + i]) isHigh = false; if (Low[candidate] >= Low[candidate + i]) isLow = false; } if (isHigh) upperRaw[bar] = High[candidate] + shiftPrice; else upperRaw[bar] = upperRaw[bar - 1]; if (isLow) lowerRaw[bar] = Low[candidate] + shiftPrice; else lowerRaw[bar] = lowerRaw[bar - 1]; } // Build shifted arrays double[] upperShifted = new double[Bars]; double[] lowerShifted = new double[Bars]; // Initialize by carrying forward prior values for (int i = 0; i < Bars; i++) { if (i == 0) { upperShifted[i] = 0.0; lowerShifted[i] = 0.0; } else { upperShifted[i] = upperShifted[i - 1]; lowerShifted[i] = lowerShifted[i - 1]; } } int firstShifted = firstRaw + barShift; for (int bar = firstRaw; bar < Bars; bar++) { int target = bar + barShift; if (target < Bars) { upperShifted[target] = upperRaw[bar]; lowerShifted[target] = lowerRaw[bar]; } } // Propagate over any gaps after shift for (int i = 1; i < Bars; i++) { if (upperShifted[i] == 0.0 && i > firstShifted) upperShifted[i] = upperShifted[i - 1]; if (lowerShifted[i] == 0.0 && i > firstShifted) lowerShifted[i] = lowerShifted[i - 1]; } // Create components array Component = new IndicatorComp[4]; // Component[0]: Swing high Component[0] = new IndicatorComp { CompName = "Swing high", DataType = IndComponentType.IndicatorValue, ChartType = IndChartType.Level, ChartColor = Color.Blue, FirstBar = firstShifted, Value = upperShifted }; // Component[1]: Swing low Component[1] = new IndicatorComp { CompName = "Swing low", DataType = IndComponentType.IndicatorValue, ChartType = IndChartType.Level, ChartColor = Color.Red, FirstBar = firstShifted, Value = lowerShifted }; // Component[2] & [3] placeholders Component[2] = new IndicatorComp { ChartType = IndChartType.NoChart, FirstBar = firstShifted, Value = new double[Bars] }; Component[3] = new IndicatorComp { ChartType = IndChartType.NoChart, FirstBar = firstShifted, Value = new double[Bars] }; // Assign data types based on slot switch (SlotType) { case SlotTypes.Open: Component[2].DataType = IndComponentType.OpenLongPrice; Component[2].CompName = "Long position entry price"; Component[3].DataType = IndComponentType.OpenShortPrice; Component[3].CompName = "Short position entry price"; break; case SlotTypes.OpenFilter: Component[2].DataType = IndComponentType.AllowOpenLong; Component[2].CompName = "Is long entry allowed"; Component[3].DataType = IndComponentType.AllowOpenShort; Component[3].CompName = "Is short entry allowed"; break; case SlotTypes.Close: Component[2].DataType = IndComponentType.CloseLongPrice; Component[2].CompName = "Long position closing price"; Component[3].DataType = IndComponentType.CloseShortPrice; Component[3].CompName = "Short position closing price"; break; case SlotTypes.CloseFilter: Component[2].DataType = IndComponentType.ForceCloseLong; Component[2].CompName = "Close out long position"; Component[3].DataType = IndComponentType.ForceCloseShort; Component[3].CompName = "Close out short position"; break; } // Fill entry/exit or filter logic if (SlotType == SlotTypes.Open || SlotType == SlotTypes.Close) { for (int bar = firstShifted; bar < Bars; bar++) { if (IndParam.ListParam[0].Text == "Enter long at swing high" || IndParam.ListParam[0].Text == "Exit long at swing high") { Component[2].Value[bar] = upperShifted[bar - previous]; Component[3].Value[bar] = lowerShifted[bar - previous]; } else { Component[2].Value[bar] = lowerShifted[bar - previous]; Component[3].Value[bar] = upperShifted[bar - previous]; } } } else { // OpenFilter or CloseFilter string logic = IndParam.ListParam[0].Text; switch (logic) { case "The bar opens below swing high": BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, ref Component[2], ref Component[3], BandIndLogic.The_bar_opens_below_the_Upper_Band); break; case "The bar opens above swing high": BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, ref Component[2], ref Component[3], BandIndLogic.The_bar_opens_above_the_Upper_Band); break; case "The bar opens below swing low": BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, ref Component[2], ref Component[3], BandIndLogic.The_bar_opens_below_the_Lower_Band); break; case "The bar opens above swing low": BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, ref Component[2], ref Component[3], BandIndLogic.The_bar_opens_above_the_Lower_Band); break; case "The bar opens below swing high after opening above it": BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, ref Component[2], ref Component[3], BandIndLogic.The_bar_opens_below_the_Upper_Band_after_opening_above_it); break; case "The bar opens above swing high after opening below it": BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, ref Component[2], ref Component[3], BandIndLogic.The_bar_opens_above_the_Upper_Band_after_opening_below_it); break; case "The bar opens below swing low after opening above it": BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, ref Component[2], ref Component[3], BandIndLogic.The_bar_opens_below_the_Lower_Band_after_opening_above_it); break; case "The bar opens above swing low after opening below it": BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, ref Component[2], ref Component[3], BandIndLogic.The_bar_opens_above_the_Lower_Band_after_opening_below_it); break; case "The bar closes below swing high": BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, ref Component[2], ref Component[3], BandIndLogic.The_bar_closes_below_the_Upper_Band); break; case "The bar closes above swing high": BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, ref Component[2], ref Component[3], BandIndLogic.The_bar_closes_above_the_Upper_Band); break; case "The bar closes below swing low": BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, ref Component[2], ref Component[3], BandIndLogic.The_bar_closes_below_the_Lower_Band); break; case "The bar closes above swing low": BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, ref Component[2], ref Component[3], BandIndLogic.The_bar_closes_above_the_Lower_Band); break; case "Swing high rises": IndicatorRisesLogic(firstShifted, previous, upperShifted, ref Component[2], ref Component[3]); break; case "Swing high falls": IndicatorFallsLogic(firstShifted, previous, upperShifted, ref Component[2], ref Component[3]); break; case "Swing low rises": IndicatorRisesLogic(firstShifted, previous, lowerShifted, ref Component[2], ref Component[3]); break; case "Swing low falls": IndicatorFallsLogic(firstShifted, previous, lowerShifted, ref Component[2], ref Component[3]); break; } } } public override void SetDescription() { string paramDescr = string.Format("{0} bars, shift {1}, vertShift {2} pts", IndParam.ListParam[2].Text, IndParam.ListParam[3].Text, IndParam.ListParam[1].Text); switch (IndParam.ListParam[0].Text) { case "Enter long at swing high": EntryPointLongDescription = "at swing high (" + paramDescr + ")"; EntryPointShortDescription = "at swing low (" + paramDescr + ")"; break; case "Enter long at swing low": EntryPointLongDescription = "at swing low (" + paramDescr + ")"; EntryPointShortDescription = "at swing high (" + paramDescr + ")"; break; case "Exit long at swing high": ExitPointLongDescription = "at swing high (" + paramDescr + ")"; ExitPointShortDescription = "at swing low (" + paramDescr + ")"; break; case "Exit long at swing low": ExitPointLongDescription = "at swing low (" + paramDescr + ")"; ExitPointShortDescription = "at swing high (" + paramDescr + ")"; break; case "The bar opens below swing high": EntryFilterLongDescription = "the bar opens below swing high (" + paramDescr + ")"; EntryFilterShortDescription = "the bar opens above swing low (" + paramDescr + ")"; break; case "The bar opens above swing high": EntryFilterLongDescription = "the bar opens above swing high (" + paramDescr + ")"; EntryFilterShortDescription = "the bar opens below swing low (" + paramDescr + ")"; break; case "The bar opens below swing low": EntryFilterLongDescription = "the bar opens below swing low (" + paramDescr + ")"; EntryFilterShortDescription = "the bar opens above swing high (" + paramDescr + ")"; break; case "The bar opens above swing low": EntryFilterLongDescription = "the bar opens above swing low (" + paramDescr + ")"; EntryFilterShortDescription = "the bar opens below swing high (" + paramDescr + ")"; break; case "The bar opens below swing high after opening above it": EntryFilterLongDescription = "the bar opens below swing high (" + paramDescr + ") after the previous bar opened above it"; EntryFilterShortDescription = "the bar opens above swing low (" + paramDescr + ") after the previous bar opened below it"; break; case "The bar opens above swing high after opening below it": EntryFilterLongDescription = "the bar opens above swing high (" + paramDescr + ") after the previous bar opened below it"; EntryFilterShortDescription = "the bar opens below swing low (" + paramDescr + ") after the previous bar opened above it"; break; case "The bar opens below swing low after opening above it": EntryFilterLongDescription = "the bar opens below swing low (" + paramDescr + ") after the previous bar opened above it"; EntryFilterShortDescription = "the bar opens above swing high (" + paramDescr + ") after the previous bar opened below it"; break; case "The bar opens above swing low after opening below it": EntryFilterLongDescription = "the bar opens above swing low (" + paramDescr + ") after the previous bar opened below it"; EntryFilterShortDescription = "the bar opens below swing high (" + paramDescr + ") after the previous bar opened above it"; break; case "The bar closes below swing high": ExitFilterLongDescription = "the bar closes below swing high (" + paramDescr + ")"; ExitFilterShortDescription = "the bar closes above swing low (" + paramDescr + ")"; break; case "The bar closes above swing high": ExitFilterLongDescription = "the bar closes above swing high (" + paramDescr + ")"; ExitFilterShortDescription = "the bar closes below swing low (" + paramDescr + ")"; break; case "The bar closes below swing low": ExitFilterLongDescription = "the bar closes below swing low (" + paramDescr + ")"; ExitFilterShortDescription = "the bar closes above swing high (" + paramDescr + ")"; break; case "The bar closes above swing low": ExitFilterLongDescription = "the bar closes above swing low (" + paramDescr + ")"; ExitFilterShortDescription = "the bar closes below swing high (" + paramDescr + ")"; break; case "Swing high rises": EntryFilterLongDescription = "swing high rises (" + paramDescr + ")"; EntryFilterShortDescription = "swing low falls (" + paramDescr + ")"; ExitFilterLongDescription = "swing high rises (" + paramDescr + ")"; ExitFilterShortDescription = "swing low falls (" + paramDescr + ")"; break; case "Swing high falls": EntryFilterLongDescription = "swing high falls (" + paramDescr + ")"; EntryFilterShortDescription = "swing low rises (" + paramDescr + ")"; ExitFilterLongDescription = "swing high falls (" + paramDescr + ")"; ExitFilterShortDescription = "swing low rises (" + paramDescr + ")"; break; case "Swing low rises": EntryFilterLongDescription = "swing low rises (" + paramDescr + ")"; EntryFilterShortDescription = "swing high falls (" + paramDescr + ")"; ExitFilterLongDescription = "swing low rises (" + paramDescr + ")"; ExitFilterShortDescription = "swing high falls (" + paramDescr + ")"; break; case "Swing low falls": EntryFilterLongDescription = "swing low falls (" + paramDescr + ")"; EntryFilterShortDescription = "swing high rises (" + paramDescr + ")"; ExitFilterLongDescription = "swing low falls (" + paramDescr + ")"; ExitFilterShortDescription = "swing high rises (" + paramDescr + ")"; break; } } public override string ToString() { return string.Format("{0}({1} bars, shift {2}, vertShift {3} pts)", IndicatorName, IndParam.ListParam[2].Text, IndParam.ListParam[3].Text, IndParam.ListParam[1].Text); } } }
//+------------------------------------------------------------------+ //| RecentSwingHighLowXStepped.mqh | //| Copyright (C) 2025 NAYA +237674724684 | //| NAYA +237674724684 | //+------------------------------------------------------------------+ #property copyright "Copyright © 2025, ChatGPT" #property link "http://forexsb.com" #property version "1.00" #property strict #include <Forexsb.com/Indicator.mqh> #include <Forexsb.com/Enumerations.mqh> //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class RecentSwingHighLowXStepped : public Indicator { public: RecentSwingHighLowXStepped(SlotTypes slotType); virtual void Calculate(DataSet &dataSet); }; //+------------------------------------------------------------------+ //| Constructor | //+------------------------------------------------------------------+ RecentSwingHighLowXStepped::RecentSwingHighLowXStepped(SlotTypes slotType) { SlotType = slotType; IndicatorName = "Recent Swing High Low X Stepped"; WarningMessage = ""; IsAllowLTF = true; ExecTime = ExecutionTime_DuringTheBar; IsSeparateChart = false; IsDiscreteValues = false; IsDefaultGroupAll = false; } //+------------------------------------------------------------------+ //| Calculate method | //+------------------------------------------------------------------+ void RecentSwingHighLowXStepped::Calculate(DataSet &dataSet) { Data = GetPointer(dataSet); // Check if we have enough parameters if(ArraySize(ListParam) < 4) { Print(IndicatorName + ": Not enough parameters!"); return; } // Read parameters int previous = 0; double shiftPrice = StringToDouble(ListParam[1].Text) * Data.Point; int bars = StringToInteger(ListParam[2].Text); int barShift = StringToInteger(ListParam[3].Text); int totalBars = Data.Bars; // Allocate raw swing arrays double upperRaw[]; ArrayResize(upperRaw, totalBars); ArrayInitialize(upperRaw, 0); double lowerRaw[]; ArrayResize(lowerRaw, totalBars); ArrayInitialize(lowerRaw, 0); int firstRaw = 2 * bars + 1; // Compute raw swings for(int bar = firstRaw; bar < totalBars; bar++) { int candidate = bar - (bars + 1); bool isHigh = true; bool isLow = true; // Check left side for(int i = 1; i <= bars; i++) { if(Data.High[candidate] < Data.High[candidate - i]) isHigh = false; if(Data.Low[candidate] > Data.Low[candidate - i]) isLow = false; } // Check right side for(int i = 1; i <= bars; i++) { if(Data.High[candidate] <= Data.High[candidate + i]) isHigh = false; if(Data.Low[candidate] >= Data.Low[candidate + i]) isLow = false; } if(isHigh) upperRaw[bar] = Data.High[candidate] + shiftPrice; else upperRaw[bar] = upperRaw[bar - 1]; if(isLow) lowerRaw[bar] = Data.Low[candidate] + shiftPrice; else lowerRaw[bar] = lowerRaw[bar - 1]; } // Allocate shifted arrays double upperShifted[]; ArrayResize(upperShifted, totalBars); ArrayInitialize(upperShifted, 0); double lowerShifted[]; ArrayResize(lowerShifted, totalBars); ArrayInitialize(lowerShifted, 0); // Initialize shifted arrays by carrying forward for(int i = 1; i < totalBars; i++) { upperShifted[i] = upperShifted[i - 1]; lowerShifted[i] = lowerShifted[i - 1]; } int firstShifted = firstRaw + barShift; // Shift raw into shifted arrays for(int bar = firstRaw; bar < totalBars; bar++) { int target = bar + barShift; if(target < totalBars) { upperShifted[target] = upperRaw[bar]; lowerShifted[target] = lowerRaw[bar]; } } // Propagate over gaps after shift for(int i = firstShifted + 1; i < totalBars; i++) { if(upperShifted[i] == 0.0) upperShifted[i] = upperShifted[i - 1]; if(lowerShifted[i] == 0.0) lowerShifted[i] = lowerShifted[i - 1]; } // Create components array ArrayResize(Component, 4); // Component[0]: Swing high ArrayResize(Component[0].Value, totalBars); Component[0].CompName = "Swing high"; Component[0].DataType = IndComponentType_IndicatorValue; Component[0].FirstBar = firstShifted; ArrayCopy(Component[0].Value, upperShifted); // Component[1]: Swing low ArrayResize(Component[1].Value, totalBars); Component[1].CompName = "Swing low"; Component[1].DataType = IndComponentType_IndicatorValue; Component[1].FirstBar = firstShifted; ArrayCopy(Component[1].Value, lowerShifted); // Component[2] & Component[3]: placeholders for entry/exit or filter logic ArrayResize(Component[2].Value, totalBars); ArrayInitialize(Component[2].Value, 0); Component[2].FirstBar = firstShifted; ArrayResize(Component[3].Value, totalBars); ArrayInitialize(Component[3].Value, 0); Component[3].FirstBar = firstShifted; // Assign data types based on slot if(SlotType == SlotTypes_Open) { Component[2].DataType = IndComponentType_OpenLongPrice; Component[2].CompName = "Long position entry price"; Component[3].DataType = IndComponentType_OpenShortPrice; Component[3].CompName = "Short position entry price"; } else if(SlotType == SlotTypes_OpenFilter) { Component[2].DataType = IndComponentType_AllowOpenLong; Component[2].CompName = "Is long entry allowed"; Component[3].DataType = IndComponentType_AllowOpenShort; Component[3].CompName = "Is short entry allowed"; } else if(SlotType == SlotTypes_Close) { Component[2].DataType = IndComponentType_CloseLongPrice; Component[2].CompName = "Long position closing price"; Component[3].DataType = IndComponentType_CloseShortPrice; Component[3].CompName = "Short position closing price"; } else if(SlotType == SlotTypes_CloseFilter) { Component[2].DataType = IndComponentType_ForceCloseLong; Component[2].CompName = "Close out long position"; Component[3].DataType = IndComponentType_ForceCloseShort; Component[3].CompName = "Close out short position"; } // Fill entry/exit or filter logic if(SlotType == SlotTypes_Open || SlotType == SlotTypes_Close) { for(int bar = firstShifted; bar < totalBars; bar++) { string logic = ListParam[0].Text; if(logic == "Enter long at swing high" || logic == "Exit long at swing high") { Component[2].Value[bar] = upperShifted[bar - previous]; Component[3].Value[bar] = lowerShifted[bar - previous]; } else { Component[2].Value[bar] = lowerShifted[bar - previous]; Component[3].Value[bar] = upperShifted[bar - previous]; } } } else { string logic = ListParam[0].Text; if(logic == "The bar opens below swing high") BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, Component[2], Component[3], BandIndLogic_The_bar_opens_below_the_Upper_Band); else if(logic == "The bar opens above swing high") BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, Component[2], Component[3], BandIndLogic_The_bar_opens_above_the_Upper_Band); else if(logic == "The bar opens below swing low") BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, Component[2], Component[3], BandIndLogic_The_bar_opens_below_the_Lower_Band); else if(logic == "The bar opens above swing low") BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, Component[2], Component[3], BandIndLogic_The_bar_opens_above_the_Lower_Band); else if(logic == "The bar opens below swing high after opening above it") BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, Component[2], Component[3], BandIndLogic_The_bar_opens_below_Upper_Band_after_above); else if(logic == "The bar opens above swing high after opening below it") BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, Component[2], Component[3], BandIndLogic_The_bar_opens_above_Upper_Band_after_below); else if(logic == "The bar opens below swing low after opening above it") BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, Component[2], Component[3], BandIndLogic_The_bar_opens_below_Lower_Band_after_above); else if(logic == "The bar opens above swing low after opening below it") BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, Component[2], Component[3], BandIndLogic_The_bar_opens_above_Lower_Band_after_below); else if(logic == "The bar closes below swing high") BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, Component[2], Component[3], BandIndLogic_The_bar_closes_below_the_Upper_Band); else if(logic == "The bar closes above swing high") BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, Component[2], Component[3], BandIndLogic_The_bar_closes_above_the_Upper_Band); else if(logic == "The bar closes below swing low") BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, Component[2], Component[3], BandIndLogic_The_bar_closes_below_the_Lower_Band); else if(logic == "The bar closes above swing low") BandIndicatorLogic(firstShifted, previous, upperShifted, lowerShifted, Component[2], Component[3], BandIndLogic_The_bar_closes_above_the_Lower_Band); else if(logic == "Swing high rises") IndicatorRisesLogic(firstShifted, previous, upperShifted, Component[2], Component[3]); else if(logic == "Swing high falls") IndicatorFallsLogic(firstShifted, previous, upperShifted, Component[2], Component[3]); else if(logic == "Swing low rises") IndicatorRisesLogic(firstShifted, previous, lowerShifted, Component[2], Component[3]); else if(logic == "Swing low falls") IndicatorFallsLogic(firstShifted, previous, lowerShifted, Component[2], Component[3]); } } //+------------------------------------------------------------------+
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 - 2025, Forex Software Ltd.;