Information

Username: YesOrNot2
Member since: 17 May 2024
Last login: 09 Oct 2024
Status: Active

Activity

Where Created Comments
Algorithms 37 14
Forum Topics 6 10
Jobs 1 0

About

My first account was blocked by cTrader, but we're not doing this for cTrader, we're doing this for the world.

First account : https://ctrader.com/users/profile/70920/algos

Current account : https://ctrader.com/users/profile/137708

Enjoy =)

Last Algorithm Comments

YE
YesOrNot2 · 2 months ago

Nice work !

YE
YesOrNot2 · 2 months ago

Good Version is update..

YE
YesOrNot2 · 2 months ago

Pour ceux qui on remarqué que ça bugué en live 

=)

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(IsOverlay = true, AccessRights = AccessRights.None)]
    public class SwingHilov11 : Indicator
    {
        [Parameter(DefaultValue = 8)]
        public int PeriodFractale { get; set; }

        [Output("Higher High ", PlotType = PlotType.Points, LineColor = "Lime", Thickness = 2)]
        public IndicatorDataSeries HH { get; set; }
        [Output("Higher Low", PlotType = PlotType.Points, LineColor = "Orange", Thickness = 2)]
        public IndicatorDataSeries HL { get; set; }
        [Output("Lower High", PlotType = PlotType.Points, LineColor = "DeepSkyBlue", Thickness = 2)]
        public IndicatorDataSeries LH { get; set; }
        [Output("Lower Low", PlotType = PlotType.Points, LineColor = "Red", Thickness = 2)]
        public IndicatorDataSeries LL { get; set; }


        private Fractals fra5;
        private int upint, downint;
        private int newindex;
        private IndicatorDataSeries up, down, up2, down2;

        protected override void Initialize()
        {
            fra5 = Indicators.Fractals(PeriodFractale);
            up = CreateDataSeries();
            down = CreateDataSeries();
            up2 = CreateDataSeries();
            down2 = CreateDataSeries();

        }

        public override void Calculate(int index)
        {

            if (index > newindex)
            {
                up[index] = fra5.UpFractal.Last(0);
                down[index] = fra5.DownFractal.Last(0);

                up[index] = double.IsNaN(up[index]) ? up[index - 1] : up[index];
                down[index] = double.IsNaN(down[index]) ? down[index - 1] : down[index];

                var customindex = index - (int)(PeriodFractale / 2);


                up2[customindex] = up2[index];
                down2[customindex] = down2[index];

                if (up[index] > up[index - 1])
                {
                    HH[customindex] = up[index];
                    HL[customindex] = double.NaN;
                }
                if (up[index] < up[index - 1])
                {
                    HL[customindex] = up[index];
                    HH[customindex] = double.NaN;
                }
                if (down[index] < down[index - 1])
                {
                    LL[customindex] = down[index];
                    LH[customindex] = double.NaN;
                }
                if (down[index] > down[index - 1])
                {
                    LH[customindex] = down[index];
                    LL[customindex] = double.NaN;
                }

                HL[customindex] = double.IsNaN(HL[customindex]) && double.IsNaN(HH[customindex]) ? HL[customindex - 1] : HL[customindex];
                HH[customindex] = double.IsNaN(HH[customindex]) && double.IsNaN(HL[customindex]) ? HH[customindex - 1] : HH[customindex];
                LL[customindex] = double.IsNaN(LL[customindex]) && double.IsNaN(LH[customindex]) ? LL[customindex - 1] : LL[customindex];
                LH[customindex] = double.IsNaN(LH[customindex]) && double.IsNaN(LL[customindex]) ? LH[customindex - 1] : LH[customindex];

                newindex = index;
                CreateLabel(customindex);

            }
        }
        private void CreateLabel(int customindex)
        {


            if ((!double.IsNaN(HH[customindex]) && double.IsNaN(HH[customindex - 1])) || (!double.IsNaN(HH[customindex]) && !double.IsNaN(HH[customindex - 1]) && HH[customindex - 1] != HH[customindex]))
            {
                var textHH = Chart.DrawText("HH" + customindex, "HH", customindex, HH[customindex], Color.Lime);
                textHH.VerticalAlignment = VerticalAlignment.Top;
                textHH.HorizontalAlignment = HorizontalAlignment.Center;
            }
            else if ((!double.IsNaN(HL[customindex]) && double.IsNaN(HL[customindex - 1])) || (!double.IsNaN(HL[customindex]) && !double.IsNaN(HL[customindex - 1]) && HL[customindex - 1] != HL[customindex]))
            {
                var textHL = Chart.DrawText("HL" + customindex, "HL", customindex, HL[customindex], Color.Orange);
                textHL.VerticalAlignment = VerticalAlignment.Top;
                textHL.HorizontalAlignment = HorizontalAlignment.Center;
            }
            else if ((!double.IsNaN(LL[customindex]) && double.IsNaN(LL[customindex - 1])) || (!double.IsNaN(LL[customindex]) && !double.IsNaN(LL[customindex - 1]) && LL[customindex - 1] != LL[customindex]))
            {
                var textLL = Chart.DrawText("LL" + customindex, "LL", customindex, LL[customindex], Color.Red);
                textLL.VerticalAlignment = VerticalAlignment.Bottom;
                textLL.HorizontalAlignment = HorizontalAlignment.Center;
            }
            else if ((!double.IsNaN(LH[customindex]) && double.IsNaN(LH[customindex - 1])) || (!double.IsNaN(LH[customindex]) && !double.IsNaN(LH[customindex - 1]) && LH[customindex - 1] != LH[customindex]))
            {
                var textLH = Chart.DrawText("LH" + customindex, "LH", customindex, LH[customindex], Color.DeepSkyBlue);
                textLH.VerticalAlignment = VerticalAlignment.Bottom;
                textLH.HorizontalAlignment = HorizontalAlignment.Center;
            }



            //ChartObjects[name].FontSize = 8;
        }
    }
}

