QQE free

by daemon in category Trend at 31/08/2012
Description

A combination of Exponential Moving Average and Relative Strength Index. Go Long when QQE is rising, exit and sell when QQE is falling and vice versa.

 

 

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.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(AccessRights = AccessRights.None)]
    public class QualitativeQuantitativeE:Indicator
    {
        private int _wildersPeriod;
        private int _startBar;
        private const int SF = 5;
        private ExponentialMovingAverage _ema;
        private ExponentialMovingAverage _emaAtr;
        private ExponentialMovingAverage _emaRsi;
        private RelativeStrengthIndex _rsi;


        private IndicatorDataSeries _atrRsi;

        [Parameter(DefaultValue = 14)]
        public int Period { get; set; }

        [Output("Main", Color = Colors.Green)]
        public IndicatorDataSeries Result { get; set; }

        [Output("Signal", Color = Colors.Red, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries ResultS { get; set; }

        [Output("Upper", Color = Colors.Gray, LineStyle = LineStyle.DotsRare)]
        public IndicatorDataSeries Upper { get; set; }

        [Output("Lower", Color = Colors.Gray, LineStyle = LineStyle.DotsRare)]
        public IndicatorDataSeries Lower { get; set; }

        [Output("Middle", Color = Colors.Gray, LineStyle = LineStyle.DotsRare)]
        public IndicatorDataSeries Middle { get; set; }

        protected override void Initialize()
        {
            
            _atrRsi = CreateDataSeries();
            CreateDataSeries();

            _wildersPeriod = Period*2 - 1;
            _startBar = _wildersPeriod < SF ? SF : _wildersPeriod;

            _rsi = Indicators.RelativeStrengthIndex(MarketSeries.Close, Period);
            _emaRsi = Indicators.ExponentialMovingAverage(_rsi.Result, SF);
            _emaAtr = Indicators.ExponentialMovingAverage(_atrRsi, _wildersPeriod);
            _ema = Indicators.ExponentialMovingAverage(_emaAtr.Result, _wildersPeriod);

        }

        public override void Calculate(int index)
        {
            Result[index] = _emaRsi.Result[index]; 

            if (index <= _startBar)
            {
                ResultS[index] = 0;
                return;
            }

            _atrRsi[index] = Math.Abs(Result[index - 1] - Result[index]);
            
            double tr = ResultS[index - 1];

            if (Result[index] < ResultS[index - 1])
            {
                tr = Result[index] + _ema.Result[index] * 4.236;

                if (Result[index - 1] < ResultS[index - 1] && tr > ResultS[index - 1]) 
                    tr = ResultS[index - 1];
            }
            else if (Result[index] > ResultS[index - 1])
            {
                tr = Result[index] - _ema.Result[index] * 4.236;

                if (Result[index - 1] > ResultS[index - 1] && tr < ResultS[index - 1]) 
                    tr = ResultS[index - 1];
            }

            ResultS[index] = tr;
            
            Upper[index] = 70;
            Lower[index] = 30;
            Middle[index] = 50;
        }
    }
}
Comments

7blackdb - November 24, 2020 @ 03:24

I read up on this indicator prior to using, I went live straight away having done my DD, had confidence to use. My first trade picked 174 pips XUAUSD (GOLD). Subsequent trades have been gained (and lost), though smaller 20 to 30 pip range, that was all the moves gave anyway before retreating. I draw trend lines as well as support and resistance levels on the indicator in conjunction with the same on price chart searching for breaks with price action for entry and again for exit. Also a divergence spotter. Versatile indicator. 

firemyst - December 15, 2022 @ 14:44

_atrRsi is never used. Why is it declared? In the "Calculate" method it is assigned to, but it has no output, and affects no other calculations.

Also, you have another bug - just a line "CreateDataSeries()" that does nothing in the "Initiate" method.

 

firemyst - December 16, 2022 @ 07:31

Stupid me. I understand what you're doing with the _atrRsi now. My bad on that one.

I still don't understand why you have a "CreateDataSeries()" on a line by itself.

5