The RationalSL indicator free

by mfejza in category Oscilator at 18/09/2022
Description

The RationalSL indicator showing the size of StopLoss based on average periods of true range of the price, for both long and short trades.

The indicator is adopted based in different pair decimals and time frames.

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
//idea: mfejza (https://ctrader.com/users/profile/58775)

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Levels(0)]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class mRationalSL : Indicator
    {
        [Parameter("Range Periods (10)", DefaultValue = 10, MinValue = 1, Group = "RationalSL")]
        public int inpRangePeriods { get; set; }
        [Parameter("Smooth Type", DefaultValue = MovingAverageType.Simple, Group = "RationalSL")]
        public MovingAverageType inpSmoothType { get; set; }
        [Parameter("OverBought% (80)", DefaultValue = 70, MinValue = 51, MaxValue = 99, Group = "RationalSL")]
        public int inpRSIOverBought { get; set; }
        [Parameter("OverSold% (20)", DefaultValue = 30, MinValue = 1, MaxValue = 49, Group = "RationalSL")]
        public int inpRSIOverSold { get; set; }

        [Output("SL close", Thickness = 1, LineColor = "Black")]
        public IndicatorDataSeries outSLc { get; set; }

        private MovingAverage _ma;
        private AverageTrueRange _atr;


        protected override void Initialize()
        {
            _ma = Indicators.MovingAverage(Bars.ClosePrices, inpRangePeriods, inpSmoothType);
            _atr = Indicators.AverageTrueRange(inpRangePeriods, inpSmoothType);
        }

        public override void Calculate(int index)
        {
            outSLc[index] = ((_ma.Result[index] + (_atr.Result[index] * (inpRSIOverBought - 50) / 100)) - (_ma.Result[index] - (_atr.Result[index] * (50 - inpRSIOverSold) / 100)));
        }
    }
}
Comments

mikle.jk2009 - September 20, 2022 @ 17:35

Hello. If you want a better essay then contact write my paper. They will be able to write the best essay for you for little money in the shortest possible time. This is exactly what you need.

leeminho2662000 - September 21, 2022 @ 12:48

This is an excellent article. This is, in my opinion, one of the best posts ever written. Your work is excellent and inspiring. Thank you very much. Nerdle game 

 

mahsomcorp - September 21, 2022 @ 15:52

Mehsom is the leading quality pulses and extra virgin olive oil exporters in Canada. We work in agri-food industries. We deliver quality products to our clients at affordable rates worldwide. We develop strong and long-term relationships with our clients and we cover all the business aspects with sincerity and integrity.

0