Information

Username: YesOrNot
Member since: 10 Oct 2022
Last login: 23 Sep 2023
Status: Active

Activity

Where Created Comments
Algorithms 14 16
Forum Topics 0 0
Jobs 0 0

About

24/7 -> "Unless I'm in dreamland." =]

Last Algorithm Comments

YesOrNot's avatar
YesOrNot · 1 week ago

Have A Nice day.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(AccessRights = AccessRights.None)]
    public class LarryWilliamsLargeTradingIndex : Indicator
    {
        [Parameter(DefaultValue = 8)]
        public int Period { get; set; }
        [Parameter(DefaultValue = 8)]
        public MovingAverageType MaType { get; set; }

        [Output("NoValue", LineColor = "Gray", IsHistogram = false, PlotType = PlotType.DiscontinuousLine, Thickness = 2)]
        public IndicatorDataSeries NoValue { get; set; }
        [Output("BullishValue", LineColor = "Green", IsHistogram = false, PlotType = PlotType.DiscontinuousLine, Thickness = 2)]
        public IndicatorDataSeries BullishValue { get; set; }
        [Output("BearishValue", LineColor = "Red", IsHistogram = false, PlotType = PlotType.DiscontinuousLine, Thickness = 2)]
        public IndicatorDataSeries BearishValue { get; set; }

        [Output("Middle", LineColor = "FF737373", Thickness = 1, LineStyle = LineStyle.Dots)]
        public IndicatorDataSeries Middle { get; set; }

        private MovingAverage ma1;
        private MovingAverage ma2;
        private AverageTrueRange averageTrueRange;

        private IndicatorDataSeries resMa;
        private IndicatorDataSeries atr;
        private IndicatorDataSeries sourceMa;


        protected override void Initialize()
        {
            sourceMa = CreateDataSeries();
            atr = CreateDataSeries();
            resMa = CreateDataSeries();
            ma1 = Indicators.MovingAverage(sourceMa, Period, MaType);
            averageTrueRange = Indicators.AverageTrueRange(Period, MaType);
        }

        public override void Calculate(int index)
        {
            // Level
            Middle[index] = 50;

            // Source of calculation ma
            sourceMa[index] = Bars.ClosePrices.Last(0) - Bars.ClosePrices.Last(Period);
            // calculation ATR

            atr[index] = averageTrueRange.Result[index];
            //LarryWilliams Calculation
            resMa[index] = ma1.Result[index] / atr[index] * 50 + 50;

            //Output
            NoValue[index] = resMa[index];
            BearishValue[index] = resMa[index] < 50 ? resMa[index] : double.NaN;
            BullishValue[index] = resMa[index] > 50 ? resMa[index] : double.NaN;
   
            // Repaint Calculation UNCOMMENT FOR SEE (The color is make in function of < or > 50, It's juste a coloration of previous)
            if (resMa[index] > 50)
            {
                BullishValue[index] = resMa[index];

                if (resMa[index - 1] < 50)
                    BullishValue[index - 1] = resMa[index - 1];

                BearishValue[index] = double.NaN;
            }
            if (resMa[index] < 50)
            {
                BearishValue[index] = resMa[index];

                if (resMa[index - 1] > 50)
                    BearishValue[index - 1] = resMa[index - 1];

                BullishValue[index] = double.NaN;
            }
        }
    }
}

YesOrNot's avatar
YesOrNot · 1 week ago

Source code ?

YesOrNot's avatar
YesOrNot · 2 weeks ago

Hi Splash the, 

Can you explain me exactly what you wanna make ? 

For collaboration my telegram here : https://t.me/nimi012

 

YesOrNot's avatar
YesOrNot · 2 weeks ago

Hi, any source code avaible ? 

YesOrNot's avatar
YesOrNot · 2 weeks ago

Line 26 : you can change the min value to 0 for better functionnality

[Parameter("Sensibility Histo", DefaultValue = 2, MinValue = 0, Group = "---HISTOGRAM---")]

YesOrNot's avatar
YesOrNot · 3 weeks ago

Hi, @crawfordevans499 thank you for your comment!

If it is complicated to understand then I explain to you :

1. The trend force uses a moving average and calculates its degree of inclination with respect to the selected lookback period. so you can know if the ma has a significant curve or not

2. the formula is a trigonometry rule. If you put a lookback 1, you will have the angle on a single period, on lookback 10, you will have the angle between the previous 10th bar and the last one.

3. To understand the result, I invite you to put a lookback of 1, and put the same moving average on the chart, so you can understand how it works, its advantages, and its disadvantages.

Have a nice study =) and why not, tell us what you find ! =D

YesOrNot's avatar
YesOrNot · 1 month ago

I forget to say “Champion” !

YesOrNot's avatar
YesOrNot · 1 month ago

Hi, Collaboration ? 

YesOrNot's avatar
YesOrNot · 1 month ago

Look Good !

 

YesOrNot's avatar
YesOrNot · 1 month ago

Source code ? 