YE
YesOrNot2 · 2 months ago

Thank you, Jim. But if you take a close look at all the code, you’ll quickly understand why I called it *lol*. At least half of the code is useless, and the other half is written all over the place. Hahaha 🤣

And a bunch of nonsense together makes the whole thing work 🤣🤣🤣

YE
YesOrNot2 · 2 months ago

correction line 921 max by min

YE
YesOrNot2 · 2 months ago

Hi, what type of broker do you use with these high-frequency trading bots, CFDs or futures?

YE
YesOrNot2 · 3 months ago

Hi Xabbu ! 

I saw that you were developing a strategy tester for NNFX. Have you finished your project? Did you find it somewhere?

YE
YesOrNot2 · 3 months ago

hi, what is the package ? I juste take MathNet 5.0.0 and he make an error :

Package “MathNet.Numerics” is not supported

YE
YesOrNot2 · 3 months ago

 You can add this in code for better result about rsi & mfi :


               case (EnumStrategie.Rsi):
                    {
                        var devPlus = RSIDev * rsi.Result[index] * Symbol.PipSize;
                        var devMinus = RSIDev * (100 - rsi.Result[index]) * Symbol.PipSize;
                        UpperBB[index] = Basis[index] + devMinus;
                        LowerBB[index] = Basis[index] - devPlus;
                    }
                    break;
                case (EnumStrategie.Mfi):
                    {
                        var devPlus = MFIDev * mfi.Result[index] * Symbol.PipSize;
                        var devMinus = MFIDev * (100 - mfi.Result[index]) * Symbol.PipSize;
                        UpperBB[index] = Basis[index] + devMinus;
                        LowerBB[index] = Basis[index] - devPlus;
                    }
                    break;

YE
YesOrNot2 · 3 months ago

Thx jim.tollan !

YE
YesOrNot2 · 3 months ago

