Skip to content

Commit

Permalink
Merge pull request #12 from joshyattridge/clean_up_returned_data
Browse files Browse the repository at this point in the history
Major Improvements and Structure changes
  • Loading branch information
joshyattridge authored Mar 7, 2024
2 parents 4347d84 + aee17ff commit e09adc3
Show file tree
Hide file tree
Showing 5 changed files with 428 additions and 457 deletions.
105 changes: 86 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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 built using Python, a versatile programming language known for its data analysis and visualization capabilities.

![alt text](https://github.com/joshyattridge/smart-money-concepts/blob/21656dd807c4077f345b6cbf29b1bc37672628e9/tests/test_binance.png)

## Installation

```bash
Expand All @@ -20,35 +22,100 @@ smc expects properly formated ohlc DataFrame, with column names in lowercase: ["

## Indicators

- FVG - Fair Value Gap
- Highs and Lows
- Swing Tops and Bottoms
- BOS and CHoCH
- OB - Order Block
- VOB - Volumized Order Blocks
- Liquidity
### Fair Value Gap (FVG)

```python
smc.fvg(ohlc)
```

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.

## Examples
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

Please take a look at smc.test.py for more detailed examples on how each indicator works.
### Swing Highs and Lows

```python
smc.fvg(ohlc) # Fair Value Gap
smc.highs_lows(ohlc) # Highs and Lows
smc.swing_tops_bottoms(ohlc, swing_length=10) # Swing Tops and Bottoms
smc.bos_choch(ohlc, close_break=True, filter_liquidity=False) # Detect BOS and CHoCH
smc.ob(ohlc) # Order Block
smc.vob(ohlc) # Volumized Order Blocks
smc.liquidity(ohlc) # Liquidity
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)

```python
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)

```python
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

```python
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

## 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.

1. Fork it (https://github.com/joshyattridge/smartmoneyconcepts/fork).
2. Study how it's implemented.
3. Create your feature branch (git checkout -b my-new-feature).
5. Commit your changes (git commit -am 'Add some feature').
6. Push to the branch (git push origin my-new-feature).
7. Create a new Pull Request.
4. Commit your changes (git commit -am 'Add some feature').
5. Push to the branch (git push origin my-new-feature).
6. Create a new Pull Request.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import codecs
import os

VERSION = '0.0.14'
VERSION = '0.0.15'
DESCRIPTION = 'Getting indicators based on smart money concepts or ICT'

# read the contents of the README file
Expand All @@ -18,7 +18,7 @@
long_description_content_type="text/markdown",
long_description=LONG_DESCRIPTION,
packages=["smartmoneyconcepts"],
install_requires=["pandas==2.0.2", "numpy==1.24.3", "zigzag", "finta==1.3"],
install_requires=["pandas==2.0.2", "numpy==1.24.3"],
keywords=['smart', 'money', 'concepts', 'ict', 'indicators', 'trading', 'forex', 'stocks', 'crypto', 'order', 'blocks', 'liquidity'],
url="https://github.com/joshyattridge/smartmoneyconcepts",
classifiers=[
Expand Down
Loading

0 comments on commit e09adc3

Please sign in to comment.