TrendSignal indicator free
Description
TrendSignal trend-following indicator specifies the change of a trend when Close price breaks through the specified range of bars upwards or downwards.
The Risk parameter allows defining the distance from the extreme price for this period, and it is defined it as a percentage of the range for this period.
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
using System; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; namespace cAlgo { [Indicator(IsOverlay = true, AccessRights = AccessRights.None)] public class mTrendSignal : Indicator { [Parameter("Period (9)", DefaultValue = 9)] public int inpPeriod { get; set; } [Parameter("Risk (30)", DefaultValue = 30)] public double inpRisk { get; set; } [Output("TrendSignal OpenLong trigger", LineColor = "Green", PlotType = PlotType.Points, Thickness = 5)] public IndicatorDataSeries outLongOpen { get; set; } [Output("TrendSignal OpenShort trigger", LineColor = "Red", PlotType = PlotType.Points, Thickness = 5)] public IndicatorDataSeries outShortOpen { get; set; } private IndicatorDataSeries _hh, _ll, _min, _max, _trend, _up, _down; protected override void Initialize() { _hh = CreateDataSeries(); _ll = CreateDataSeries(); _min = CreateDataSeries(); _max = CreateDataSeries(); _trend = CreateDataSeries(); _up = CreateDataSeries(); _down = CreateDataSeries(); } public override void Calculate(int i) { _hh[i] = Bars.HighPrices.Maximum(inpPeriod); _ll[i] = Bars.LowPrices.Minimum(inpPeriod); _max[i] = _hh[i] - (_hh[i] - _ll[i]) * inpRisk / 100.0; _min[i] = _ll[i] + (_hh[i] - _ll[i]) * inpRisk / 100.0; _up[i] = _down[i] = double.NaN; if(i>1 && Bars.ClosePrices[i-1] < _max[i-1] && Bars.ClosePrices[i] > _max[i-1] && _trend[i-1] != +1) { _trend[i] = +1; _up[i] = Bars.OpenPrices[i]; } else { if(i>1 && Bars.ClosePrices[i-1] > _min[i-1] && Bars.ClosePrices[i] < _min[i-1] && _trend[i-1] != -1) { _trend[i] = -1; _down[i] = Bars.OpenPrices[i]; } else _trend[i] = (!double.IsNaN(_trend[i-1]) ? _trend[i-1] : 1); } outLongOpen[i] = !double.IsNaN(_up[i]) ? Bars.HighPrices[i] : _up[i]; outShortOpen[i] = !double.IsNaN(_down[i]) ? Bars.LowPrices[i] : _down[i]; } } }
Comments

Hello,
Thanks for all the great indicators (plus code) you uploaded. They've been very useful.
I'm afraid i cant say the same for this very indicator - it shows no signals on the XAUUSD H1 timeframe.
Are you able to look into it?
Regards
K

My bad ....sincere apologies ...it works ...