YesOrNot's avatar
YesOrNot · 1 month ago

Hi, can you add the source code ? 

YesOrNot's avatar
YesOrNot · 1 month ago

.

YesOrNot's avatar
YesOrNot · 1 month ago

.

YesOrNot's avatar
YesOrNot · 1 month ago

Source Code ?

YesOrNot's avatar
YesOrNot · 1 month ago

After reflection, I think this is the best solution for renko


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{

    [Cloud("Renko Open", "Renko Close", FirstColor = "Green", SecondColor = "Red", Opacity = 0.5)]

    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class RenkoOnChart : Indicator
    {
        [Parameter(DefaultValue = "Renko10")]
        public TimeFrame RenkoPips { get; set; }

        [Output("Renko Open", LineColor = "Red")]
        public IndicatorDataSeries RenkoUp { get; set; }
        [Output("Renko Close", LineColor = "Green")]
        public IndicatorDataSeries RenkoDown { get; set; }

        Bars renko;
        IndicatorDataSeries high, low, open, close;

        protected override void Initialize()
        {
            renko = MarketData.GetBars(RenkoPips);
            high = CreateDataSeries();
            low = CreateDataSeries();
            open = CreateDataSeries();
            close = CreateDataSeries();
        }

        public override void Calculate(int index)
        {

            var indexBase = renko.OpenTimes.GetIndexByTime(Bars.OpenTimes.Last(0));

            open[index] = renko.OpenPrices[indexBase];
            close[index] = renko.ClosePrices[indexBase];
            high[index] = renko.HighPrices[indexBase];
            low[index] = renko.LowPrices[indexBase];

            RenkoUp[index] = close[index] > open[index] ? high[index] : low[index];
            RenkoDown[index] = close[index] < open[index] ? high[index] : low[index];
        }
    }
}

YesOrNot's avatar
YesOrNot · 1 month ago

Hi, First of all thank you for all the codes you post! You do a lot of work ! 

I fixed the double renko bug. example (50 pips): if a bar makes more than 100 pips and retraces directly, there is an error. There must surely be some bugs. Enjoy


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;


namespace cAlgo
{
    [Cloud("Renko Top", "Renko NewLevel", FirstColor = "Red", SecondColor = "Red", Opacity = 0.5)]
    [Cloud("Renko NewLevel", "Renko Bottom", FirstColor = "Green", SecondColor = "Green", Opacity = 0.5)]
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class mRenkoLineBreak : Indicator
    {
        [Parameter("PIPS BoxSize (default 50)", DefaultValue = 50, MinValue = 2)]
        public int inpBrickSize { get; set; }

        [Output("Renko Top", LineColor = "Gray", LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outRenkoTop { get; set; }
        [Output("Renko Bottom", LineColor = "Gray", LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outRenkoBottom { get; set; }
        [Output("Renko NewLevel", LineColor = "Transparent", LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outRenkoNewLevel { get; set; }

        private double _bricksize;
        private IndicatorDataSeries _top, _bottom, _newlevel;


        protected override void Initialize()
        {
            _bricksize = inpBrickSize * Symbol.PipSize;
            _top = CreateDataSeries();
            _bottom = CreateDataSeries();
            _newlevel = CreateDataSeries();
        }

        public override void Calculate(int i)
        {
            _top[i] = i > 1 ? _top[i - 1] : Bars.HighPrices[i];
            _bottom[i] = i > 1 ? _bottom[i - 1] : Bars.LowPrices[i];
            _newlevel[i] = i > 1 ? _newlevel[i - 1] : _top[i];

            if (Bars.ClosePrices.Last(0) >= _top[i - 1] + _bricksize)
            {

                var test = Math.Floor((Bars.ClosePrices.Last(0) - _top[i - 1]) / _bricksize);

                _top[i] = (test == 0 || test == 1 ? _top[i - 1] + _bricksize : _top[i - 1] + _bricksize * test );
                _bottom[i] = (test == 0 || test == 1 ? _top[i] - _bricksize : _top[i - 1] - _bricksize * test);
                _newlevel[i] = _top[i];
            }

            if (Bars.ClosePrices.Last(0) <= _bottom[i - 1] - _bricksize)
            {
                var test = Math.Floor((_bottom[i] - Bars.ClosePrices.Last(0)) / _bricksize);

                _top[i] = (test == 0 || test == 1 ? _top[i - 1] - _bricksize : _top[i - 1] - _bricksize * test );
                _bottom[i] = (test == 0 || test == 1 ? _top[i] - _bricksize : _top[i - 1] - _bricksize * test- _bricksize);
                _newlevel[i] = _bottom[i];
            }

            outRenkoTop[i] = _bottom[i] == _newlevel[i] ? _bottom[i] + _bricksize : _top[i];
            outRenkoBottom[i] = _top[i] == _newlevel[i] ? _top[i] - _bricksize : _bottom[i];
            outRenkoNewLevel[i] = _newlevel[i];
        }
    }
}