FOR IMMEDIATE RELEASE
(Functionality Update) - Added 'BOTH' setting to the "Engulfing Setting", this setting allows for both types of engulfing setups to be recognized simultaneously instead of choosing one or the other.
(Default Setting Change) - This Engulfing Setting has also had its default value to be set to 'BODY' and reflects the usual way patterns may be identified as 'Engulfing' instead. This may change how this script behaves, as certain patterns recognized before may change.
(Tolerances Adjusted) - The max value for one tolerance has been adjusted: Open/Close Tolerance (3 Candlesticks) (from 0.10 -> 0.35)
(New Functionality) - Input Error Handling: This removes certain global variables placed to handle certain problematic input. This script will now throw an error if the values set for maximum and minimum wick lengths of the Ladder Bottom's 4th candle are inverted. Additionally, other error handling includes problematic input with the 'FROM APPEARANCE' P/L Offset which restricts the use of P/L calculations until after the number of confirmation candles has passed (effectively P/L Sample Length must be > the Max-To-Breakout input by at least 1 to run properly). May change in the future.
(Patterns Affected) - Bullish/Bearish and Last Top/Bottom engulfing patterns, Three Inside/Outside Up/Down patterns, and the Ladder Bottom.
(Hotfix - BREAKOUT mode) - This hotfix changes the linked-list object which kept track of all confirmed objects into a var array that will queue and dequeue items from the array when: They have been confirmed, and they have reached the end of their P/L lifespan. This was necessary because linked-lists currently do not work in Pine as I thought they originally had (from a UDT perspective). I discovered that UDTs may not pass-by-reference, meaning their contents may not change when passed to a function meant to change those contents. The work around instead was to keep track of the number of candles that remain in a pattern that's been confirmed, and decrement this value on each passing candle. When this value is 0, the P/L calculation is conducted and appended to the set of returns for that pattern. This now allows multiple patterns to be confirmed on the same candle and have their returns placed at the same time (albeit this causes duplicate returns to be added into the matrix of returns for more than one pattern when the P/L Offset is 'FROM CONFIRMATION').
The end result is that the returns for all patterns are now properly kept track of in BREAKOUT mode, whereas before there were some returns which may have been skipped over, potentially causing the statistics presented for patterns to not be representative of the set of returns for those patterns. BREAKOUT mode should now work as intended.