technical icon indicating copy to clipboard operation
technical copied to clipboard

Trama

Open bkamuz opened this issue 1 year ago • 3 comments

Name : Tradingview "Trend Regularity Adaptive Moving Average"

I've using this indicator for strategy to determine flat market.

It works perfectly, but it seems to me that we can improve it by avoiding this loop operation. But alas, no matter how I tried to use for example numpy vector operations - no success. Maybe someone will have some thoughts on this? Thank you.q

bkamuz avatar Apr 25 '23 15:04 bkamuz

It works perfectly, but it seems to me that we can improve it by avoiding this loop operation. But alas, no matter how I tried to use for example numpy vector operations - no success. Maybe someone will have some thoughts on this? Thank you.

The moment you have point at time i depend on i-1, your only option is usually to loop, as the prior point directly influences the current datapoint.

Potentially, pandas' rolling() feature can help with this, and would probably be a safer option to support different usecases, as this will effectively have an indefinite lookback, as it's an expanding window starting with the very first candle. Now the influence of the very first candle will decrease significantly over time - but in theory, you can still see a (very small, potentially disappearing due to float representation) difference 200 or 2000 candles into the dataframe by simply modifying the very first candle

xmatthias avatar Apr 25 '23 16:04 xmatthias

Please run black locally - it'll auto-fix the errors CI is pointing out ;)

xmatthias avatar May 03 '23 14:05 xmatthias

Hi, sorry this took a while, finally had some time to look at this

Comparing the values to tradingview, it doesn't seem to fully align. For example right before the long, red candle, this indicator is touching the green candle - but the tradingview one isn't.

are you sure the algorithm is corresponding to the tradingview variant?

image

image

xmatthias avatar May 26 '23 05:05 xmatthias