Getting indicators based on smart money concepts or ICT
Project description
Smart Money Concepts (smc) BETA
The Smart Money Concepts Python Indicator is a sophisticated financial tool developed for traders and investors to gain insights into market sentiment, trends, and potential reversals. This indicator is inspired by Inner Circle Trader (ICT) concepts like Order blocks, Liquidity, Fair Value Gap, Swing Highs and Lows, Break of Structure, Change of Character, and more. Please Take a look and contribute to the project.
Installation
pip install smartmoneyconcepts
Usage
from smartmoneyconcepts import smc
Prepare data to use with smc:
smc expects properly formated ohlc DataFrame, with column names in lowercase: ["open", "high", "low", "close"] and ["volume"] for indicators that expect ohlcv input.
Indicators
Fair Value Gap (FVG)
smc.fvg(ohlc, join_consecutive=False)
A fair value gap is when the previous high is lower than the next low if the current candle is bullish. Or when the previous low is higher than the next high if the current candle is bearish.
parameters:
join_consecutive: bool - if there are multiple FVG in a row then they will be merged into one using the highest top and the lowest bottom
returns:
FVG = 1 if bullish fair value gap, -1 if bearish fair value gap
Top = the top of the fair value gap
Bottom = the bottom of the fair value gap
MitigatedIndex = the index of the candle that mitigated the fair value gap
Swing Highs and Lows
smc.swing_highs_lows(ohlc, swing_length = 50)
A swing high is when the current high is the highest high out of the swing_length amount of candles before and after. A swing low is when the current low is the lowest low out of the swing_length amount of candles before and after.
parameters:
swing_length: int - the amount of candles to look back and forward to determine the swing high or low
returns:
HighLow = 1 if swing high, -1 if swing low
Level = the level of the swing high or low
Break of Structure (BOS) & Change of Character (CHoCH)
smc.bos_choch(ohlc, swing_highs_lows, close_break = True)
These are both indications of market structure changing
parameters:
swing_highs_lows: DataFrame - provide the dataframe from the swing_highs_lows function
close_break: bool - if True then the break of structure will be mitigated based on the close of the candle otherwise it will be the high/low.
returns:
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 level of the break of structure or change of character
BrokenIndex = the index of the candle that broke the level
Order Blocks (OB)
smc.ob(ohlc, swing_highs_lows, close_mitigation = False)
This method detects order blocks when there is a high amount of market orders exist on a price range.
parameters:
swing_highs_lows: DataFrame - provide the dataframe from the swing_highs_lows function
close_mitigation: bool - if True then the order block will be mitigated based on the close of the candle otherwise it will be the high/low.
returns:
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 + 2 last volumes amounts
Percentage = strength of order block (min(highVolume, lowVolume)/max(highVolume,lowVolume))
Liquidity
smc.liquidity(ohlc, swing_highs_lows, range_percent = 0.01)
Liquidity is when there are multiply highs within a small range of each other. or multiply lows within a small range of each other.
parameters:
swing_highs_lows: DataFrame - provide the dataframe from the swing_highs_lows function
range_percent: float - the percentage of the range to determine liquidity
returns:
Liquidity = 1 if bullish liquidity, -1 if bearish liquidity
Level = the level of the liquidity
End = the index of the last liquidity level
Swept = the index of the candle that swept the liquidity
Previous High And Low
smc.previous_high_low(ohlc, time_frame = "1D")
This method returns the previous high and low of the given time frame.
parameters:
time_frame: str - the time frame to get the previous high and low 15m, 1H, 4H, 1D, 1W, 1M
returns:
PreviousHigh = the previous high
PreviousLow = the previous low
Sessions
smc.sessions(ohlc, session, start_time, end_time, time_zone = "UTC")
This method returns which candles are within the session specified
parameters:
session: str - the session you want to check (Sydney, Tokyo, London, New York, Asian kill zone, London open kill zone, New York kill zone, london close kill zone, Custom)
start_time: str - the start time of the session in the format "HH:MM" only required for custom session.
end_time: str - the end time of the session in the format "HH:MM" only required for custom session.
time_zone: str - the time zone of the candles can be in the format "UTC+0" or "GMT+0"
returns:
Active = 1 if the candle is within the session, 0 if not
High = the highest point of the session
Low = the lowest point of the session
Retracements
smc.retracements(ohlc, swing_highs_lows)
This method returns the percentage of a retracement from the swing high or low
parameters:
swing_highs_lows: DataFrame - provide the dataframe from the swing_highs_lows function
returns:
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 from the swing high or low
Contributing
This project is still in BETA so please feel free to contribute to the project. By creating your own indicators or improving the existing ones. If you are stuggling to find something to do then please check out the issues tab for requested changes.
- Fork it (https://github.com/joshyattridge/smartmoneyconcepts/fork).
- Study how it's implemented.
- Create your feature branch (git checkout -b my-new-feature).
- Commit your changes (git commit -am 'Add some feature').
- Push to the branch (git push origin my-new-feature).
- Create a new Pull Request.
Disclaimer
This project is for educational purposes only. Do not use this indicator as a sole decision maker for your trades. Always use proper risk management and do your own research before making any trades. The author of this project is not responsible for any losses you may incur.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file smartmoneyconcepts-0.0.24.tar.gz
.
File metadata
- Download URL: smartmoneyconcepts-0.0.24.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.14 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cfb34149824dd013d850e85e44347523941374ac3bf9e534c90ec2f75b9ac43 |
|
MD5 | 4e87234318ce0411e053aba08173dedb |
|
BLAKE2b-256 | e0dbc8f0c84e4f0c66b3dacc3a3a1a9a0c797a18eddc4f395235d990370b33f6 |
File details
Details for the file smartmoneyconcepts-0.0.24-py3-none-any.whl
.
File metadata
- Download URL: smartmoneyconcepts-0.0.24-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.14 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac6a67ee557ad974b13b99128d653b31d604c6351402dc2b7af3dac147cb8e42 |
|
MD5 | 58d5e8683f6b17a74903ee8344cb6c6c |
|
BLAKE2b-256 | 3be1d1f755e3b4ddfae0e9110ccb5c9be9c987989332e856bdc4ea399c1b5101 |