pivot point multi by ahmedalhoseny

4472 downloads / 4637 views / Created: 07.06.2016
 Average Rating: 0

Indicator Description

pivot point multi

Comments

Can you please make the .mqh as well? If not I'll give it a try.
Did anyone made the mqh form?
//============================================================== // 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 System.Drawing; using ForexStrategyBuilder.Infrastructure.Entities; using ForexStrategyBuilder.Infrastructure.Enums; using ForexStrategyBuilder.Infrastructure.Interfaces; namespace ForexStrategyBuilder.Indicators.Store { public class PivotPointsMulti : Indicator { public PivotPointsMulti() { IndicatorName = "Pivot Points Multi"; PossibleSlots = SlotTypes.Open | SlotTypes.OpenFilter | SlotTypes.Close | SlotTypes.CloseFilter; SeparatedChart = false; IndicatorAuthor = "ahmedalhoseny@gmail.com"; IndicatorVersion = "2.0"; IndicatorDescription = "Custom Indicator."; } public override void Initialize(SlotTypes slotType) { SlotType = slotType; IndParam.IndicatorType = TypeOfIndicator.Additional; // The ComboBox parameters IndParam.ListParam[0].Caption = "Logic"; if (slotType == SlotTypes.Open) IndParam.ListParam[0].ItemList = new[] { "Enter long at R3 (short at S3)", "Enter long at R2 (short at S2)", "Enter long at R1 (short at S1)", "Enter the market at the Pivot Point", "Enter long at S1 (short at R1)", "Enter long at S2 (short at R2)", "Enter long at S3 (short at R3)" }; else if (SlotType == SlotTypes.OpenFilter) IndParam.ListParam[0].ItemList = new[] { "The bar opens below an R3", "The bar opens above an R3", "The bar opens below a S3", "The bar opens above a S3", "The position opens below an R3", "The position opens above an R3", "The position opens below a S3", "The position opens above a S3", "The bar opens below an R3 after opening above it", "The bar opens above an R3 after opening below it", "The bar opens below a S3 after opening above it", "The bar opens above a S3 after opening below it", "The bar opens below an R2", //////////////////////////// "The bar opens above an R2", "The bar opens below a S2", "The bar opens above a S2", "The position opens below an R2", "The position opens above an R2", "The position opens below a S2", "The position opens above a S2", "The bar opens below an R2 after opening above it", "The bar opens above an R2 after opening below it", "The bar opens below a S2 after opening above it", "The bar opens above a S2 after opening below it", //////////////////////////// "The bar opens below an R1", "The bar opens above an R1", "The bar opens below a S1", "The bar opens above a S1", "The position opens below an R1", "The position opens above an R1", "The position opens below a S1", "The position opens above a S1", "The bar opens below an R1 after opening above it", "The bar opens above an R1 after opening below it", "The bar opens below a S1 after opening above it", "The bar opens above a S1 after opening below it", //////////////////////////// "The bar opens below the Pivot Point", "The bar opens above the Pivot Point", "The position opens below the Pivot Point", "The position opens above the Pivot Point", "The bar opens below the Pivot Point after opening above it", "The bar opens above the Pivot Point after opening below it" //"Void1" }; else if (slotType == SlotTypes.Close) IndParam.ListParam[0].ItemList = new[] { "Exit long at R3 (short at S3)", "Exit long at R2 (short at S2)", "Exit long at R1 (short at S1)", "Exit the market at the Pivot Point", "Exit long at S1 (short at R1)", "Exit long at S2 (short at R2)", "Exit long at S3 (short at R3)" }; else if (SlotType == SlotTypes.CloseFilter) IndParam.ListParam[0].ItemList = new[] { "The bar closes below an R3", "The bar closes above an R3", "The bar closes below a S3", "The bar closes above a S3", "The bar closes below an R2", "The bar closes above an R2", "The bar closes below a S2", "The bar closes above a S2", "The bar closes below an R1", "The bar closes above an R1", "The bar closes below a S1", "The bar closes above a S1", "The bar closes below the Pivot Point", "The bar closes above the Pivot Point" }; else IndParam.ListParam[0].ItemList = new[] { "Not Defined" }; 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 = "Logic of application of the indicator."; IndParam.ListParam[1].Caption = "Base price"; IndParam.ListParam[1].ItemList = new[] {"One day", "One bar"}; IndParam.ListParam[1].Index = 0; IndParam.ListParam[1].Text = IndParam.ListParam[1].ItemList[IndParam.ListParam[1].Index]; IndParam.ListParam[1].Enabled = true; IndParam.ListParam[1].ToolTip = "The base price for calculation of the indicator."; // The NumericUpDown parameters IndParam.NumParam[0].Caption = "Vertical shift"; IndParam.NumParam[0].Value = 0; IndParam.NumParam[0].Max = +2000; IndParam.NumParam[0].Min = -2000; IndParam.NumParam[0].Enabled = true; IndParam.NumParam[0].ToolTip = "A vertical shift above the Resistance and below the Support levels."; // 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; // Reading the parameters double dShift = IndParam.NumParam[0].Value*Point; int prvs = IndParam.CheckParam[0].Checked ? 1 : 0; // Calculation int firstBar = 1; var adPp = new double[Bars]; var adR1 = new double[Bars]; var adR2 = new double[Bars]; var adR3 = new double[Bars]; var adS1 = new double[Bars]; var adS2 = new double[Bars]; var adS3 = new double[Bars]; var adH = new double[Bars]; var adL = new double[Bars]; var adC = new double[Bars]; if (IndParam.ListParam[1].Text == "One bar" || Period == DataPeriod.D1 || Period == DataPeriod.W1) { adH = High; adL = Low; adC = Close; } else { prvs = 0; adH[0] = 0; adL[0] = 0; adC[0] = 0; double dTop = double.MinValue; double dBottom = double.MaxValue; for (int iBar = firstBar; iBar < Bars; iBar++) { if (High[iBar - 1] > dTop) dTop = High[iBar - 1]; if (Low[iBar - 1] < dBottom) dBottom = Low[iBar - 1]; if (Time[iBar].Day != Time[iBar - 1].Day) { adH[iBar] = dTop; adL[iBar] = dBottom; adC[iBar] = Close[iBar - 1]; dTop = double.MinValue; dBottom = double.MaxValue; } else { adH[iBar] = adH[iBar - 1]; adL[iBar] = adL[iBar - 1]; adC[iBar] = adC[iBar - 1]; } } // first Bar for (int iBar = 2; iBar < Bars; iBar++) { if (Time[iBar].Day != Time[iBar - 1].Day) { firstBar = iBar; break; } } } for (int iBar = firstBar; iBar < Bars; iBar++) { adPp[iBar] = (adH[iBar] + adL[iBar] + adC[iBar]) / 3; adR1[iBar] = 2*adPp[iBar] - adL[iBar]; adS1[iBar] = 2*adPp[iBar] - adH[iBar]; adR2[iBar] = adPp[iBar] + adH[iBar] - adL[iBar]; adS2[iBar] = adPp[iBar] - adH[iBar] + adL[iBar]; adR3[iBar] = adH[iBar] + 2*(adPp[iBar] - adL[iBar]); adS3[iBar] = adL[iBar] - 2*(adH[iBar] - adPp[iBar]); } Component = new IndicatorComp[9]; for (int iComp = 0; iComp < 7; iComp++) { Component[iComp] = new IndicatorComp { ChartType = IndChartType.Level, ChartColor = Color.Violet, DataType = IndComponentType.IndicatorValue, FirstBar = firstBar }; } Component[3].ChartColor = Color.Blue; Component[0].Value = adR3; Component[1].Value = adR2; Component[2].Value = adR1; Component[3].Value = adPp; Component[4].Value = adS1; Component[5].Value = adS2; Component[6].Value = adS3; Component[0].CompName = "Resistance 3"; Component[1].CompName = "Resistance 2"; Component[2].CompName = "Resistance 1"; Component[3].CompName = "Pivot Point"; Component[4].CompName = "Support 1"; Component[5].CompName = "Support 2"; Component[6].CompName = "Support 3"; Component[7] = new IndicatorComp { ChartType = IndChartType.NoChart, FirstBar = firstBar, Value = new double[Bars] }; Component[8] = new IndicatorComp { ChartType = IndChartType.NoChart, FirstBar = firstBar, Value = new double[Bars] }; if (SlotType == SlotTypes.Open) { Component[7].CompName = "Long position entry price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[8].CompName = "Short position entry price"; Component[8].DataType = IndComponentType.OpenShortPrice; } else if (SlotType == SlotTypes.OpenFilter) { Component[7].CompName = "Is long entry allowed"; Component[7].DataType = IndComponentType.AllowOpenLong; Component[8].CompName = "Is short entry allowed"; Component[8].DataType = IndComponentType.AllowOpenShort; } else if (SlotType == SlotTypes.Close) { Component[7].CompName = "Long position closing price"; Component[7].DataType = IndComponentType.CloseLongPrice; Component[8].CompName = "Short position closing price"; Component[8].DataType = IndComponentType.CloseShortPrice; } else if (SlotType == SlotTypes.CloseFilter) { Component[7].CompName = "Close out long position"; Component[7].DataType = IndComponentType.ForceCloseLong; Component[8].CompName = "Close out short position"; Component[8].DataType = IndComponentType.ForceCloseShort; } switch (IndParam.ListParam[0].Text) { case "Enter long at R3 (short at S3)": case "Exit long at R3 (short at S3)": for (int iBar = firstBar; iBar < Bars; iBar++) { Component[7].Value[iBar] = adR3[iBar - prvs] + dShift; Component[8].Value[iBar] = adS3[iBar - prvs] - dShift; } break; case "Enter long at R2 (short at S2)": case "Exit long at R2 (short at S2)": for (int iBar = firstBar; iBar < Bars; iBar++) { Component[7].Value[iBar] = adR2[iBar - prvs] + dShift; Component[8].Value[iBar] = adS2[iBar - prvs] - dShift; } break; case "Enter long at R1 (short at S1)": case "Exit long at R1 (short at S1)": for (int iBar = firstBar; iBar < Bars; iBar++) { Component[7].Value[iBar] = adR1[iBar - prvs] + dShift; Component[8].Value[iBar] = adS1[iBar - prvs] - dShift; } break; //--------------------------------------------------------------------- case "Enter the market at the Pivot Point": case "Exit the market at the Pivot Point": for (int iBar = firstBar; iBar < Bars; iBar++) { Component[7].Value[iBar] = adPp[iBar - prvs] + dShift; Component[8].Value[iBar] = adPp[iBar - prvs] - dShift; } break; //--------------------------------------------------------------------- case "Enter long at S1 (short at R1)": case "Exit long at S1 (short at R1)": for (int iBar = firstBar; iBar < Bars; iBar++) { Component[7].Value[iBar] = adS1[iBar - prvs] - dShift; Component[8].Value[iBar] = adR1[iBar - prvs] + dShift; } break; case "Enter long at S2 (short at R2)": case "Exit long at S2 (short at R2)": for (int iBar = firstBar; iBar < Bars; iBar++) { Component[7].Value[iBar] = adS2[iBar - prvs] - dShift; Component[8].Value[iBar] = adR2[iBar - prvs] + dShift; } break; case "Enter long at S3 (short at R3)": case "Exit long at S3 (short at R3)": for (int iBar = firstBar; iBar < Bars; iBar++) { Component[7].Value[iBar] = adS3[iBar - prvs] - dShift; Component[8].Value[iBar] = adR3[iBar - prvs] + dShift; } break; case "The bar opens below an R3": BandIndicatorLogic(firstBar, prvs, adR3, adS3, ref Component[7], ref Component[8],BandIndLogic.The_bar_opens_below_the_Upper_Band); break; case "The bar opens above an R3": BandIndicatorLogic(firstBar, prvs, adR3, adS3, ref Component[7], ref Component[8],BandIndLogic.The_bar_opens_above_the_Upper_Band); break; case "The bar opens below a S3": BandIndicatorLogic(firstBar, prvs, adR3, adS3, ref Component[7], ref Component[8],BandIndLogic.The_bar_opens_below_the_Lower_Band); break; case "The bar opens above a S3": BandIndicatorLogic(firstBar, prvs, adR3, adS3, ref Component[7], ref Component[8],BandIndLogic.The_bar_opens_above_the_Lower_Band); break; case "The bar closes below an R3": BandIndicatorLogic(firstBar, prvs, adR3, adS3, ref Component[7], ref Component[8],BandIndLogic.The_bar_opens_below_the_Upper_Band); break; case "The bar closes above an R3": BandIndicatorLogic(firstBar, prvs, adR3, adS3, ref Component[7], ref Component[8],BandIndLogic.The_bar_closes_above_the_Upper_Band) ;break; case "The bar closes below a S3": BandIndicatorLogic(firstBar, prvs, adR3, adS3, ref Component[7], ref Component[8],BandIndLogic.The_bar_closes_below_the_Lower_Band) ;break; case "The bar closes above a S3": BandIndicatorLogic(firstBar, prvs, adR3, adS3, ref Component[7], ref Component[8],BandIndLogic.The_bar_closes_above_the_Lower_Band) ;break; case "The bar opens below an R3 after opening above it": BandIndicatorLogic(firstBar, prvs, adR3, adS3, ref Component[7], ref Component[8],BandIndLogic.The_bar_opens_below_the_Upper_Band_after_opening_above_it); break; case "The bar opens above an R3 after opening below it": BandIndicatorLogic(firstBar, prvs, adR3, adS3, ref Component[7], ref Component[8],BandIndLogic.The_bar_opens_above_the_Upper_Band_after_opening_below_it); break; case "The bar opens below a S3 after opening above it": BandIndicatorLogic(firstBar, prvs, adR3, adS3, ref Component[7], ref Component[8],BandIndLogic.The_bar_opens_below_the_Lower_Band_after_opening_above_it); break; case "The bar opens above a S3 after opening below it": BandIndicatorLogic(firstBar, prvs, adR3, adS3, ref Component[7], ref Component[8],BandIndLogic.The_bar_opens_above_the_Lower_Band_after_opening_below_it); break; case "The position opens above an R3": Component[0].DataType = IndComponentType.Other; Component[6].DataType = IndComponentType.Other; Component[7].CompName = "Shifted top price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[7].PosPriceDependence = PositionPriceDependence.PriceBuyHigher; Component[8].CompName = "Shifted bottom price"; Component[8].DataType = IndComponentType.OpenShortPrice; Component[8].PosPriceDependence = PositionPriceDependence.PriceSellLower; Component[7].Value = adR3; Component[8].Value = adS3; break; case "The position opens below an R3": Component[0].DataType = IndComponentType.Other; Component[6].DataType = IndComponentType.Other; Component[7].CompName = "Shifted top price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[7].PosPriceDependence = PositionPriceDependence.PriceBuyLower; Component[8].CompName = "Shifted bottom price"; Component[8].DataType = IndComponentType.OpenShortPrice; Component[8].PosPriceDependence = PositionPriceDependence.PriceSellHigher; Component[7].Value = adR3; Component[8].Value = adS3; break; case "The position opens above a S3": Component[0].DataType = IndComponentType.Other; Component[6].DataType = IndComponentType.Other; Component[7].CompName = "Shifted bottom price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[7].PosPriceDependence = PositionPriceDependence.PriceBuyHigher; Component[8].CompName = "Shifted top price"; Component[8].DataType = IndComponentType.OpenShortPrice; Component[8].PosPriceDependence = PositionPriceDependence.PriceSellLower; Component[7].Value = adS3; Component[8].Value = adR3; break; case "The position opens below a S3": Component[0].DataType = IndComponentType.Other; Component[6].DataType = IndComponentType.Other; Component[7].CompName = "Shifted bottom price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[7].PosPriceDependence = PositionPriceDependence.PriceBuyLower; Component[8].CompName = "Shifted top price"; Component[8].DataType = IndComponentType.OpenShortPrice; Component[8].PosPriceDependence = PositionPriceDependence.PriceSellHigher; Component[7].Value = adS3; Component[8].Value = adR3; break; /////////////////////////////////////////////// case "The bar opens below an R2": BandIndicatorLogic(firstBar, prvs, adR2, adS2, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_below_the_Upper_Band); break; case "The bar opens above an R2": BandIndicatorLogic(firstBar, prvs, adR2, adS2, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_above_the_Upper_Band); break; case "The bar opens below a S2": BandIndicatorLogic(firstBar, prvs, adR2, adS2, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_below_the_Lower_Band); break; case "The bar opens above a S2": BandIndicatorLogic(firstBar, prvs, adR2, adS2, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_above_the_Lower_Band); break; case "The bar closes below an R2": BandIndicatorLogic(firstBar, prvs, adR2, adS2, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_below_the_Upper_Band); break; case "The bar closes above an R2": BandIndicatorLogic(firstBar, prvs, adR2, adS2, ref Component[7], ref Component[8], BandIndLogic.The_bar_closes_above_the_Upper_Band); break; case "The bar closes below a S2": BandIndicatorLogic(firstBar, prvs, adR2, adS2, ref Component[7], ref Component[8], BandIndLogic.The_bar_closes_below_the_Lower_Band); break; case "The bar closes above a S2": BandIndicatorLogic(firstBar, prvs, adR2, adS2, ref Component[7], ref Component[8], BandIndLogic.The_bar_closes_above_the_Lower_Band); break; case "The bar opens below an R2 after opening above it": BandIndicatorLogic(firstBar, prvs, adR2, adS2, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_below_the_Upper_Band_after_opening_above_it); break; case "The bar opens above an R2 after opening below it": BandIndicatorLogic(firstBar, prvs, adR2, adS2, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_above_the_Upper_Band_after_opening_below_it); break; case "The bar opens below a S2 after opening above it": BandIndicatorLogic(firstBar, prvs, adR2, adS2, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_below_the_Lower_Band_after_opening_above_it); break; case "The bar opens above a S2 after opening below it": BandIndicatorLogic(firstBar, prvs, adR2, adS2, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_above_the_Lower_Band_after_opening_below_it); break; case "The position opens above an R2": Component[1].DataType = IndComponentType.Other; Component[5].DataType = IndComponentType.Other; Component[7].CompName = "Shifted top price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[7].PosPriceDependence = PositionPriceDependence.PriceBuyHigher; Component[8].CompName = "Shifted bottom price"; Component[8].DataType = IndComponentType.OpenShortPrice; Component[8].PosPriceDependence = PositionPriceDependence.PriceSellLower; Component[7].Value = adR2; Component[8].Value = adS2; break; case "The position opens below an R2": Component[1].DataType = IndComponentType.Other; Component[5].DataType = IndComponentType.Other; Component[7].CompName = "Shifted top price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[7].PosPriceDependence = PositionPriceDependence.PriceBuyLower; Component[8].CompName = "Shifted bottom price"; Component[8].DataType = IndComponentType.OpenShortPrice; Component[8].PosPriceDependence = PositionPriceDependence.PriceSellHigher; Component[7].Value = adR2; Component[8].Value = adS2; break; case "The position opens above a S2": Component[1].DataType = IndComponentType.Other; Component[5].DataType = IndComponentType.Other; Component[7].CompName = "Shifted bottom price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[7].PosPriceDependence = PositionPriceDependence.PriceBuyHigher; Component[8].CompName = "Shifted top price"; Component[8].DataType = IndComponentType.OpenShortPrice; Component[8].PosPriceDependence = PositionPriceDependence.PriceSellLower; Component[7].Value = adS2; Component[8].Value = adR2; break; case "The position opens below a S2": Component[1].DataType = IndComponentType.Other; Component[5].DataType = IndComponentType.Other; Component[7].CompName = "Shifted bottom price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[7].PosPriceDependence = PositionPriceDependence.PriceBuyLower; Component[8].CompName = "Shifted top price"; Component[8].DataType = IndComponentType.OpenShortPrice; Component[8].PosPriceDependence = PositionPriceDependence.PriceSellHigher; Component[7].Value = adS2; Component[8].Value = adR2; break; ///////////////////////////////////// case "The bar opens below an R1": BandIndicatorLogic(firstBar, prvs, adR1, adS1, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_below_the_Upper_Band); break; case "The bar opens above an R1": BandIndicatorLogic(firstBar, prvs, adR1, adS1, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_above_the_Upper_Band); break; case "The bar opens below a S1": BandIndicatorLogic(firstBar, prvs, adR1, adS1, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_below_the_Lower_Band); break; case "The bar opens above a S1": BandIndicatorLogic(firstBar, prvs, adR1, adS1, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_above_the_Lower_Band); break; case "The bar closes below an R1": BandIndicatorLogic(firstBar, prvs, adR1, adS1, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_below_the_Upper_Band); break; case "The bar closes above an R1": BandIndicatorLogic(firstBar, prvs, adR1, adS1, ref Component[7], ref Component[8], BandIndLogic.The_bar_closes_above_the_Upper_Band); break; case "The bar closes below a S1": BandIndicatorLogic(firstBar, prvs, adR1, adS1, ref Component[7], ref Component[8], BandIndLogic.The_bar_closes_below_the_Lower_Band); break; case "The bar closes above a S1": BandIndicatorLogic(firstBar, prvs, adR1, adS1, ref Component[7], ref Component[8], BandIndLogic.The_bar_closes_above_the_Lower_Band); break; case "The bar opens below an R1 after opening above it": BandIndicatorLogic(firstBar, prvs, adR1, adS1, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_below_the_Upper_Band_after_opening_above_it); break; case "The bar opens above an R1 after opening below it": BandIndicatorLogic(firstBar, prvs, adR1, adS1, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_above_the_Upper_Band_after_opening_below_it); break; case "The bar opens below a S1 after opening above it": BandIndicatorLogic(firstBar, prvs, adR1, adS1, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_below_the_Lower_Band_after_opening_above_it); break; case "The bar opens above a S1 after opening below it": BandIndicatorLogic(firstBar, prvs, adR1, adS1, ref Component[7], ref Component[8], BandIndLogic.The_bar_opens_above_the_Lower_Band_after_opening_below_it); break; case "The position opens above an R1": Component[2].DataType = IndComponentType.Other; Component[4].DataType = IndComponentType.Other; Component[7].CompName = "Shifted top price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[7].PosPriceDependence = PositionPriceDependence.PriceBuyHigher; Component[8].CompName = "Shifted bottom price"; Component[8].DataType = IndComponentType.OpenShortPrice; Component[8].PosPriceDependence = PositionPriceDependence.PriceSellLower; Component[7].Value = adR1; Component[8].Value = adS1; break; case "The position opens below an R1": Component[2].DataType = IndComponentType.Other; Component[4].DataType = IndComponentType.Other; Component[7].CompName = "Shifted top price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[7].PosPriceDependence = PositionPriceDependence.PriceBuyLower; Component[8].CompName = "Shifted bottom price"; Component[8].DataType = IndComponentType.OpenShortPrice; Component[8].PosPriceDependence = PositionPriceDependence.PriceSellHigher; Component[7].Value = adR1; Component[8].Value = adS1; break; case "The position opens above a S1": Component[2].DataType = IndComponentType.Other; Component[4].DataType = IndComponentType.Other; Component[7].CompName = "Shifted bottom price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[7].PosPriceDependence = PositionPriceDependence.PriceBuyHigher; Component[8].CompName = "Shifted top price"; Component[8].DataType = IndComponentType.OpenShortPrice; Component[8].PosPriceDependence = PositionPriceDependence.PriceSellLower; Component[7].Value = adS1; Component[8].Value = adR1; break; case "The position opens below a S1": Component[2].DataType = IndComponentType.Other; Component[4].DataType = IndComponentType.Other; Component[7].CompName = "Shifted bottom price"; Component[7].DataType = IndComponentType.OpenLongPrice; Component[7].PosPriceDependence = PositionPriceDependence.PriceBuyLower; Component[8].CompName = "Shifted top price"; Component[8].DataType = IndComponentType.OpenShortPrice; Component[8].PosPriceDependence = PositionPriceDependence.PriceSellHigher; Component[7].Value = adS1; Component[8].Value = adR1; break; ////////////////////////////////////// case "The bar opens above the Pivot Point": BarOpensAboveIndicatorLogic(firstBar, prvs, adPp, ref Component[7], ref Component[8]); break; case "The bar opens below the Pivot Point": BarOpensBelowIndicatorLogic(firstBar, prvs, adPp, ref Component[7], ref Component[8]); break; case "The bar opens above the Pivot Point after opening below it": BarOpensAboveIndicatorAfterOpeningBelowLogic(firstBar, prvs, adPp, ref Component[7], ref Component[8]); break; case "The bar opens below the Pivot Point after opening above it": BarOpensBelowIndicatorAfterOpeningAboveLogic(firstBar, prvs, adPp, ref Component[7], ref Component[8]); break; case "The position opens above the Pivot Point": Component[3].PosPriceDependence = PositionPriceDependence.BuyHigherSellLower; Component[3].UsePreviousBar = prvs; Component[7].DataType = IndComponentType.Other; Component[7].ShowInDynInfo = false; Component[8].DataType = IndComponentType.Other; Component[8].ShowInDynInfo = false; break; case "The position opens below the Pivot Point": Component[3].PosPriceDependence = PositionPriceDependence.BuyLowerSelHigher; Component[3].UsePreviousBar = prvs; Component[7].DataType = IndComponentType.Other; Component[7].ShowInDynInfo = false; Component[8].DataType = IndComponentType.Other; Component[8].ShowInDynInfo = false; break; case "The bar closes below the Pivot Point": BarClosesBelowIndicatorLogic(firstBar, prvs, adPp, ref Component[7], ref Component[8]); break; case "The bar closes above the Pivot Point": BarClosesAboveIndicatorLogic(firstBar, prvs, adPp, ref Component[7], ref Component[8]); break; } } public override void SetDescription() { var iShift = (int) IndParam.NumParam[0].Value; string sUpperTrade; string sLowerTrade; if (iShift > 0) { sUpperTrade = iShift + " points above the "; sLowerTrade = iShift + " points below the "; } else if (iShift == 0) { sUpperTrade = "at the "; sLowerTrade = "at the "; } else { sUpperTrade = -iShift + " points below the "; sLowerTrade = -iShift + " points above the "; } switch (IndParam.ListParam[0].Text) { case "Enter long at R3 (short at S3)": EntryPointLongDescription = sUpperTrade + "Pivot Point Resistance 3 level"; EntryPointShortDescription = sLowerTrade + "Pivot Point Support 3 level"; break; case "Exit long at R3 (short at S3)": ExitPointLongDescription = sUpperTrade + "Pivot Point Resistance 3 level"; ExitPointShortDescription = sLowerTrade + "Pivot Point Support 3 level"; break; case "Enter long at R2 (short at S2)": EntryPointLongDescription = sUpperTrade + "Pivot Point Resistance 2 level"; EntryPointShortDescription = sLowerTrade + "Pivot Point Support 2 level"; break; case "Exit long at R2 (short at S2)": ExitPointLongDescription = sUpperTrade + "Pivot Point Resistance 2 level"; ExitPointShortDescription = sLowerTrade + "Pivot Point Support 2 level"; break; case "Enter long at R1 (short at S1)": EntryPointLongDescription = sUpperTrade + "Pivot Point Resistance 1 level"; EntryPointShortDescription = sLowerTrade + "Pivot Point Support 1 level"; break; case "Exit long at R1 (short at S1)": ExitPointLongDescription = sUpperTrade + "Pivot Point Resistance 1 level"; ExitPointShortDescription = sLowerTrade + "Pivot Point Support 1 level"; break; //--------------------------------------------------------------------- case "Enter the market at the Pivot Point": EntryPointLongDescription = sUpperTrade + "Pivot Point"; EntryPointShortDescription = sLowerTrade + "Pivot Point"; break; case "Exit the market at the Pivot Point": ExitPointLongDescription = sUpperTrade + "Pivot Point"; ExitPointShortDescription = sLowerTrade + "Pivot Point"; break; //--------------------------------------------------------------------- case "Enter long at S1 (short at R1)": EntryPointLongDescription = sLowerTrade + "Pivot Point Support 1 level"; EntryPointShortDescription = sUpperTrade + "Pivot Point Resistance 1 level"; break; case "Exit long at S1 (short at R1)": ExitPointLongDescription = sLowerTrade + "Pivot Point Support 1 level"; ExitPointShortDescription = sUpperTrade + "Pivot Point Resistance 1 level"; break; case "Enter long at S2 (short at R2)": EntryPointLongDescription = sLowerTrade + "Pivot Point Support 2 level"; EntryPointShortDescription = sUpperTrade + "Pivot Point Resistance 2 level"; break; case "Exit long at S2 (short at R2)": ExitPointLongDescription = sLowerTrade + "Pivot Point Support 2 level"; ExitPointShortDescription = sUpperTrade + "Pivot Point Resistance 2 level"; break; case "Enter long at S3 (short at R3)": EntryPointLongDescription = sLowerTrade + "Pivot Point Support 3 level"; EntryPointShortDescription = sUpperTrade + "Pivot Point Resistance 3 level"; break; case "Exit long at S3 (short at R3)": ExitPointLongDescription = sLowerTrade + "Pivot Point Support 3 level"; ExitPointShortDescription = sUpperTrade + "Pivot Point Resistance 3 level"; break; } } public override string ToString() { string text = IndicatorName + (IndParam.CheckParam[0].Checked ? "*" : ""); if (IndParam.ListParam[1].Text == "One day") text += "(Daily)"; return text; } } }
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 - 2024, Forex Software Ltd.;