Category Oscilators  Published on 03/04/2023

Ehlers Better Sinewave

Description

Ehlers Better Sinewave (see Ehlers book).

SourceType:

  • HL2: (High + Low) / 2
  • HLC3: (High + Low + Close) / 3
  • Close
  • Custom: selectable source.

CustomSource: the source to be used if SourceType is Custom.

LPPeriod, HPPeriod: Low and High pass period.

The Better Sinewave indicator is a quite stable indicator. According to Ehlers, Sell when the wave go to -1, and ride the trend while it still staying at -1, vice versa for Buy.

Adjust LPPeriod, HPPeriod to get faster/slower response.


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;
using LittleTrader;
using LittleTrader.Ehlers;
using LittleTrader.Extensions;

namespace cAlgo
{
    [Indicator(AccessRights = AccessRights.None)]
    public class LT_Ind_EhlersBetterSinewave : Indicator
    {
        [Parameter("SourceType", DefaultValue = SourceTypes.HL2)]
        public SourceTypes SourceType { get; set; }
        [Parameter("CustomSource")]
        public DataSeries CustomSource { get; set; }

        [Parameter("LPPeriod", DefaultValue = 10)]
        public int LPPeriod { get; set; }
        [Parameter("HPPeriod", DefaultValue = 40)]
        public int HPPeriod { get; set; }

        [Output("Wave", LineColor = "Purple")]
        public IndicatorDataSeries Wave { get; set; }

        EhlersEvenBetterSinewaveFilter _betterSine;

        protected override void Initialize()
        {
            var u = new IndUtils() { Bars = Bars, SourceType = SourceType, CustomSource = CustomSource };
            _betterSine = new EhlersEvenBetterSinewaveFilter(u.GetSource(), Wave, CreateDataSeries, LPPeriod, HPPeriod);
        }

        public override void Calculate(int index)
        {
            _betterSine.Calculate(index);
        }
    }
}

dhnhuy's avatar
dhnhuy

Joined on 03.04.2023

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: LT_Ind_EhlersBetterSinewave.algo
  • Rating: 0
  • Installs: 447
Comments
Log in to add a comment.
RO
rogifew244 · 1 year ago


Very useful post! This article provides better information. Bluegreenonline Login