Category Other  Published on 20/06/2019

Hosoda Waves

Description

Follow my cTrader Telegram group at https://t.me/cTraderCommunity; it's a new community but it will grow fast, plus everyone can talk about cTrader indicators and algorithm without restrictions, though it is not allowed to spam commercial indicators to sell them.

This indicator is used to draw Hosoda's Waves to determine possible target for strategies based on ichimoku.

If you don't know how to use Ichimoku with the Hosoda's strategy, join the group linked above and if someone is willing to spend some time with you you might learn something new ;).

Use shift + click to determine the 3 point to draw the wave.


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 HosodaWaves : Indicator
    {

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        public onda wav = new onda();

        protected override void Initialize()
        {
            Chart.MouseDown += OnChartMouseDown;
        }

        void OnChartMouseDown(ChartMouseEventArgs obj)
        {

            if (obj.ShiftKey && !obj.AltKey && !obj.CtrlKey)
            {
                if (!wav.isA)
                {
                    wav.xa = (int)obj.BarIndex;
                    wav.ya = 0;
                    wav.isA = true;
                }
                else if (!wav.isB)
                {
                    wav.xb = (int)obj.BarIndex;
                    wav.yb = MarketSeries.Close[wav.xa] < MarketSeries.Close[wav.xb] ? MarketSeries.High[wav.xb] : MarketSeries.Low[wav.xb];
                    wav.isB = true;
                    wav.ya = MarketSeries.Close[wav.xa] < MarketSeries.Close[wav.xb] ? MarketSeries.Low[wav.xa] : MarketSeries.High[wav.xa];
                }
                else if (!wav.isC)
                {
                    wav.xc = (int)obj.BarIndex;
                    wav.yc = wav.yb == MarketSeries.High[wav.xb] ? MarketSeries.Low[wav.xc] : MarketSeries.High[wav.xc];
                    wav.isC = true;
                    drawWave();
                }

            }
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = ...
        }

        public void drawWave()
        {
            Chart.DrawTrendLine("AB", wav.xa, wav.ya, wav.xb, wav.yb, Color.White);
            Chart.DrawTrendLine("BC", wav.xb, wav.yb, wav.xc, wav.yc, Color.White);
            Chart.DrawHorizontalLine("V", wav.yb * 2 - wav.yc, Color.White);
            Chart.DrawHorizontalLine("N", wav.yc - wav.ya + wav.yb, Color.White);
            Chart.DrawHorizontalLine("E", wav.yb * 2 - wav.ya, Color.White);
            Chart.DrawHorizontalLine("NT", wav.yc * 2 - wav.ya, Color.White);

            //Print(wav);
            wav.reset();
        }
    }

    public class onda
    {
        public bool isA = false;
        public bool isB = false;
        public bool isC = false;

        public double ya, yb, yc;
        public int xa, xb, xc;

        public onda()
        {

        }

        public void setA(int xa, double ya)
        {
            this.xa = xa;
            this.ya = ya;
        }

        public void setB(int xb, double yb)
        {
            this.xb = xb;
            this.yb = yb;
        }

        public void setC(int xc, double yc)
        {
            this.xc = xc;
            this.yc = yc;
        }

        public void reset()
        {
            this.isA = false;
            this.isB = false;
            this.isC = false;
        }

    }
}


CY
cysecsbin.01

Joined on 10.11.2018 Blocked

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: HosodaWaves.algo
  • Rating: 0
  • Installs: 1769
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
No comments found.