Repository navigation
feat: add SSL Channel (Securement Stop Loss Channel) (#119) - #210
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #119.
Summary
This PR adds support for SSL Channel (Securement Stop Loss Channel) as first-class indicator columns in
StockDataFrame.Features
SSL Channel:
sma_high = SMA(high, window)sma_low = SMA(low, window)hlv[i] = 1 if close[i] > sma_high[i] else (-1 if close[i] < sma_low[i] else hlv[i-1])ssl_down = sma_high if hlv < 0 else sma_lowssl_up = sma_low if hlv < 0 else sma_highdf['ssl'](defaults tossl_up),df['ssl_up'],df['ssl_down'].df['ssl_up_5'],df['ssl_down_5'],df['ssl_14']).df['ssl_up_xu_ssl_down']for bullish crossover,df['ssl_up_xd_ssl_down']for bearish crossunder).StockDataFrame.ssl_channel(high, low, close, window).Configuration & Handler:
"ssl": 10,"ssl_up": 10,"ssl_down": 10to_dft_windows.("ssl", "ssl_up", "ssl_down"): self._get_sslinself.handler.Verification & Documentation
test.py:test_ssl_channel: Verified against 30-day stock data benchmark, trend flipping verification (20110117), custom window evaluation (ssl_up_5), and crossunder detection (ssl_up_xd_ssl_down).test_ssl_channel_edge_cases: Verified edge cases (empty series, single-element).README.mdSummary table, Introduction list, and Trend section with formula and usage examples.flake8 stockstats.py test.pypassed with 0 errors.