You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prior to 1.1.0 the Movement patterns where partially implemented within the Hexital/Indicator class's, the purpose was to make it very easy to call/use them, E.G:
we could easily call the "above" movement method for two indicators as follows.
However this was removed in 1.1.0 due to the fact everytime a new movement/pattern was added the Hexital and Indicator class would need to implement the method as well, this would quickly become a hassle and extremely messy. However now to do the same movement call is as follows:
from hexital.analysis import movement
strategy = Hexital("Test strategy", candles, [EMA(), SMA()])
strategy.calculate()
movement.above(strategy.candles(), "EMA_10", "SMA_10")
or worse with timeframes:
from hexital.analysis import movement
strategy = Hexital("Test strategy", candles, [EMA(timeframe="T5"), SMA(timeframe="T5")])
strategy.calculate()
movement.above(strategy.candles("T5"), "EMA_10_T5", "SMA_10_T5")
A new approach is needed to find some middle ground between the two. The user simplicity of it existing within Hexital/Indicator and the maintainability of it being external.
The text was updated successfully, but these errors were encountered:
1: Using Python's getattr to hack Movements/patterns into Hexital/Indicator. Essentially Having them check if a pattern or movement named the given indicator exist and then calling them. This is fairly hacky and wont support typing or IDE type hinting, could also be a pain to debug.
2: Update Movement/Patterns argument to accept List[Candles] | Indicator | Hexital. Where it can call the previous method _verify_indicators to find and verify the List[Candles] for the given indicators.
from hexital.analysis import movement
strategy = Hexital("Test strategy", candles, [EMA(timeframe="T5"), SMA(timeframe="T5")])
strategy.calculate()
movement.above(strategy, "EMA_10_T5", "SMA_10_T5")
Prior to 1.1.0 the Movement patterns where partially implemented within the Hexital/Indicator class's, the purpose was to make it very easy to call/use them, E.G:
we could easily call the "above" movement method for two indicators as follows.
However this was removed in 1.1.0 due to the fact everytime a new movement/pattern was added the Hexital and Indicator class would need to implement the method as well, this would quickly become a hassle and extremely messy. However now to do the same movement call is as follows:
or worse with timeframes:
A new approach is needed to find some middle ground between the two. The user simplicity of it existing within Hexital/Indicator and the maintainability of it being external.
The text was updated successfully, but these errors were encountered: