IsDoji ( int length, double bodyFactor);

Default values:

length: 20 bodyFactor: 0.05


Returns true if the current candle is Doji (i.e. its Close price and Open price are equal or almost the same) and false otherwise. Note that a candle is considered Doji if its body height does not exceed average body height multiplied by the specified factor. The average body height is calculated for a specified number of preceding candles.

Input parameters

Parameter Default value Description
length 20 Defines period on which average body height is calculated.
factor 0.05 Defines factor by which the average body height is multiplied.


input length = 25;

def IsDoji = IsDoji(length);
plot ThreeDoji = IsDoji[2] and
IsDoji[1] and


This example marks the last of three consecutive Doji candles. In this case, a candle will be considered Doji if its body height does not exceed 5% (default value) of the average body height calculated for last 25 candles.