reversal bar free

by d.deel in category Other at 06/01/2021
Description

New Update (21/09/2021) Better  Performance

Indicator has been /* UPGRADED/*, with the option to determine your own period for reversal signals, and a build in zigzag with customable periods 

just a simple indicator to help those who have a hard time entering positions, not necessarily a trend base indicator, it' s recommended to use other indicators as well(add it to your stra)

in this caption other indicators are being used as well(indicators with their rightful owner), also not necessarily recommended 

 

 

 

purple for sell & blue for buy 

 

// if you have any feedbacks leave them in the comment section   

also before use, it is better to set your candle color and outline on transparent 

 

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.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Re_reversalBars : Indicator
    {
        [Parameter("Thickness", Group = "thickness sett", DefaultValue = 3)]
        public int thi { get; set; }
        [Parameter("Bullish", Group = "Colors sett", DefaultValue = "Blue")]
        public string colo1 { get; set; }
        [Parameter("Bearish", Group = "Colors sett", DefaultValue = "Purple")]
        public string colo2 { get; set; }
        [Parameter("others", Group = "Colors sett", DefaultValue = "Black")]
        public string colo3 { get; set; }
        [Parameter("others", Group = "Colors sett", DefaultValue = "Gray")]
        public string colo4 { get; set; }
        [Parameter("Sycle Periode", DefaultValue = 3, MinValue = 0)]
        public int P_periode { get; set; }
        [Parameter("Zigzag Periode", DefaultValue = 7, MinValue = 0)]
        public int Z_zigPeriode { get; set; }


        private int comfirmer_2;
        private DateTime starts;


        protected override void Initialize()
        {
            comfirmer_2 = 1;
        }

        private int Z_zigInitialize()
        {
            int Z_Result = 0;
            double zigHigh = Functions.Maximum(Bars.HighPrices, Z_zigPeriode);
            if (Bars.HighPrices.LastValue >= zigHigh)
                Z_Result = 1;
            else
            {
                double zigLow = Functions.Minimum(Bars.LowPrices, Z_zigPeriode);
                if (Bars.LowPrices.LastValue <= zigLow)
                    Z_Result = -1;
            }
            return Z_Result;
        }



        private DateTime cycle;
        public override void Calculate(int index)
        {
            starts = Bars.OpenTimes[index - 1];
            int i = 1;
            while (i < P_periode)
            {
                if (Bars.OpenTimes[index - i] == cycle)
                    return;
                else
                {
                    Chart.SetBarColor(index - 1, color: colo4);
                }
                i++;
            }

            int zig_ = Z_zigInitialize();
            switch (comfirmer_2)
            {
                case -1:
                    bool T_down = Bars.ClosePrices[index - 1] < Bars.LowPrices[index - 2] && Bars.ClosePrices[index - 1] < Bars.LowPrices[index - 3];
                    if (T_down && zig_ == -1)
                    {
                        cycle = Bars.OpenTimes[index - 1];
                        comfirmer_2 = 1;
                        Chart.SetBarColor(index - 1, color: colo2);
                    }
                    else
                    {
                        if (Bars.HighPrices[index - 1] >= Bars.ClosePrices[index - 2] || Bars.LowPrices[index - 1] <= Bars.ClosePrices[index - 2])
                            Chart.SetBarColor(index - 1, color: colo3);
                    }
                    break;
                case 1:
                    bool T_up = Bars.ClosePrices[index - 1] > Bars.HighPrices[index - 2] && Bars.ClosePrices[index - 1] > Bars.HighPrices[index - 3];
                    if (T_up && zig_ == 1)
                    {
                        cycle = Bars.OpenTimes[index - 1];
                        comfirmer_2 = -1;
                        Chart.SetBarColor(index - 1, color: colo1);
                    }
                    else
                    {
                        if (Bars.HighPrices[index - 1] >= Bars.ClosePrices[index - 2] || Bars.LowPrices[index - 1] <= Bars.ClosePrices[index - 2])
                            Chart.SetBarColor(index - 1, color: colo3);
                    }
                    break;
            }
        }
    }
}
Comments

amirreza.mrz - June 24, 2021 @ 17:54

Hello
First of all, thanks for this great indicator.
Is it possible to add a alarm to it or guide me to do by myself?

d.deel - June 25, 2021 @ 20:38

Hi, thank you amirreza.mrz  

Because of peformance reasons, there will not be an alarm type of systeme

As for personalyze editing in the link bellow, there's a discussion about the subject, or a way

similar on how it can be done

 

https://ctrader.com/forum/cbot-support/5493

 

Place the solution in the "If" statements on the 75th and 89th lines and it should 

normaly be it. :)

amirreza.mrz - June 25, 2021 @ 21:53

Thanks a lot. ;)

ctid2407925 - August 23, 2021 @ 01:09

Hi, Thank you for sharing, there is any post or something that explains the strategy that your indicator follows to mark a buy or sell candle?. Thanks

d.deel - September 21, 2021 @ 07:43

Hi, sorry but there isn't any strategy based on this indicator, but it can help with better viewing of the market, or/and can serve as an indication to enter or close a position depending on the comfigurations you've set

 

PS: this indicator is inspired from a simple video seen on Youtube 

0