Install smartmoneyconcepts via pip
masterInstall the smartmoneyconcepts library using pip to access ICT-inspired financial indicators.
pip install smartmoneyconceptsrepository·master·Indexed 23 days ago
https://github.com/joshyattridge/smart-money-conceptsA Python library providing technical indicators inspired by Inner Circle Trader (ICT) concepts. It includes tools for detecting Order Blocks, Fair Value Gaps (FVG), Market Structure shifts (BOS and CHoCH), Swing Highs and Lows, Liquidity levels, and Trading Sessions. The library operates on pandas DataFrames containing OHLC data.
Install the smartmoneyconcepts library using pip to access ICT-inspired financial indicators.
pip install smartmoneyconceptsThe smc module expects a pandas DataFrame containing properly formatted OHLC (Open, High, Low, Close) data.
Requirements:
["open", "high", "low", "close"]."volume" column.By default, the library prints a credit message upon import. You can suppress this by setting the SMC_CREDIT environment variable to 0 before importing the library.
export SMC_CREDIT=0Identifies shifts in market structure.
Parameters:
ohlc (DataFrame): The input OHLC data.swing_highs_lows (DataFrame): The DataFrame output from the smc.swing_highs_lows() function.close_break (bool): If True, the break is determined by the candle's close. If False, it is determined by the candle's high/low.Returns (DataFrame columns):
BOS: 1 if bullish break of structure, -1 if bearish break of structure.CHOCH: 1 if bullish change of character, -1 if bearish change of character.Level: The price level of the BOS or CHoCH.BrokenIndex: The index of the candle that broke the level.Detects price ranges where significant market orders are suspected to exist.
Parameters:
ohlc (DataFrame): The input OHLC data.swing_highs_lows (DataFrame): The DataFrame output from the smc.swing_highs_lows() function.close_mitigation (bool): If True, the order block is considered mitigated based on the candle close; otherwise, it uses the high/low.Returns (DataFrame columns):
OB: 1 if bullish order block, -1 if bearish order block.Top: Top of the order block.Bottom: Bottom of the order block.OBVolume: Volume calculated as volume + 2 last volumes amounts.Percentage: Strength of the order block (min(highVolume, lowVolume)/max(highVolume,lowVolume)).Calculates the percentage of retracement from recent swing highs or lows.
Parameters:
ohlc (DataFrame): The input OHLC data.swing_highs_lows (DataFrame): The DataFrame output from the smc.swing_highs_lows() function.Returns (DataFrame columns):
Direction: 1 if bullish retracement, -1 if bearish retracement.CurrentRetracement%: The current retracement percentage from the swing high or low.DeepestRetracement%: The deepest retracement percentage recorded from the swing high or low.smc.retracements(ohlc, swing_highs_lows)Identifies local price extremes based on a lookback/lookahead window.
Parameters:
ohlc (DataFrame): The input OHLC data.swing_length (int): The number of candles to look at before and after the current candle to determine if it is a swing point.Returns (DataFrame columns):
HighLow: 1 if a swing high, -1 if a swing low.Level: The price level of the swing high or low.Retrieves the high and low prices from a specified previous timeframe.
Parameters:
ohlc (DataFrame): The input OHLC data.time_frame (str): The timeframe to reference. Supported values: 15m, 1H, 4H, 1D, 1W, 1M.Returns (DataFrame columns):
PreviousHigh: The high of the previous timeframe.PreviousLow: The low of the previous timeframe.BrokenHigh: 1 if price has broken the previous high, 0 otherwise.BrokenLow: 1 if price has broken the previous low, 0 otherwise.Detects Fair Value Gaps where a price imbalance exists between candles.
Parameters:
ohlc (DataFrame): The input OHLC data.join_consecutive (bool): If True, multiple consecutive FVGs are merged into one using the highest top and lowest bottom.Returns (DataFrame columns):
FVG: 1 if bullish FVG, -1 if bearish FVG.Top: The top price level of the gap.Bottom: The bottom price level of the gap.MitigatedIndex: The index of the candle that mitigated the gap.smc.fvg(ohlc, join_consecutive=False)Determines which candles fall within specific trading sessions or kill zones.
Parameters:
ohlc (DataFrame): The input OHLC data.session (str): The session name. Options: Sydney, Tokyo, London, New York, Asian kill zone, London open kill zone, New York kill zone, london close kill zone, or Custom.start_time (str): Required only for Custom sessions. Format: "HH:MM".end_time (str): Required only for Custom sessions. Format: "HH:MM".time_zone (str): The timezone of the candles (e.g., "UTC+0" or "GMT+0"). Defaults to "UTC".Returns (DataFrame columns):
Active: 1 if the candle is within the session, 0 otherwise.High: The highest price point reached during the session.Low: The lowest price point reached during the session.Identifies areas where multiple highs or lows exist within a tight price range.
Parameters:
ohlc (DataFrame): The input OHLC data.swing_highs_lows (DataFrame): The DataFrame output from the smc.swing_highs_lows() function.range_percent (float): The percentage of the range used to determine if highs/lows are close enough to be considered liquidity.Returns (DataFrame columns):
Liquidity: 1 if bullish liquidity, -1 if bearish liquidity.Level: The price level of the liquidity.End: The index of the last liquidity level.Swept: The index of the candle that swept the liquidity.