Used find doji/pinbars after a Big candle showing the potential Morning/Evening star formation after x amount of consecutive up moves.
1. Doji Threshold (dojiThreshold) What is a Doji?: A doji is a candlestick pattern where the opening and closing prices are very close to each other. It represents indecision in the market. Threshold Explanation: The dojiThreshold is used to define what qualifies as a doji by comparing the size of the candle's body (the difference between the opening and closing prices) to the total range of the candle (the difference between the high and low prices). How it works: The formula in the script checks if the absolute difference between the close and open is less than or equal to a percentage of the entire candle's range. Example: If the dojiThreshold is set to 0.1 (or 10%), this means that for a candle to be considered a doji, the size of the body (the difference between the open and close) must be 10% or less of the total candle's range (the difference between the high and low prices). In other words, if the body is small enough (based on the threshold), the candle is considered a doji. 2. Pinbar Body Size (pinbarBodySize) What is a Pinbar?: A pinbar (short for "pinocchio bar") is a candlestick pattern with a small body and a long wick (or shadow) on one side, indicating a potential reversal. The longer wick represents a rejection of a certain price level. Body Size Explanation: The pinbarBodySize defines the maximum proportion of the candle's total range that the body can occupy for the candle to be considered a pinbar. How it works: The script compares the size of the body to the total range of the candle. Example: If pinbarBodySize is set to 0.3 (or 30%), the body of the candle must be 30% or less of the total range for it to be considered a pinbar. This ensures that the candle has a small body and, therefore, a relatively long wick on one side. The script then checks whether the longer wick is on the upper or lower side of the candle to determine if it's a valid pinbar pattern. Summary: Doji: The dojiThreshold parameter sets how close the open and close prices need to be relative to the candle's range for the candle to be considered a doji. Pinbar: The pinbarBodySize parameter sets the maximum size of the body relative to the candle's total range to qualify it as a pinbar. Both of these thresholds are adjustable in the script, allowing you to fine-tune what qualifies as a doji or pinbar based on your trading style and the market conditions you're analyzing.