Shadow True Strength Index indicator free

by mfejza in category Oscilator at 18/01/2023
Description

Shadow True Strength Index indicator

Use shadow color as trade sentiment; green for Long; red for Short

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
Language: C#
Trading Platform: cAlgocTrader
using System;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Cloud("ZoneUp", "ZoneDn", FirstColor = "Green", SecondColor = "Red", Opacity = 0.1)]  
    [Levels(-25.0, 0.0, +25.0)]
    [Indicator(AccessRights = AccessRights.None)]
    public class mTSIshadow : Indicator
    {
        [Parameter("Source (close)")]
        public DataSeries inpDataSeries { get; set; }
        [Parameter("Smooth Fast Periods (7)", DefaultValue = 7)]
        public int inpSmoothFastPeriods { get; set; }
        [Parameter("Smooth Slow Periods (14)", DefaultValue = 14)]
        public int inpSmoothSlowPeriods { get; set; }
        [Parameter("Smooth Shadow Period 1 (14)", DefaultValue = 14)]
        public int inpSmoothPeriod1 { get; set; }
        [Parameter("Smooth Type 1 (sma)", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType inpSmoothType1 { get; set; }
        [Parameter("Smooth Shadow Period 2 (14)", DefaultValue = 14)]
        public int inpSmoothPeriod2 { get; set; }
        [Parameter("Smooth Type 2 (sma)", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType inpSmoothType2 { get; set; }

        [Output("TSI", LineColor = "Black", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outTSI { get; set; }
        [Output("Shadow 1", LineColor = "Green", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outShadow1 { get; set; }
        [Output("Shadow 2", LineColor = "Red", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outShadow2 { get; set; }
        [Output("ZoneUp", LineColor = "Transparent")]
        public IndicatorDataSeries outZoneUp { get; set; }
        [Output("ZoneDn", LineColor = "Transparent")]
        public IndicatorDataSeries outZoneDn { get; set; }
        
        private MovingAverage _pr, _sm1udm, _sm2udm,  _sm1adm, _sm2adm, _shadow1, _shadow2;
        private IndicatorDataSeries _udm, _adm, _tsi;
        

        protected override void Initialize()
        {
            _pr = Indicators.MovingAverage(inpDataSeries, 1, MovingAverageType.Simple);
            _udm = CreateDataSeries();
            _adm = CreateDataSeries();
            _tsi = CreateDataSeries();
            _sm1udm = Indicators.MovingAverage(_udm, inpSmoothFastPeriods, MovingAverageType.Exponential);
            _sm2udm = Indicators.MovingAverage(_sm1udm.Result, inpSmoothSlowPeriods, MovingAverageType.Exponential);
            _sm1adm = Indicators.MovingAverage(_adm, inpSmoothFastPeriods, MovingAverageType.Exponential);
            _sm2adm = Indicators.MovingAverage(_sm1adm.Result, inpSmoothSlowPeriods, MovingAverageType.Exponential);
            _shadow1 = Indicators.MovingAverage(_tsi, inpSmoothPeriod1, inpSmoothType1);
            _shadow2 = Indicators.MovingAverage(_shadow1.Result, inpSmoothPeriod2, inpSmoothType2);
        }

        public override void Calculate(int i)
        {
            _udm[i] = i>1 ? _pr.Result[i] - _pr.Result[i-1] : _pr.Result[i] - Bars.TypicalPrices[i];
            _adm[i] = Math.Abs(_udm[i]);
            _tsi[i] = (_sm2adm.Result[i] != 0 ? 100 * _sm2udm.Result[i] / _sm2adm.Result[i] : 0);
            
            outTSI[i] = _tsi[i];
            outShadow1[i] = _shadow1.Result[i];
            outShadow2[i] = _shadow2.Result[i];            
            outZoneUp[i] = outZoneDn[i] = _tsi[i];
            if(_tsi[i] > _shadow1.Result[i] && _tsi[i] > _shadow2.Result[i])
                outZoneDn[i] = Math.Max(_shadow1.Result[i], _shadow2.Result[i]);
            if(_tsi[i] < _shadow1.Result[i] && _tsi[i] < _shadow2.Result[i])
                outZoneDn[i] = Math.Min(_shadow1.Result[i], _shadow2.Result[i]);
        }
    }
}
Comments

gilbertivan456 - January 20, 2023 @ 06:10

Feed.kroger.com is the login page for Feed Kroger. For its employees across the USA, Kroger owns and manages this website. Knowing about daily work schedules is more pleasant for employees thanks to the online platform.

bob.hess944 - January 25, 2023 @ 16:47

If you interested creative Lego creations or you collect own favorite Lego series, welcome to our Lego fan blog where you find latest news on Lego and more.

stewardcampbells - February 02, 2023 @ 21:45

Hello, I wanted to thank you for sharing this useful material, according to the volumes and indicators and others, for those who are not quite good at this sphere. Some of those aspects provided here will be useful in the trading and technology report I am working at. Thanks a lot for this.

0