Topics

Forum Topics not found

Replies

seba
03 Dec 2013, 09:23

RE: Thanks

jeex said:

Thanks. And the percentage is just an arbitrary number. Or should this be calculated from average candle and body lengths?

Depends on what "figures" you wish to detect as doji for me indicator I created (with default parameter) does the job.


@seba

seba
24 Nov 2013, 13:38

RE:

jeex said:

Does anyone have an algorithm for determining a doji, i.e. a long wick with practicaly no body?
 

You mean something like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC)]
    public class Doji : Indicator
    {
        [Parameter(DefaultValue = 99.99, MinValue = 99, MaxValue = 100)]
        public double Percentage { get; set; }

        [Output("Main", PlotType = PlotType.Points, Color = Colors.Black, Thickness = 1)]
        public IndicatorDataSeries Result { get; set; }


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

        public override void Calculate(int index)
        {
            if (Math.Min(MarketSeries.Open[index], MarketSeries.Close[index]) >= (Percentage / 100) * Math.Max(MarketSeries.Open[index], MarketSeries.Close[index]))
            {
                Result[index] = MarketSeries.Low[index] * 0.9995;
                string o = string.Format("doji{0}", index);
                ChartObjects.DrawText(o, " ˄\r\nDoji", index, Result[index], VerticalAlignment.Center, HorizontalAlignment.Center, Colors.Green);
            }
        }
    }
}


@seba