karlwancl / Trady

Trady is a handy library for computing technical indicators, and it targets to be an automated trading system that provides stock data feeding, indicator computing, strategy building and automatic trading. It is built based on .NET Standard 2.0.
https://lppkarl.github.io/Trady
Apache License 2.0
545 stars 185 forks source link

calculate CCI on list<decimal> ??? #90

Open Jiraiyah opened 5 years ago

Jiraiyah commented 5 years ago

Yes, there is a usage for such a thing (calculating CCI on anything other than close value) !!

I wonder if there is a way to do it or not?

I mean, when you look at most of these indicators, they SHOULD accept a list of decimals and not the candles themselves. for example, what if i want to calculate cci based on HLC3 and not the close value?! and again YES, it's a valid technical analysis request and one the things that most professional analyzers do when they use these sort of indicators : calculate them on something OTHER than close !

honestly, this library has GREAT potential, but lacks some very base fundamental concepts that you would sit and think how should i properly use this ! I mean, ok, I can make a temporary list of candles with all values set to the thing i want (open, high, low, close and volume) for example set all of them to HLC3 value, and you are free to go ?! but, that is a huge memory garbage that i am creating to simplify my life and on huge amount of data (in my case doing analysis on over one million candles)........

yes, this library has potentials but lacks basic fundamentals !

if instead of IOHLCV, you would simply accept List in over 90% of your indicators, you would be surprised how easier and surprisingly useful it would become to use this library and expand upon it!

in case you think i'm a guy who don't know what he is talking about.... take a look at my profile in trading view :

https://www.tradingview.com/u/khodakarami/#published-scripts

most of these tools you see, are based on very base concepts like RMA, MACD, TSI, CCI, and sometimes other base indicators.... BUT.... there are HUGE twists here and there ! thinking out of the box, unortodox usage of inputs in formulas gave birth to so many fascinating indicators and results. to achieve this in c#, All you would need to change in Trady.... is to replace that meaningless IOHLCV with list !

you need and example? again.... what if i want to calculate cci on something crazy? lets say the result of rsi formula that uses volume as it's input?

cci(rsi(vol...), ... ), ...)

how can i achieve it with current Trady? well, talking from experience, it's become more and more crazy when i look into my own code ! but if you would accept List and WOULD RETURN the list and result ticks?

then i would be able to easily chain them up !

https://www.tradingview.com/script/MnjHBUO7-Trader-Set-Volume-Candle/

this indicator has 7 different sub types. I could easily use a chained function to get the final within few line of code, but right now, just to get two of the subtypes...... it's near 100 lines !

pavlexander commented 5 years ago

@Jiraiyah Unfortunately I can't comment on the issue that you are having, but I have a question. Are you using some kind of visualization tool for the data generated by Trady?

My biggest "must-have" feature at this point is not a lack of some indicator or a framework architecture. It's the visualization/plotting of the data. I've been wondering how other people are using this library to create charts.

Can you comment on that?

Jiraiyah commented 5 years ago

@Jiraiyah Unfortunately I can't comment on the issue that you are having, but I have a question. Are you using some kind of visualization tool for the data generated by Trady?

My biggest "must-have" feature at this point is not a lack of some indicator or a framework architecture. It's the visualization/plotting of the data. I've been wondering how other people are using this library to create charts.

Can you comment on that?

visualization is not that hard, either use the built in chart component or in my case, use a 3rd party like Nevron Vision or arction Lightning. for visualizing data, each choice has it's own benefits and limits. But bottom line is always the same, you need to first get the data and then use one of the built in types to add the data on the list they have (most of the components i saw has this internal list of points or candles etc.) and the chart component will automatically draw them. so, at the start of the software run, you need to collect historical data, compute everything, generate and assign this list, but after that, you need to get a stream of data, the crypto exchanges i'm working on, have nice websocket api and using them, you will get a stream of candle data, them you can identify if the candle is the recent one and active (not closed) or not. from here, it's your call to either ignore not closed candles and only draw the last finished candle or add this open candle. in case one, you just need to parse and add the data for the new candles at the end of that internal list. on the second case, you need to check if the candle is that last one in the list, if so, update it, if not, update that last info with the last closed candle and add a new entry for unfinished candle.

that is all to it, you just need to choose the component library you want to work with and then learn how it works and it won't take more than few hours to grasp everything about that charting component and move forward.

but let me emphasize something about my request : when you are developing and API like this library, it's a fundamental move to make sure your library's structure, how things work, the completeness of features, and framework architecture is 100% solid before moving forward for anything else.

you want a comparison?

I wrote the code for calculating tsi myself. now, tsi, uses 4 ema internally ! I had to parse the whole history of 1 minute candles for bitmex from 2017 up till last month, the pc was busy for near 5 days non stop !!! when i tried the same thing on python using Pandas library?.... it was done in less than 2 minutes !!!!

that is why i am saying this, make sure everything you are doing is the fastest, most solid way of doing it, else, some time down the road, it will bite you back really hard !