I just make it : 

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.GMTStandardTime, AccessRights = AccessRights.None)]
    public class MarketSessionBox : Indicator
    {

        [Parameter("Sydney Session Active", DefaultValue = true, Group = "Market Sessions|Sydney Session")]
        public bool SydneySessionActive { get; set; }
        [Parameter(DefaultValue = "21:00", Group = "Market Sessions|Sydney Session")]
        public string Sydney { get; set; }
        [Parameter(DefaultValue = 8, Group = "Market Sessions|Sydney Session")]
        public int SydneyHour { get; set; }
        [Parameter("Sydney Color", DefaultValue = "LightBlue", Group = "Market Sessions|Sydney Session")]
        public Color SydneyFillColor { get; set; }
        [Parameter("Sydney Fill zone", DefaultValue = false, Group = "Market Sessions|Sydney Session")]
        public bool SydneyOpacity { get; set; }
        [Parameter("Sydney Box Line Type", DefaultValue = LineStyle.Dots, Group = "Market Sessions|Sydney Session")]
        public LineStyle SydneyBoxLineType { get; set; }
        [Parameter("Sydney Box Line Thickness", DefaultValue = 1, Group = "Market Sessions|Sydney Session")]
        public int SydneyThickness { get; set; }

        [Parameter("Asia Session Active", DefaultValue = true, Group = "Market Sessions|Asia Session")]
        public bool AsiaSessionActive { get; set; }
        [Parameter(DefaultValue = "00:00", Group = "Market Sessions|Asia Session")]
        public string Asia { get; set; }
        [Parameter(DefaultValue = 8, Group = "Market Sessions|Asia Session")]
        public int AsiaHour { get; set; }
        [Parameter("Asia Color", DefaultValue = "LightYellow", Group = "Market Sessions|Asia Session")]
        public Color AsiaFillColor { get; set; }
        [Parameter("Asia Fill zone", DefaultValue = false, Group = "Market Sessions|Asia Session")]
        public bool AsiaOpacity { get; set; }
        [Parameter("Asia Box Line Type", DefaultValue = LineStyle.Dots, Group = "Market Sessions|Asia Session")]
        public LineStyle AsiaBoxLineType { get; set; }
        [Parameter("Asia Box Line Thickness", DefaultValue = 1, Group = "Market Sessions|Asia Session")]
        public int AsiaThickness { get; set; }

        [Parameter("London Session Active", DefaultValue = true, Group = "Market Sessions|London Session")]
        public bool LondonSessionActive { get; set; }
        [Parameter(DefaultValue = "08:00", Group = "Market Sessions|London Session")]
        public string London { get; set; }
        [Parameter(DefaultValue = 9, Group = "Market Sessions|London Session")]
        public int LondonHour { get; set; }
        [Parameter("London Fill Color", DefaultValue = "LightGreen", Group = "Market Sessions|London Session")]
        public Color LondonFillColor { get; set; }
        [Parameter("London Fill", DefaultValue = false, Group = "Market Sessions|London Session")]
        public bool LondonOpacity { get; set; }
        [Parameter("London Box Line Type", DefaultValue = LineStyle.Dots, Group = "Market Sessions|London Session")]
        public LineStyle LondonBoxLineType { get; set; }
        [Parameter("London Box Line Thickness", DefaultValue = 1, Group = "Market Sessions|London Session")]
        public int LondonThickness { get; set; }

        [Parameter("New York Session Active", DefaultValue = true, Group = "Market Sessions|New York Session")]
        public bool NewYorkSessionActive { get; set; }
        [Parameter(DefaultValue = "14:00", Group = "Market Sessions|New York Session")]
        public string NewYork { get; set; }
        [Parameter(DefaultValue = 8, Group = "Market Sessions|New York Session")]
        public int NewYorkHour { get; set; }
        [Parameter("New York  Color", DefaultValue = "LightCoral", Group = "Market Sessions|New York Session")]
        public Color NewYorkFillColor { get; set; }
        [Parameter("New York Filled zone", DefaultValue = false, Group = "Market Sessions|New York Session")]
        public bool NewYorkOpacity { get; set; }
        [Parameter("New York Box Line Type", DefaultValue = LineStyle.Dots, Group = "Market Sessions|New York Session")]
        public LineStyle NewYorkBoxLineType { get; set; }

        [Parameter("New York Box Line Thickness", DefaultValue = 1, Group = "Market Sessions|New York Session")]
        public int NewYorkThickness { get; set; }

        [Parameter(DefaultValue = 250)]
        public int Opacity { get; set; }

        // store last Session Start and Session End
        public DateTime syStart;
        public DateTime syEnd;
        public DateTime asStart;
        public DateTime asEnd;
        public DateTime ldStart;
        public DateTime ldEnd;
        public DateTime usStart;
        public DateTime usEnd;

        protected override void Initialize()
        {
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            var dateTime = Bars.OpenTimes[index];
            List<Box> boxs = Sbox(index);
            for (int i = 0; i < boxs.Count; i++)
            {
                var box = boxs[i];
                double[] high_low = BoxHighLow(index, box);
                DrawBox(box.label, box.left, box.right, high_low[0], high_low[1], box.clr, box.filled, box.lineStyle, box.thickness, box.name);
            }

        }

        // box calcuate logic
        public List<Box> Sbox(int index)
        {
            List<Box> boxs = new List<Box>();
            DateTime current = Bars.OpenTimes[index];
            string syStartHour = Sydney.Split('-')[0].Split(':')[0];
            string syStartMinute = Sydney.Split('-')[0].Split(':')[1];

            string asStartHour = Asia.Split('-')[0].Split(':')[0];
            string asStartMinute = Asia.Split('-')[0].Split(':')[1];

            string euroStartHour = London.Split('-')[0].Split(':')[0];
            string euroStartMinute = London.Split('-')[0].Split(':')[1];

            string usStartHour = NewYork.Split('-')[0].Split(':')[0];
            string usStartMinute = NewYork.Split('-')[0].Split(':')[1];

            if (current.Hour == Int32.Parse(syStartHour) && current.Minute == Int32.Parse(syStartMinute) && SydneySessionActive)
            {
                syStart = current;
                syEnd = current.DayOfWeek == DayOfWeek.Friday ? current.AddHours(SydneyHour + 48) : current.AddHours(SydneyHour);
            }
            if (current.Hour == Int32.Parse(asStartHour) && current.Minute == Int32.Parse(asStartMinute) && AsiaSessionActive)
            {
                asStart = current;
                asEnd = current.AddHours(AsiaHour);
            }
            if (current.Hour == Int32.Parse(euroStartHour) && current.Minute == Int32.Parse(euroStartMinute) && LondonSessionActive)
            {
                ldStart = current;
                ldEnd = current.AddHours(LondonHour);
            }
            if (current.Hour == Int32.Parse(usStartHour) && current.Minute == Int32.Parse(usStartMinute) && NewYorkSessionActive)
            {
                usStart = current;
                usEnd = current.AddHours(NewYorkHour);
            }

            if (current >= syStart && current <= syEnd && SydneySessionActive)
            {
                boxs.Add(new Box(syStart.ToString(), syStart, syEnd, Color.FromArgb(Opacity, SydneyFillColor), SydneyOpacity, SydneyBoxLineType, SydneyThickness, "Sydney\n"));
            }

            if (current >= asStart && current <= asEnd && AsiaSessionActive)
            {
                boxs.Add(new Box(asStart.ToString(), asStart, asEnd, Color.FromArgb(Opacity, AsiaFillColor), AsiaOpacity, AsiaBoxLineType, AsiaThickness, "Asia\n"));
            }

            if (current >= ldStart && current <= ldEnd && LondonSessionActive)
            {
                boxs.Add(new Box(ldStart.ToString(), ldStart, ldEnd, Color.FromArgb(Opacity, LondonFillColor), LondonOpacity, LondonBoxLineType, LondonThickness, "London\n"));
            }
            if (current >= usStart && current <= usEnd && NewYorkSessionActive)
            {
                boxs.Add(new Box(usStart.ToString(), usStart, usEnd, Color.FromArgb(Opacity, NewYorkFillColor), NewYorkOpacity, NewYorkBoxLineType, NewYorkThickness, "NewYork\n"));
            }
            return boxs;



        }

        // calculate session High Low
        private double[] BoxHighLow(int index, Box box)
        {
            DateTime left = box.left;
            double[] high_low = new double[2]
            {
                Bars.HighPrices[index],
                Bars.LowPrices[index]
            };
            while (Bars.OpenTimes[index] >= left)
            {
                high_low[0] = Math.Max(high_low[0], Bars.HighPrices[index]);
                high_low[1] = Math.Min(high_low[1], Bars.LowPrices[index]);
                index--;
            }
            return high_low;
        }

        // draw session box
        private void DrawBox(String label, DateTime left, DateTime right, Double high, Double low, Color clr, bool isfilled, LineStyle lineStyle, int thickness, string name)
        {
            var text = Chart.DrawText(label + name, name, left, high, clr);
            text.VerticalAlignment = VerticalAlignment.Top;
            Chart.DrawRectangle(label, left, high, right, low, clr, thickness, lineStyle).IsFilled = isfilled;
        }

        // box data struct
        public struct Box
        {
            public string label;
            public DateTime left;
            public DateTime right;
            public Color clr;
            public bool filled;
            public LineStyle lineStyle;
            public int thickness;
            public string name;

            public Box(string label, DateTime left, DateTime right, Color clr, bool filled, LineStyle lineStyle, int thickness, string name)
            {
                this.label = label;
                this.left = left;
                this.right = right;
                this.clr = clr;
                this.filled = filled;
                this.lineStyle = lineStyle;
                this.thickness = thickness;
                this.name = name;
            }
        }
    }
}
YE
YesOrNot2 · 3 months ago

Nice Indicator ! 

I see 2 errors :
 

  1. Impossible to load all period : Probleme on the 
  2. The last sydney load doesn't work
  3. error on sydney fil : add at line 155 : rect.IsFilled = opacity;

the log print : 07/08/2024 03:37:47.018 | Crashed in Calculate with ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: y1. Actual value was: NaN.

for info : utc +2

Nice day

 

 

YE
YesOrNot2 · 3 months ago

Here's exactly what cTrader needed. Great job ! Thx

YE
YesOrNot2 · 6 months ago

Thank you for the support!

sherlock828r If needed, I am available on Telegram. =)