Time Price Channel by Popov
48413 downloads / 4775 views / Created: 04.08.2015 Average Rating: 5
Indicator Description
Time Price Channel indicator gets two parameters Time (hour and minutes) and price deviation in points.
The indicator monitors the market and when a bar Open price matches the specified time, it plots a channel of two lines, below and above the Open price. The lines are located at the specified deviation away of the reference Open price.
This indicator can be used as entry/exit point and also as entry and exit filter.
The indicator monitors the market and when a bar Open price matches the specified time, it plots a channel of two lines, below and above the Open price. The lines are located at the specified deviation away of the reference Open price.
This indicator can be used as entry/exit point and also as entry and exit filter.
//==============================================================
// Forex Strategy Builder
// Copyright © Forex Software Ltd. 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;
using System.Drawing;
using ForexStrategyBuilder.Infrastructure.Entities;
using ForexStrategyBuilder.Infrastructure.Enums;
using ForexStrategyBuilder.Infrastructure.Interfaces;
namespace ForexStrategyBuilder.Indicators.Custom
{
public class TimePriceChannel : Indicator
{
public TimePriceChannel()
{
IndicatorName = "Time Price Channel";
PossibleSlots = SlotTypes.Open | SlotTypes.OpenFilter | SlotTypes.Close | SlotTypes.CloseFilter;
IndicatorAuthor = "Miroslav Popov";
IndicatorVersion = "1.0";
IndicatorDescription = "Sets a channel based on the price at a specified time.";
}
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";
if (SlotType == SlotTypes.Open)
IndParam.ListParam[0].ItemList = new[]
{
"Enter long at Upper Band",
"Enter long at Lower Band"
};
else if (SlotType == SlotTypes.OpenFilter)
IndParam.ListParam[0].ItemList = new[]
{
"The bar opens below Upper Band",
"The bar opens above Upper Band",
"The bar opens below Lower Band",
"The bar opens above Lower Band",
"The position opens below Upper Band",
"The position opens above Upper Band",
"The position opens below Lower Band",
"The position opens above Lower Band",
"The bar opens below Upper Band after opening above it",
"The bar opens above Upper Band after opening below it",
"The bar opens below Lower Band after opening above it",
"The bar opens above Lower Band after opening below it"
};
else if (SlotType == SlotTypes.Close)
IndParam.ListParam[0].ItemList = new[]
{
"Exit long at Upper Band",
"Exit long at Lower Band"
};
else if (SlotType == SlotTypes.CloseFilter)
IndParam.ListParam[0].ItemList = new[]
{
"The bar closes below Upper Band",
"The bar closes above Upper Band",
"The bar closes below Lower Band",
"The bar closes above Lower Band"
};
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[] {"Open"};
IndParam.ListParam[1].Index = 0;
IndParam.ListParam[1].Text = "Open";
IndParam.ListParam[1].Enabled = true;
IndParam.ListParam[1].ToolTip = "The reference price is bar Open";
// The NumericUpDown parameters
IndParam.NumParam[0].Caption = "Hour";
IndParam.NumParam[0].Value = 8;
IndParam.NumParam[0].Min = 0;
IndParam.NumParam[0].Max = 23;
IndParam.NumParam[0].Point = 0;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "The hour of the reference time";
IndParam.NumParam[1].Caption = "Minutes";
IndParam.NumParam[1].Value = 0;
IndParam.NumParam[1].Min = 0;
IndParam.NumParam[1].Max = 59;
IndParam.NumParam[1].Point = 0;
IndParam.NumParam[1].Enabled = true;
IndParam.NumParam[1].ToolTip = "The minute of the reference time";
IndParam.NumParam[2].Caption = "Price deviation [point]";
IndParam.NumParam[2].Value = 200;
IndParam.NumParam[2].Min = 5;
IndParam.NumParam[2].Max = 2000;
IndParam.NumParam[2].Point = 0;
IndParam.NumParam[2].Enabled = true;
IndParam.NumParam[2].ToolTip = "Determines the channel width.";
// 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
int hour = (int)IndParam.NumParam[0].Value;
int minute = (int)IndParam.NumParam[1].Value;
double margin = IndParam.NumParam[2].Value * Point;
int previous = IndParam.CheckParam[0].Checked ? 1 : 0;
// Calculation
double[] upperBand = new double[Bars];
double[] lowerBand = new double[Bars];
int firstBar = 1;
for (int bar = 1; bar < Bars; bar++)
{
if (Time[bar].Hour == hour && Time[bar].Minute == minute)
{
if (firstBar == 0)
firstBar = bar;
upperBand[bar] = Open[bar] + margin;
lowerBand[bar] = Open[bar] - margin;
}
else
{
upperBand[bar] = upperBand[bar-1];
lowerBand[bar] = lowerBand[bar-1];
}
}
// Saving the components
Component = new IndicatorComp[4];
Component[0] = new IndicatorComp
{
CompName = "Upper Band",
DataType = IndComponentType.IndicatorValue,
ChartType = IndChartType.Level,
ChartColor = Color.Chocolate,
FirstBar = firstBar,
Value = upperBand
};
Component[1] = new IndicatorComp
{
CompName = "Lower Band",
DataType = IndComponentType.IndicatorValue,
ChartType = IndChartType.Level,
ChartColor = Color.Chocolate,
FirstBar = firstBar,
Value = lowerBand
};
Component[2] = new IndicatorComp
{
ChartType = IndChartType.NoChart,
FirstBar = firstBar,
Value = new double[Bars]
};
Component[3] = new IndicatorComp
{
ChartType = IndChartType.NoChart,
FirstBar = firstBar,
Value = new double[Bars]
};
// Sets the Component's type
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";
}
if (SlotType == SlotTypes.Open || SlotType == SlotTypes.Close)
{
for (int bar = firstBar; bar < Bars; bar++)
{
double valueUp = upperBand[bar - previous];
double valueDown = lowerBand[bar - previous];
if (IndParam.ListParam[0].Text == "Enter long at Upper Band" ||
IndParam.ListParam[0].Text == "Exit long at Upper Band")
{
Component[2].Value[bar] = valueUp;
Component[3].Value[bar] = valueDown;
}
else
{
Component[2].Value[bar] = valueDown;
Component[3].Value[bar] = valueUp;
}
}
}
else
{
switch (IndParam.ListParam[0].Text)
{
case "The bar opens below Upper Band":
BandIndicatorLogic(firstBar, previous, upperBand, lowerBand, ref Component[2], ref Component[3],
BandIndLogic.The_bar_opens_below_the_Upper_Band);
break;
case "The bar opens above Upper Band":
BandIndicatorLogic(firstBar, previous, upperBand, lowerBand, ref Component[2], ref Component[3],
BandIndLogic.The_bar_opens_above_the_Upper_Band);
break;
case "The bar opens below Lower Band":
BandIndicatorLogic(firstBar, previous, upperBand, lowerBand, ref Component[2], ref Component[3],
BandIndLogic.The_bar_opens_below_the_Lower_Band);
break;
case "The bar opens above Lower Band":
BandIndicatorLogic(firstBar, previous, upperBand, lowerBand, ref Component[2], ref Component[3],
BandIndLogic.The_bar_opens_above_the_Lower_Band);
break;
case "The bar opens below Upper Band after opening above it":
BandIndicatorLogic(firstBar, previous, upperBand, lowerBand, ref Component[2], ref Component[3],
BandIndLogic.The_bar_opens_below_the_Upper_Band_after_opening_above_it);
break;
case "The bar opens above Upper Band after opening below it":
BandIndicatorLogic(firstBar, previous, upperBand, lowerBand, ref Component[2], ref Component[3],
BandIndLogic.The_bar_opens_above_the_Upper_Band_after_opening_below_it);
break;
case "The bar opens below Lower Band after opening above it":
BandIndicatorLogic(firstBar, previous, upperBand, lowerBand, ref Component[2], ref Component[3],
BandIndLogic.The_bar_opens_below_the_Lower_Band_after_opening_above_it);
break;
case "The bar opens above Lower Band after opening below it":
BandIndicatorLogic(firstBar, previous, upperBand, lowerBand, ref Component[2], ref Component[3],
BandIndLogic.The_bar_opens_above_the_Lower_Band_after_opening_below_it);
break;
case "The position opens above Upper Band":
Component[0].PosPriceDependence = PositionPriceDependence.PriceBuyHigher;
Component[1].PosPriceDependence = PositionPriceDependence.PriceSellLower;
Component[0].UsePreviousBar = previous;
Component[1].UsePreviousBar = previous;
Component[2].DataType = IndComponentType.Other;
Component[3].DataType = IndComponentType.Other;
Component[2].ShowInDynInfo = false;
Component[3].ShowInDynInfo = false;
break;
case "The position opens below Upper Band":
Component[0].PosPriceDependence = PositionPriceDependence.PriceBuyLower;
Component[1].PosPriceDependence = PositionPriceDependence.PriceSellHigher;
Component[0].UsePreviousBar = previous;
Component[1].UsePreviousBar = previous;
Component[2].DataType = IndComponentType.Other;
Component[3].DataType = IndComponentType.Other;
Component[2].ShowInDynInfo = false;
Component[3].ShowInDynInfo = false;
break;
case "The position opens above Lower Band":
Component[0].PosPriceDependence = PositionPriceDependence.PriceSellLower;
Component[1].PosPriceDependence = PositionPriceDependence.PriceBuyHigher;
Component[0].UsePreviousBar = previous;
Component[1].UsePreviousBar = previous;
Component[2].DataType = IndComponentType.Other;
Component[3].DataType = IndComponentType.Other;
Component[2].ShowInDynInfo = false;
Component[3].ShowInDynInfo = false;
break;
case "The position opens below Lower Band":
Component[0].PosPriceDependence = PositionPriceDependence.PriceSellHigher;
Component[1].PosPriceDependence = PositionPriceDependence.PriceBuyLower;
Component[0].UsePreviousBar = previous;
Component[1].UsePreviousBar = previous;
Component[2].DataType = IndComponentType.Other;
Component[3].DataType = IndComponentType.Other;
Component[2].ShowInDynInfo = false;
Component[3].ShowInDynInfo = false;
break;
case "The bar closes below Upper Band":
BandIndicatorLogic(firstBar, previous, upperBand, lowerBand, ref Component[2], ref Component[3],
BandIndLogic.The_bar_closes_below_the_Upper_Band);
break;
case "The bar closes above Upper Band":
BandIndicatorLogic(firstBar, previous, upperBand, lowerBand, ref Component[2], ref Component[3],
BandIndLogic.The_bar_closes_above_the_Upper_Band);
break;
case "The bar closes below Lower Band":
BandIndicatorLogic(firstBar, previous, upperBand, lowerBand, ref Component[2], ref Component[3],
BandIndLogic.The_bar_closes_below_the_Lower_Band);
break;
case "The bar closes above Lower Band":
BandIndicatorLogic(firstBar, previous, upperBand, lowerBand, ref Component[2], ref Component[3],
BandIndLogic.The_bar_closes_above_the_Lower_Band);
break;
}
}
}
public override void SetDescription()
{
switch (IndParam.ListParam[0].Text)
{
case "Enter long at Upper Band":
EntryPointLongDescription = "at Upper Band of " + ToString();
EntryPointShortDescription = "at Lower Band of " + ToString();
break;
case "Enter long at Lower Band":
EntryPointLongDescription = "at Lower Band of " + ToString();
EntryPointShortDescription = "at Upper Band of " + ToString();
break;
case "Exit long at Upper Band":
ExitPointLongDescription = "at Upper Band of " + ToString();
ExitPointShortDescription = "at Lower Band of " + ToString();
break;
case "Exit long at Lower Band":
ExitPointLongDescription = "at Lower Band of " + ToString();
ExitPointShortDescription = "at Upper Band of " + ToString();
break;
case "The bar opens below Upper Band":
EntryFilterLongDescription = "the bar opens below Upper Band of " + ToString();
EntryFilterShortDescription = "the bar opens above Lower Band of " + ToString();
break;
case "The bar opens above Upper Band":
EntryFilterLongDescription = "the bar opens above Upper Band of " + ToString();
EntryFilterShortDescription = "the bar opens below Lower Band of " + ToString();
break;
case "The bar opens below Lower Band":
EntryFilterLongDescription = "the bar opens below Lower Band of " + ToString();
EntryFilterShortDescription = "the bar opens above Upper Band of " + ToString();
break;
case "The bar opens above Lower Band":
EntryFilterLongDescription = "the bar opens above Lower Band of " + ToString();
EntryFilterShortDescription = "the bar opens below Upper Band of " + ToString();
break;
case "The position opens above Upper Band":
EntryFilterLongDescription = "the position opening price is higher than Upper Band of " + ToString();
EntryFilterShortDescription = "the position opening price is lower than Lower Band of " + ToString();
break;
case "The position opens below Upper Band":
EntryFilterLongDescription = "the position opening price is lower than Upper Band of " + ToString();
EntryFilterShortDescription = "the position opening price is higher than Lower Band of " +
ToString();
break;
case "The position opens above Lower Band":
EntryFilterLongDescription = "the position opening price is higher than Lower Band of " + ToString();
EntryFilterShortDescription = "the position opening price is lower than Upper Band of " + ToString();
break;
case "The position opens below Lower Band":
EntryFilterLongDescription = "the position opening price is lower than Lower Band of " + ToString();
EntryFilterShortDescription = "the position opening price is higher than Upper Band of " +
ToString();
break;
case "The bar opens below Upper Band after opening above it":
EntryFilterLongDescription = "the bar opens below Upper Band of " + ToString() +
" after the previous bar has opened above it";
EntryFilterShortDescription = "the bar opens above Lower Band of " + ToString() +
" after the previous bar has opened below it";
break;
case "The bar opens above Upper Band after opening below it":
EntryFilterLongDescription = "the bar opens above Upper Band of " + ToString() +
" after the previous bar has opened below it";
EntryFilterShortDescription = "the bar opens below Lower Band of " + ToString() +
" after the previous bar has opened above it";
break;
case "The bar opens below Lower Band after opening above it":
EntryFilterLongDescription = "the bar opens below Lower Band of " + ToString() +
" after the previous bar has opened above it";
EntryFilterShortDescription = "the bar opens above Upper Band of " + ToString() +
" after the previous bar has opened below it";
break;
case "The bar opens above Lower Band after opening below it":
EntryFilterLongDescription = "the bar opens above Lower Band of " + ToString() +
" after the previous bar has opened below it";
EntryFilterShortDescription = "the bar opens below Upper Band of " + ToString() +
" after the previous bar has opened above it";
break;
case "The bar closes below Upper Band":
ExitFilterLongDescription = "the bar closes below Upper Band of " + ToString();
ExitFilterShortDescription = "the bar closes above Lower Band of " + ToString();
break;
case "The bar closes above Upper Band":
ExitFilterLongDescription = "the bar closes above Upper Band of " + ToString();
ExitFilterShortDescription = "the bar closes below Lower Band of " + ToString();
break;
case "The bar closes below Lower Band":
ExitFilterLongDescription = "the bar closes below Lower Band of " + ToString();
ExitFilterShortDescription = "the bar closes above Upper Band of " + ToString();
break;
case "The bar closes above Lower Band":
ExitFilterLongDescription = "the bar closes above Lower Band of " + ToString();
ExitFilterShortDescription = "the bar closes below Upper Band of " + ToString();
break;
}
}
public override string ToString()
{
return IndicatorName +
(IndParam.CheckParam[0].Checked ? "* (" : " (") +
IndParam.NumParam[0].ValueToString + ", " +
IndParam.NumParam[1].ValueToString + ", " +
IndParam.NumParam[2].ValueToString + ")";
}
}
}
//+--------------------------------------------------------------------+ //| Copyright: (C) 2014 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) 2014 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 TimePriceChannel : public Indicator { public: TimePriceChannel(SlotTypes slotType) { SlotType=slotType; IndicatorName="Time Price Channel"; WarningMessage = ""; IsAllowLTF = true; ExecTime = ExecutionTime_DuringTheBar; IsSeparateChart = false; IsDiscreteValues = false; IsDeafultGroupAll = false; } virtual void Calculate(DataSet &dataSet); }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void TimePriceChannel::Calculate(DataSet &dataSet) { Data=GetPointer(dataSet); int hour = (int)NumParam[0].Value; int minute = (int)NumParam[1].Value; double margin = NumParam[2].Value * Data.Point; int previous = CheckParam[0].Checked ? 1 : 0; double upperBand[]; ArrayResize(upperBand,Data.Bars); ArrayInitialize(upperBand,0); double lowerBand[]; ArrayResize(lowerBand,Data.Bars); ArrayInitialize(lowerBand,0); int firstBar=1; for(int bar=1; bar<Data.Bars; bar++) { datetime time=Data.Time[bar]; if(TimeHour(Data.Time[bar])==hour && TimeMinute(Data.Time[bar])==minute) { if(firstBar==0) firstBar=bar; upperBand[bar] = Data.Open[bar] + margin; lowerBand[bar] = Data.Open[bar] - margin; } else { upperBand[bar] = upperBand[bar-1]; lowerBand[bar] = lowerBand[bar-1]; } } ArrayResize(Component[0].Value,Data.Bars); Component[0].CompName = "Upper Band"; Component[0].DataType = IndComponentType_IndicatorValue; Component[0].FirstBar = firstBar; ArrayCopy(Component[0].Value,upperBand); ArrayResize(Component[1].Value,Data.Bars); Component[1].CompName = "Lower Band"; Component[1].DataType = IndComponentType_IndicatorValue; Component[1].FirstBar = firstBar; ArrayCopy(Component[1].Value,lowerBand); ArrayResize(Component[2].Value,Data.Bars); Component[2].FirstBar=firstBar; ArrayResize(Component[3].Value,Data.Bars); Component[3].FirstBar=firstBar; 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"; } if(SlotType==SlotTypes_Open || SlotType==SlotTypes_Close) { if(ListParam[0].Text=="Enter long at Upper Band" || ListParam[0].Text=="Exit long at Upper Band") { for(int bar=firstBar; bar<Data.Bars; bar++) { Component[2].Value[bar] = upperBand[bar - previous]; Component[3].Value[bar] = lowerBand[bar - previous]; } } else { for(int bar=firstBar; bar<Data.Bars; bar++) { Component[2].Value[bar] = lowerBand[bar - previous]; Component[3].Value[bar] = upperBand[bar - previous]; } } } else { if(ListParam[0].Text=="The bar opens below Upper Band") BandIndicatorLogic(firstBar,previous,upperBand,lowerBand,Component[2],Component[3],BandIndLogic_The_bar_opens_below_the_Upper_Band); else if(ListParam[0].Text=="The bar opens above Upper Band") BandIndicatorLogic(firstBar,previous,upperBand,lowerBand,Component[2],Component[3],BandIndLogic_The_bar_opens_above_the_Upper_Band); else if(ListParam[0].Text=="The bar opens below Lower Band") BandIndicatorLogic(firstBar,previous,upperBand,lowerBand,Component[2],Component[3],BandIndLogic_The_bar_opens_below_the_Lower_Band); else if(ListParam[0].Text=="The bar opens above Lower Band") BandIndicatorLogic(firstBar,previous,upperBand,lowerBand,Component[2],Component[3],BandIndLogic_The_bar_opens_above_the_Lower_Band); else if(ListParam[0].Text=="The bar opens below Upper Band after opening above it") BandIndicatorLogic(firstBar,previous,upperBand,lowerBand,Component[2],Component[3],BandIndLogic_The_bar_opens_below_Upper_Band_after_above); else if(ListParam[0].Text=="The bar opens above Upper Band after opening below it") BandIndicatorLogic(firstBar,previous,upperBand,lowerBand,Component[2],Component[3],BandIndLogic_The_bar_opens_above_Upper_Band_after_below); else if(ListParam[0].Text=="The bar opens below Lower Band after opening above it") BandIndicatorLogic(firstBar,previous,upperBand,lowerBand,Component[2],Component[3],BandIndLogic_The_bar_opens_below_Lower_Band_after_above); else if(ListParam[0].Text=="The bar opens above Lower Band after opening below it") BandIndicatorLogic(firstBar,previous,upperBand,lowerBand,Component[2],Component[3],BandIndLogic_The_bar_opens_above_Lower_Band_after_below); else if(ListParam[0].Text=="The position opens above Upper Band") { Component[0].PosPriceDependence = PositionPriceDependence_PriceBuyHigher; Component[1].PosPriceDependence = PositionPriceDependence_PriceSellLower; Component[0].UsePreviousBar = previous; Component[1].UsePreviousBar = previous; Component[2].DataType = IndComponentType_Other; Component[3].DataType = IndComponentType_Other; Component[2].ShowInDynInfo = false; Component[3].ShowInDynInfo = false; } else if(ListParam[0].Text=="The position opens below Upper Band") { Component[0].PosPriceDependence = PositionPriceDependence_PriceBuyLower; Component[1].PosPriceDependence = PositionPriceDependence_PriceSellHigher; Component[0].UsePreviousBar = previous; Component[1].UsePreviousBar = previous; Component[2].DataType = IndComponentType_Other; Component[3].DataType = IndComponentType_Other; Component[2].ShowInDynInfo = false; Component[3].ShowInDynInfo = false; } else if(ListParam[0].Text=="The position opens above Lower Band") { Component[0].PosPriceDependence = PositionPriceDependence_PriceSellLower; Component[1].PosPriceDependence = PositionPriceDependence_PriceBuyHigher; Component[0].UsePreviousBar = previous; Component[1].UsePreviousBar = previous; Component[2].DataType = IndComponentType_Other; Component[3].DataType = IndComponentType_Other; Component[2].ShowInDynInfo = false; Component[3].ShowInDynInfo = false; } else if(ListParam[0].Text=="The position opens below Lower Band") { Component[0].PosPriceDependence = PositionPriceDependence_PriceSellHigher; Component[1].PosPriceDependence = PositionPriceDependence_PriceBuyLower; Component[0].UsePreviousBar = previous; Component[1].UsePreviousBar = previous; Component[2].DataType = IndComponentType_Other; Component[3].DataType = IndComponentType_Other; Component[2].ShowInDynInfo = false; Component[3].ShowInDynInfo = false; } else if(ListParam[0].Text=="The bar closes below Upper Band") BandIndicatorLogic(firstBar,previous,upperBand,lowerBand,Component[2],Component[3],BandIndLogic_The_bar_closes_below_the_Upper_Band); else if(ListParam[0].Text=="The bar closes above Upper Band") BandIndicatorLogic(firstBar,previous,upperBand,lowerBand,Component[2],Component[3],BandIndLogic_The_bar_closes_above_the_Upper_Band); else if(ListParam[0].Text=="The bar closes below Lower Band") BandIndicatorLogic(firstBar,previous,upperBand,lowerBand,Component[2],Component[3],BandIndLogic_The_bar_closes_below_the_Lower_Band); else if(ListParam[0].Text=="The bar closes above Lower Band") BandIndicatorLogic(firstBar,previous,upperBand,lowerBand,Component[2],Component[3],BandIndLogic_The_bar_closes_above_the_Lower_Band); } } //+------------------------------------------------------------------+
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.;
Copyright © 2006 - 2024, Forex Software Ltd.;