Wick Doji or not
Wick Doji or not
20 Nov 2013, 12:26
Does anyone have an algorithm for determining a doji, i.e. a long wick with practicaly no body?
Replies
jeex
20 Nov 2013, 12:45
Stats
Over the past years, on the H1 timeframe (over 17,000 candles), the average candle length was 0.00221. The average body length was 0.00107 = 44% of the candle, with a standard deviation of 0.00114 (candle) to 0.00084 (body) = 22%. So simply measured a candle where the body is less then 44% - 22% = 22% of the candle can be considered as an abnormal body-candle ratio = a doji.
Or am i missing something here? Maybe also consider the length of the candle in comparison whith the rest? Use the ATR in this?
@jeex
hichem
20 Nov 2013, 12:54
RE: Stats
I think one should compare the upper part of the wick, the lower part of the wick and the body of the candle to calculate the ratio.
jeex said:
Over the past years, on the H1 timeframe (over 17,000 candles), the average candle length was 0.00221. The average body length was 0.00107 = 44% of the candle, with a standard deviation of 0.00114 (candle) to 0.00084 (body) = 22%. So simply measured a candle where the body is less then 44% - 22% = 22% of the candle can be considered as an abnormal body-candle ratio = a doji.
Or am i missing something here? Maybe also consider the length of the candle in comparison whith the rest? Use the ATR in this?
@hichem
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
Storm31
06 Jul 2017, 18:20
RE: Pip Count Code
Hi Seba
I know it was a few years back that you posted this code for a very helpful indicator, thank you. Could you please help with a small change to the code so that the pip count shows the entire range of the candle from high to low? I believe now that it cclculates only the body.
Thanks in advance for your help.
Kind regards
seba said:
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); } } } }
@Storm31
hichem
20 Nov 2013, 12:35
RE:
I think the most direct way to determine that is to calculate the ratio between the wick and the body of the candle. To be more precise one should take into consideration the current TimeFrame.
jeex said:
@hichem