Indicator for Entropy

Questions about MultiCharts and user contributed studies.
User avatar
strelow
Posts: 73
Joined: 20 Dec 2019
Location: Brazil-SP
Has thanked: 13 times
Been thanked: 3 times

Indicator for Entropy

Postby strelow » 27 Sep 2020

Hello

There are any indicator created in easylanguage for entropy ?

I found this site

https://rosettacode.org/wiki/Entropy

I have difficult to translante to easylanguage to create list of probability .

I know this is a thermodinamic formula but I saw some studies using this to measure stock volaty.

Thanks for help.

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Indicator for Entropy

Postby Svetlana MultiCharts » 05 Oct 2020

Hello strelow,

There is no such pre-built indicator in MultiCharts. We found the following PowerLanguage code in the website mentioned by you.

Code: Select all

var: inp ("1223334444"); var: len_inp(StrLen(inp)); var: uniqe_char (""); array:freq[10](0); var: _i (0), num_uniqe_char (0), ch(""); for _i = 1 to len_inp begin ch = MidStr(inp , _i, 1); num_uniqe_char = InStr(uniqe_char, ch) ; if num_uniqe_char = 0 then begin uniqe_char = uniqe_char + ch; freq[strlen(uniqe_char)] = 1; end else freq[num_uniqe_char] = freq[num_uniqe_char] + 1; end; for _i =1 to strlen(uniqe_char) begin value1 = freq[_i] / len_inp; value2 = value2 + value1 * LogXY(2,value1); end; value2 = value2 * -1; once begin cleardebug; print ("inp:",inp); ch = ""; for _i =1 to strlen(uniqe_char) begin ch = ch + NumToStr(freq[_i],0); end; print ("len_inp:",len_inp); print ("freq:", ch); print ("uniqe_char:",uniqe_char); print ("entropy:", value2 :3:10 ); end;
Output:

Code: Select all

inp:1223334444 len_inp: 10.00 freq:1234 uniqe_char:1234 entropy:1.8464393447


Return to “MultiCharts”