-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RSI Not accurate? #64
Comments
Hi @StevenJE, I opened a PR which supports calculating the RSI using SMMA (as specified by J. Welles Wilder Jr.) and EMA (as used by commercial packages like AIQ). With my PR you will be able to define the sort of moving average you want to use (SMMA is default): const rsi = new RSI(12, EMA); Is that to your liking and does it match what is being calculated on TradingView? |
@bennyn Yes thats great, thank you! |
Great, can you please provide your test data set so I can write a unit test for using RSI with EMAs? You wrote that at 4am the RSI should have been "70" and not "63.476620248325204". I would like to guarantee that with a unit test. |
{"0":[1597273200000,0.0000111,0.00001113,0.00001096,0.00001112,650403],"1":[1597276800000,0.00001111,0.00001114,0.00001097,0.00001101,457490],"2":[1597280400000,0.00001104,0.00001125,0.00001101,0.00001123,536601],"3":[1597284000000,0.00001123,0.00001123,0.00001089,0.00001093,542504],"4":[1597287600000,0.00001095,0.0000113,0.00001095,0.00001125,755025],"5":[1597291200000,0.00001125,0.00001125,0.00001114,0.00001118,86226],"6":[1597294800000,0.00001118,0.00001459,0.00001112,0.0000138,27663565],"7":[1597298400000,0.0000138,0.0000144,0.00001342,0.00001404,11993865],"8":[1597302000000,0.00001405,0.00001455,0.00001351,0.00001363,7425871],"9":[1597305600000,0.00001363,0.00001386,0.00001279,0.00001335,7667099],"10":[1597309200000,0.00001336,0.00001366,0.00001273,0.00001364,4127903],"11":[1597312800000,0.0000136,0.00001373,0.00001325,0.00001364,2958332],"12":[1597316400000,0.00001366,0.00001377,0.00001304,0.00001326,2504407],"13":[1597320000000,0.00001327,0.00001429,0.00001311,0.00001423,2800651],"14":[1597323600000,0.00001425,0.0000154,0.00001371,0.0000154,10812605],"15":[1597327200000,0.00001541,0.00001594,0.00001501,0.00001523,11018709],"16":[1597330800000,0.00001523,0.00001556,0.00001474,0.00001541,5746212],"17":[1597334400000,0.00001546,0.00001621,0.00001507,0.00001602,5086527],"18":[1597338000000,0.000016,0.00001602,0.00001492,0.00001512,4524964],"19":[1597341600000,0.00001517,0.00001548,0.00001506,0.00001525,1554107],"20":[1597345200000,0.00001521,0.00001601,0.00001515,0.00001565,2060949],"21":[1597348800000,0.00001564,0.00001642,0.00001511,0.0000155,6019629],"22":[1597352400000,0.0000155,0.00001575,0.00001477,0.00001487,4241483],"23":[1597356000000,0.00001487,0.00001553,0.0000146,0.00001544,2521224],"24":[1597359600000,0.00001544,0.0000156,0.00001494,0.00001514,1743977],"25":[1597363200000,0.00001509,0.00001514,0.00001464,0.00001476,1432207],"26":[1597366800000,0.00001476,0.00001534,0.00001457,0.00001472,1498507],"27":[1597370400000,0.00001472,0.00001492,0.00001431,0.00001433,1981461],"28":[1597374000000,0.00001432,0.00001447,0.00001379,0.00001416,4068691],"29":[1597377600000,0.00001415,0.00001447,0.00001403,0.00001421,1593683],"30":[1597381200000,0.00001422,0.00001476,0.00001419,0.00001449,2673964],"31":[1597384800000,0.00001451,0.00001474,0.00001432,0.00001463,1707756],"32":[1597388400000,0.00001463,0.0000149,0.00001393,0.00001437,4891248],"33":[1597392000000,0.00001437,0.00001464,0.00001422,0.00001439,1199617],"34":[1597395600000,0.00001435,0.00001442,0.00001406,0.0000144,1443432],"35":[1597399200000,0.00001441,0.00001442,0.000014,0.00001407,1276083],"36":[1597402800000,0.00001407,0.00001422,0.00001404,0.00001421,721645],"37":[1597406400000,0.00001421,0.00001457,0.00001407,0.00001408,2487577],"38":[1597410000000,0.00001408,0.00001423,0.00001386,0.00001408,1586523],"39":[1597413600000,0.0000141,0.00001419,0.000014,0.00001405,1186189],"40":[1597417200000,0.00001407,0.0000145,0.00001407,0.00001439,2136919],"41":[1597420800000,0.00001438,0.00001444,0.00001382,0.00001414,1495775],"42":[1597424400000,0.00001414,0.00001418,0.00001385,0.00001395,864222],"43":[1597428000000,0.00001393,0.00001444,0.00001388,0.00001429,2749698],"44":[1597431600000,0.00001429,0.00001516,0.00001429,0.00001479,3223613],"45":[1597435200000,0.00001479,0.00001499,0.00001464,0.00001471,781471],"46":[1597438800000,0.00001472,0.00001489,0.00001459,0.00001488,520896],"47":[1597442400000,0.00001488,0.00001533,0.00001484,0.00001505,1093147],"48":[1597446000000,0.00001504,0.00001507,0.00001456,0.00001478,640941],"49":[1597449600000,0.00001475,0.00001475,0.00001397,0.00001416,1545291],"50":[1597453200000,0.00001416,0.00001431,0.00001405,0.00001413,580644],"51":[1597456800000,0.00001417,0.00001447,0.00001398,0.00001446,659817],"52":[1597460400000,0.00001442,0.00001452,0.00001417,0.0000143,973339],"53":[1597464000000,0.0000143,0.00001456,0.00001425,0.00001456,438702],"54":[1597467600000,0.00001456,0.00001456,0.00001415,0.00001426,653345],"55":[1597471200000,0.00001426,0.00001431,0.00001415,0.00001428,447532],"56":[1597474800000,0.00001428,0.00001637,0.00001425,0.00001611,13598041],"57":[1597478400000,0.00001611,0.00001628,0.00001359,0.00001426,17452020],"58":[1597482000000,0.00001428,0.00001455,0.00001384,0.00001392,4026578],"59":[1597485600000,0.00001396,0.00001449,0.00001347,0.00001376,10812904],"60":[1597489200000,0.00001376,0.00001388,0.00001368,0.0000138,1280263],"61":[1597492800000,0.00001381,0.00001389,0.00001347,0.00001364,1500579],"62":[1597496400000,0.00001365,0.00001377,0.00001342,0.0000136,1386960],"63":[1597500000000,0.0000136,0.00001369,0.00001335,0.0000136,994592],"64":[1597503600000,0.00001358,0.00001362,0.0000132,0.0000134,1892727],"65":[1597507200000,0.00001339,0.00001355,0.00001327,0.00001353,697268],"66":[1597510800000,0.00001356,0.00001358,0.00001336,0.00001352,485216],"67":[1597514400000,0.00001351,0.00001378,0.00001347,0.00001361,1271030],"68":[1597518000000,0.00001361,0.00001366,0.00001334,0.0000136,2165834],"69":[1597521600000,0.0000136,0.00001361,0.00001326,0.00001328,740048],"70":[1597525200000,0.00001327,0.0000134,0.00001296,0.00001317,1556859],"71":[1597528800000,0.00001316,0.0000133,0.00001304,0.00001322,474843],"72":[1597532400000,0.00001322,0.00001347,0.00001315,0.00001335,561586],"73":[1597536000000,0.00001336,0.00001341,0.00001315,0.00001328,383368],"74":[1597539600000,0.00001328,0.00001329,0.00001315,0.00001321,253084],"75":[1597543200000,0.00001316,0.00001337,0.00001314,0.00001323,330311],"76":[1597546800000,0.00001322,0.00001333,0.00001301,0.00001317,570085],"77":[1597550400000,0.0000132,0.00001368,0.00001312,0.00001324,2381091],"78":[1597554000000,0.00001327,0.00001343,0.00001319,0.00001321,568003],"79":[1597557600000,0.00001322,0.00001429,0.00001319,0.00001374,5114480],"80":[1597561200000,0.00001371,0.00001386,0.00001351,0.0000138,822024],"81":[1597564800000,0.0000138,0.00001418,0.00001371,0.00001379,2047593],"82":[1597568400000,0.0000138,0.00001392,0.00001365,0.00001365,477530],"83":[1597572000000,0.00001365,0.00001371,0.00001355,0.00001366,599904],"84":[1597575600000,0.00001369,0.00001376,0.00001344,0.00001352,548371],"85":[1597579200000,0.00001348,0.00001359,0.00001333,0.00001349,576202],"86":[1597582800000,0.0000135,0.00001388,0.00001344,0.0000137,492466],"87":[1597586400000,0.0000137,0.00001391,0.00001363,0.00001363,557992],"88":[1597590000000,0.00001372,0.00001372,0.00001346,0.00001352,400288],"89":[1597593600000,0.00001353,0.00001353,0.00001339,0.00001352,471828],"90":[1597597200000,0.00001351,0.00001361,0.0000135,0.00001356,177031],"91":[1597600800000,0.00001356,0.00001376,0.00001351,0.0000137,564946],"92":[1597604400000,0.0000137,0.0000137,0.00001348,0.00001361,455428],"93":[1597608000000,0.00001361,0.000014,0.00001354,0.00001383,1867883],"94":[1597611600000,0.00001383,0.00001388,0.00001371,0.00001385,373537],"95":[1597615200000,0.00001385,0.00001386,0.00001368,0.00001369,158343],"96":[1597618800000,0.00001367,0.00001388,0.00001364,0.00001366,648515],"97":[1597622400000,0.00001365,0.00001381,0.00001362,0.00001369,176125],"98":[1597626000000,0.00001369,0.00001387,0.00001365,0.00001379,362804],"99":[1597629600000,0.00001379,0.00001389,0.00001375,0.00001381,335017],"100":[1597633200000,0.00001381,0.00001381,0.00001321,0.00001342,5129838],"101":[1597636800000,0.00001342,0.00001345,0.00001276,0.00001308,7241734],"102":[1597640400000,0.00001307,0.00001319,0.00001293,0.00001299,1874085],"103":[1597644000000,0.00001299,0.00001302,0.00001286,0.000013,1061241],"104":[1597647600000,0.000013,0.000013,0.00001284,0.00001291,1102142],"105":[1597651200000,0.00001293,0.00001302,0.00001293,0.00001301,1183920],"106":[1597654800000,0.00001301,0.0000131,0.00001294,0.0000131,1250121],"107":[1597658400000,0.0000131,0.0000131,0.00001294,0.00001308,631634],"108":[1597662000000,0.00001308,0.00001311,0.00001294,0.000013,685119],"109":[1597665600000,0.00001299,0.0000131,0.00001285,0.00001297,944426],"110":[1597669200000,0.000013,0.00001302,0.00001233,0.00001245,3223309],"111":[1597672800000,0.00001245,0.00001249,0.00001216,0.00001248,2012987],"112":[1597676400000,0.00001246,0.00001254,0.00001195,0.00001204,2727950],"113":[1597680000000,0.00001206,0.00001244,0.00001203,0.00001239,1233691],"114":[1597683600000,0.00001238,0.00001259,0.0000123,0.00001245,3893726],"115":[1597687200000,0.00001244,0.00001258,0.00001239,0.00001239,500339],"116":[1597690800000,0.0000124,0.00001258,0.00001234,0.0000124,554309],"117":[1597694400000,0.00001245,0.00001246,0.00001233,0.00001236,479883],"118":[1597698000000,0.00001236,0.0000124,0.00001231,0.00001237,275550],"119":[1597701600000,0.00001237,0.00001253,0.00001227,0.00001231,583733],"120":[1597705200000,0.00001231,0.00001234,0.00001223,0.00001231,325419],"121":[1597708800000,0.00001231,0.00001246,0.00001225,0.00001243,470587],"122":[1597712400000,0.00001244,0.00001251,0.00001243,0.00001251,333741],"123":[1597716000000,0.00001251,0.00001251,0.00001232,0.00001232,598349],"124":[1597719600000,0.00001234,0.00001248,0.00001232,0.00001242,353493],"125":[1597723200000,0.00001242,0.00001249,0.0000123,0.00001235,286964],"126":[1597726800000,0.00001236,0.00001246,0.00001226,0.0000124,432617],"127":[1597730400000,0.00001243,0.00001243,0.00001221,0.00001225,556979],"128":[1597734000000,0.00001226,0.00001252,0.00001225,0.00001244,434728],"129":[1597737600000,0.00001244,0.00001262,0.00001243,0.00001261,513090],"130":[1597741200000,0.00001262,0.00001266,0.00001251,0.00001258,224919],"131":[1597744800000,0.00001257,0.00001258,0.00001234,0.00001235,517625],"132":[1597748400000,0.0000124,0.00001244,0.00001234,0.00001234,110014],"133":[1597752000000,0.00001236,0.00001236,0.00001228,0.00001234,226281],"134":[1597755600000,0.00001233,0.00001237,0.00001213,0.00001215,348897],"135":[1597759200000,0.00001215,0.00001231,0.00001203,0.00001214,934210],"136":[1597762800000,0.00001214,0.00001232,0.00001199,0.00001206,788921],"137":[1597766400000,0.00001207,0.00001232,0.00001207,0.00001229,436886],"138":[1597770000000,0.00001229,0.0000123,0.00001217,0.00001227,317162],"139":[1597773600000,0.00001225,0.00001238,0.00001223,0.00001231,296287],"140":[1597777200000,0.00001232,0.00001237,0.00001225,0.00001228,298173],"141":[1597780800000,0.00001228,0.00001228,0.00001205,0.00001213,264765],"142":[1597784400000,0.00001212,0.0000123,0.0000121,0.00001213,492728],"143":[1597788000000,0.00001213,0.00001218,0.00001199,0.00001204,302621],"144":[1597791600000,0.00001202,0.00001211,0.00001199,0.00001203,149384],"145":[1597795200000,0.00001203,0.00001218,0.00001203,0.00001218,173624],"146":[1597798800000,0.00001214,0.00001215,0.00001208,0.00001211,174996],"147":[1597802400000,0.00001211,0.00001211,0.00001156,0.00001182,1669916],"148":[1597806000000,0.00001183,0.00001183,0.00001151,0.00001157,582822],"149":[1597809600000,0.00001156,0.00001167,0.00001114,0.00001128,2792370],"150":[1597813200000,0.0000113,0.00001141,0.00001124,0.00001131,745548],"151":[1597816800000,0.00001128,0.00001147,0.00001104,0.00001146,921013],"152":[1597820400000,0.00001145,0.00001157,0.00001129,0.00001151,623184],"153":[1597824000000,0.00001151,0.00001153,0.00001131,0.00001136,981678],"154":[1597827600000,0.00001139,0.00001158,0.00001137,0.00001154,289599],"155":[1597831200000,0.00001154,0.00001156,0.00001135,0.00001142,564906],"156":[1597834800000,0.0000114,0.00001164,0.00001136,0.00001159,639919],"157":[1597838400000,0.00001161,0.00001167,0.0000115,0.00001152,231188],"158":[1597842000000,0.00001152,0.00001162,0.0000115,0.00001157,256329],"159":[1597845600000,0.00001157,0.00001168,0.00001147,0.00001156,602737],"160":[1597849200000,0.00001155,0.00001155,0.00001132,0.00001137,402445],"161":[1597852800000,0.00001137,0.00001148,0.00001132,0.00001142,271361],"162":[1597856400000,0.00001142,0.00001149,0.00001138,0.00001144,92807],"163":[1597860000000,0.00001145,0.00001152,0.00001131,0.00001144,381347],"164":[1597863600000,0.00001143,0.00001145,0.00001113,0.00001122,273602],"165":[1597867200000,0.00001123,0.00001141,0.00001104,0.00001136,564881],"166":[1597870800000,0.00001138,0.00001168,0.00001131,0.0000115,562263],"167":[1597874400000,0.0000115,0.0000117,0.0000115,0.0000115,241414],"168":[1597878000000,0.00001152,0.00001152,0.00001137,0.00001139,167077],"169":[1597881600000,0.0000114,0.00001161,0.0000114,0.00001159,317115],"170":[1597885200000,0.00001159,0.00001162,0.00001148,0.0000116,219192],"171":[1597888800000,0.0000116,0.00001168,0.00001155,0.0000116,193890],"172":[1597892400000,0.0000116,0.0000116,0.00001138,0.00001138,297392],"173":[1597896000000,0.0000114,0.00001148,0.00001135,0.0000114,207186],"174":[1597899600000,0.00001142,0.00001172,0.00001142,0.00001172,455569],"175":[1597903200000,0.00001171,0.00001212,0.00001169,0.0000121,1916770],"176":[1597906800000,0.00001209,0.00001212,0.00001189,0.00001204,697185],"177":[1597910400000,0.00001204,0.00001207,0.00001179,0.00001182,428790],"178":[1597914000000,0.00001182,0.00001202,0.00001182,0.00001195,538265],"179":[1597917600000,0.00001196,0.00001209,0.00001193,0.00001201,289167],"180":[1597921200000,0.00001201,0.00001227,0.00001201,0.00001213,1338997],"181":[1597924800000,0.00001211,0.00001213,0.00001187,0.00001188,1139460],"182":[1597928400000,0.00001192,0.0000121,0.0000119,0.00001201,371019],"183":[1597932000000,0.00001202,0.00001205,0.0000119,0.00001191,195449],"184":[1597935600000,0.0000119,0.000012,0.00001186,0.0000119,347172],"185":[1597939200000,0.00001191,0.00001195,0.00001176,0.00001182,328915],"186":[1597942800000,0.00001182,0.00001208,0.00001182,0.00001207,281966],"187":[1597946400000,0.00001205,0.00001212,0.0000118,0.00001181,600810],"188":[1597950000000,0.00001181,0.00001185,0.0000117,0.00001177,295724],"189":[1597953600000,0.00001178,0.00001195,0.00001176,0.00001194,218677],"190":[1597957200000,0.00001193,0.00001193,0.0000115,0.00001165,902316],"191":[1597960800000,0.00001163,0.0000118,0.00001163,0.00001173,319441],"192":[1597964400000,0.0000117,0.00001189,0.0000117,0.00001179,238986],"193":[1597968000000,0.00001181,0.00001183,0.00001175,0.00001176,156951],"194":[1597971600000,0.00001176,0.00001194,0.00001173,0.00001191,288227],"195":[1597975200000,0.00001192,0.00001198,0.0000118,0.00001185,384336],"196":[1597978800000,0.00001181,0.0000123,0.00001177,0.00001207,1459068],"197":[1597982400000,0.00001203,0.00001226,0.00001197,0.00001197,607613],"198":[1597986000000,0.00001199,0.00001233,0.00001196,0.00001229,640708],"199":[1597989600000,0.0000123,0.00001233,0.00001215,0.00001225,388344],"200":[1597993200000,0.00001222,0.0000128,0.00001208,0.00001266,2839725],"201":[1597996800000,0.00001266,0.00001288,0.0000125,0.00001277,1228663],"202":[1598000400000,0.00001275,0.00001282,0.00001244,0.00001245,615507],"203":[1598004000000,0.00001244,0.00001257,0.000012,0.00001241,1738501],"204":[1598007600000,0.00001241,0.00001248,0.00001193,0.00001198,949002],"205":[1598011200000,0.00001198,0.0000125,0.00001163,0.00001223,1447104],"206":[1598014800000,0.00001224,0.00001224,0.00001201,0.00001201,438699],"207":[1598018400000,0.00001206,0.00001225,0.00001181,0.00001201,600442],"208":[1598022000000,0.00001199,0.00001209,0.00001198,0.00001207,268651],"209":[1598025600000,0.00001207,0.0000121,0.00001198,0.00001198,340484],"210":[1598029200000,0.00001197,0.00001201,0.00001179,0.00001193,487617],"211":[1598032800000,0.0000119,0.00001191,0.00001165,0.00001168,452266],"212":[1598036400000,0.00001168,0.00001176,0.00001165,0.00001168,448581],"213":[1598040000000,0.00001168,0.00001193,0.00001168,0.00001172,285002],"214":[1598043600000,0.00001172,0.00001175,0.0000111,0.00001136,1678873],"215":[1598047200000,0.00001138,0.00001164,0.00001137,0.00001159,162862],"216":[1598050800000,0.00001158,0.00001162,0.00001147,0.00001151,136752],"217":[1598054400000,0.00001147,0.00001151,0.00001108,0.00001132,687714],"218":[1598058000000,0.00001132,0.00001143,0.00001116,0.00001142,134947],"219":[1598061600000,0.00001142,0.00001145,0.00001136,0.00001139,82689],"220":[1598065200000,0.00001142,0.0000116,0.00001139,0.00001154,91283],"221":[1598068800000,0.00001154,0.00001164,0.00001153,0.00001162,43672],"222":[1598072400000,0.00001157,0.00001162,0.0000115,0.0000116,121304],"223":[1598076000000,0.0000116,0.0000117,0.00001157,0.0000117,363089],"224":[1598079600000,0.0000117,0.00001176,0.00001168,0.00001171,142591],"225":[1598083200000,0.00001174,0.0000118,0.00001166,0.00001166,171494],"226":[1598086800000,0.00001165,0.00001167,0.00001155,0.00001157,216100],"227":[1598090400000,0.00001155,0.00001172,0.00001155,0.00001168,178100],"228":[1598094000000,0.00001168,0.00001171,0.00001154,0.00001159,162288],"229":[1598097600000,0.00001158,0.00001162,0.00001154,0.0000116,67419],"230":[1598101200000,0.00001163,0.0000118,0.00001161,0.00001175,365593],"231":[1598104800000,0.00001176,0.00001185,0.00001169,0.00001174,257142],"232":[1598108400000,0.00001175,0.00001181,0.00001171,0.00001176,76503],"233":[1598112000000,0.00001177,0.0000118,0.00001163,0.00001167,216661],"234":[1598115600000,0.00001163,0.00001179,0.00001162,0.00001175,159010],"235":[1598119200000,0.00001176,0.00001179,0.00001174,0.00001174,60121],"236":[1598122800000,0.00001174,0.0000118,0.00001165,0.00001169,156452],"237":[1598126400000,0.00001169,0.0000118,0.00001159,0.00001162,140324],"238":[1598130000000,0.00001165,0.00001168,0.00001161,0.00001165,106871],"239":[1598133600000,0.00001165,0.00001181,0.00001165,0.0000118,88368],"240":[1598137200000,0.00001181,0.00001183,0.0000117,0.00001183,250608],"241":[1598140800000,0.00001183,0.00001185,0.00001177,0.00001179,99763],"242":[1598144400000,0.0000118,0.0000118,0.00001166,0.00001167,157997],"243":[1598148000000,0.00001169,0.00001174,0.00001166,0.00001168,42897],"244":[1598151600000,0.00001168,0.00001176,0.00001166,0.00001166,67884],"245":[1598155200000,0.00001169,0.00001171,0.00001156,0.00001162,151376],"246":[1598158800000,0.00001162,0.00001174,0.0000116,0.00001167,48579],"247":[1598162400000,0.00001166,0.00001166,0.00001147,0.00001153,294018],"248":[1598166000000,0.00001153,0.0000116,0.0000115,0.00001158,142439],"249":[1598169600000,0.00001161,0.00001163,0.00001158,0.00001159,75068],"250":[1598173200000,0.0000116,0.00001175,0.00001157,0.00001175,284797],"251":[1598176800000,0.00001176,0.00001177,0.00001158,0.00001158,253133],"252":[1598180400000,0.00001159,0.00001167,0.00001151,0.00001153,303799],"253":[1598184000000,0.00001154,0.00001154,0.00001138,0.00001146,644925],"254":[1598187600000,0.00001147,0.0000116,0.00001142,0.00001156,203749],"255":[1598191200000,0.00001155,0.00001155,0.00001148,0.00001149,68423],"256":[1598194800000,0.00001149,0.00001156,0.00001141,0.00001154,201348],"257":[1598198400000,0.00001152,0.00001162,0.00001146,0.00001149,90822],"258":[1598202000000,0.00001148,0.00001157,0.00001148,0.00001153,140553],"259":[1598205600000,0.00001152,0.00001159,0.0000115,0.00001157,38444],"260":[1598209200000,0.00001155,0.00001156,0.00001145,0.00001146,51240],"261":[1598212800000,0.00001146,0.00001148,0.0000114,0.00001148,67934],"262":[1598216400000,0.00001148,0.00001162,0.00001148,0.00001159,101326],"263":[1598220000000,0.00001159,0.00001159,0.00001153,0.00001157,15164],"264":[1598223600000,0.00001157,0.0000116,0.00001155,0.00001159,30295],"265":[1598227200000,0.0000116,0.00001162,0.0000115,0.00001151,43423],"266":[1598230800000,0.00001152,0.00001159,0.00001133,0.00001139,410665],"267":[1598234400000,0.00001142,0.00001149,0.0000114,0.00001149,95597],"268":[1598238000000,0.00001149,0.00001155,0.00001146,0.0000115,167529],"269":[1598241600000,0.00001151,0.00001152,0.00001146,0.00001151,108477],"270":[1598245200000,0.00001151,0.0000117,0.00001146,0.00001163,491628],"271":[1598248800000,0.00001162,0.00001169,0.00001157,0.00001167,153848],"272":[1598252400000,0.00001166,0.00001178,0.00001156,0.00001175,634645],"273":[1598256000000,0.00001175,0.0000119,0.00001172,0.00001188,502819],"274":[1598259600000,0.00001188,0.00001205,0.00001184,0.00001203,637230],"275":[1598263200000,0.00001202,0.0000121,0.00001192,0.00001193,449158],"276":[1598266800000,0.00001193,0.00001208,0.00001193,0.00001195,282551],"277":[1598270400000,0.00001195,0.00001199,0.00001164,0.00001183,640279],"278":[1598274000000,0.00001183,0.00001201,0.00001183,0.0000119,267518],"279":[1598277600000,0.00001193,0.00001195,0.00001184,0.00001184,170189],"280":[1598281200000,0.00001183,0.00001194,0.00001179,0.0000119,186909],"281":[1598284800000,0.0000119,0.00001208,0.00001189,0.00001199,1325840],"282":[1598288400000,0.00001198,0.0000124,0.00001192,0.00001234,1458011],"283":[1598292000000,0.00001239,0.00001242,0.00001189,0.00001194,2459033],"284":[1598295600000,0.00001195,0.000012,0.00001187,0.00001194,145200],"285":[1598299200000,0.00001195,0.00001199,0.00001189,0.00001194,212291],"286":[1598302800000,0.00001194,0.00001202,0.0000119,0.00001201,58548],"287":[1598306400000,0.00001197,0.00001204,0.00001192,0.00001194,171074],"288":[1598310000000,0.00001192,0.000012,0.00001189,0.000012,70062],"289":[1598313600000,0.00001199,0.00001204,0.00001194,0.00001197,102372],"290":[1598317200000,0.00001199,0.000012,0.0000119,0.00001194,99122],"291":[1598320800000,0.00001194,0.00001194,0.00001174,0.00001176,447940],"292":[1598324400000,0.00001174,0.00001192,0.00001173,0.00001192,271904],"293":[1598328000000,0.00001191,0.00001192,0.00001176,0.00001184,186150],"294":[1598331600000,0.00001183,0.00001185,0.00001173,0.00001182,271915],"295":[1598335200000,0.00001182,0.00001194,0.00001179,0.00001179,158181],"296":[1598338800000,0.0000118,0.00001183,0.00001172,0.00001176,287338],"297":[1598342400000,0.00001173,0.00001183,0.00001163,0.00001182,224336],"298":[1598346000000,0.00001184,0.00001188,0.00001171,0.00001181,167136],"299":[1598349600000,0.00001178,0.00001181,0.00001166,0.00001175,375047],"300":[1598353200000,0.00001173,0.00001221,0.00001171,0.00001202,1038858],"301":[1598356800000,0.00001201,0.00001201,0.00001176,0.00001176,558830],"302":[1598360400000,0.00001178,0.00001189,0.00001173,0.0000118,198407],"303":[1598364000000,0.00001179,0.00001189,0.00001174,0.00001186,287261],"304":[1598367600000,0.00001187,0.00001189,0.00001168,0.00001171,200257],"305":[1598371200000,0.00001171,0.00001186,0.00001168,0.00001175,220845],"306":[1598374800000,0.00001176,0.00001179,0.00001155,0.00001159,716037],"307":[1598378400000,0.00001162,0.00001183,0.0000115,0.00001182,450693],"308":[1598382000000,0.00001184,0.0000119,0.00001173,0.0000118,141477],"309":[1598385600000,0.00001181,0.00001183,0.00001163,0.00001178,94432],"310":[1598389200000,0.00001172,0.00001176,0.00001167,0.00001176,39980],"311":[1598392800000,0.00001176,0.00001183,0.00001172,0.00001182,44598],"312":[1598396400000,0.00001183,0.00001186,0.0000118,0.00001185,56211],"313":[1598400000000,0.00001185,0.00001186,0.00001171,0.00001175,54779],"314":[1598403600000,0.00001175,0.0000118,0.00001171,0.00001179,70461],"315":[1598407200000,0.0000118,0.0000119,0.0000116,0.00001173,327197],"316":[1598410800000,0.00001174,0.00001181,0.0000116,0.00001174,374128],"317":[1598414400000,0.00001173,0.00001179,0.00001171,0.00001174,137727],"318":[1598418000000,0.00001174,0.00001177,0.00001167,0.00001176,107373],"319":[1598421600000,0.00001176,0.00001176,0.0000117,0.00001174,86797],"320":[1598425200000,0.00001174,0.00001177,0.00001161,0.00001169,158967],"321":[1598428800000,0.00001167,0.00001174,0.00001147,0.00001169,278539],"322":[1598432400000,0.00001167,0.0000118,0.00001167,0.00001175,70517],"323":[1598436000000,0.00001174,0.0000119,0.00001173,0.00001187,293619],"324":[1598439600000,0.00001187,0.00001189,0.00001175,0.00001186,73425],"325":[1598443200000,0.00001184,0.00001184,0.00001167,0.00001172,269686],"326":[1598446800000,0.0000117,0.00001178,0.00001161,0.00001165,284592],"327":[1598450400000,0.00001165,0.00001171,0.0000116,0.0000117,163134],"328":[1598454000000,0.00001169,0.0000119,0.00001164,0.00001167,409656],"329":[1598457600000,0.00001167,0.00001172,0.00001161,0.00001166,417479],"330":[1598461200000,0.00001166,0.00001181,0.00001163,0.0000118,192167],"331":[1598464800000,0.00001178,0.00001185,0.0000117,0.00001175,164653],"332":[1598468400000,0.00001175,0.00001175,0.00001168,0.00001174,69948],"333":[1598472000000,0.00001171,0.00001171,0.00001164,0.00001166,142654],"334":[1598475600000,0.00001167,0.00001178,0.00001167,0.00001175,125896],"335":[1598479200000,0.00001175,0.00001175,0.00001166,0.00001173,50832],"336":[1598482800000,0.00001173,0.00001174,0.00001163,0.0000117,217189],"337":[1598486400000,0.00001171,0.00001183,0.00001171,0.00001181,21751],"338":[1598490000000,0.00001184,0.00001185,0.00001172,0.00001176,178044],"339":[1598493600000,0.00001177,0.00001182,0.00001172,0.00001179,163454],"340":[1598497200000,0.00001178,0.00001183,0.00001177,0.00001182,32207],"341":[1598500800000,0.00001182,0.00001183,0.00001171,0.00001175,159871],"342":[1598504400000,0.00001171,0.00001175,0.00001168,0.00001169,141270],"343":[1598508000000,0.00001172,0.00001179,0.00001168,0.00001169,106312],"344":[1598511600000,0.00001172,0.00001172,0.00001163,0.00001167,86256],"345":[1598515200000,0.00001165,0.00001173,0.00001162,0.00001168,172391],"346":[1598518800000,0.0000117,0.00001174,0.00001165,0.00001174,144928],"347":[1598522400000,0.00001174,0.00001179,0.00001169,0.00001175,118667],"348":[1598526000000,0.00001175,0.00001196,0.00001165,0.00001169,1379864],"349":[1598529600000,0.0000117,0.00001172,0.00001158,0.0000117,500874],"350":[1598533200000,0.0000117,0.00001172,0.00001154,0.00001166,313298],"351":[1598536800000,0.00001168,0.00001173,0.00001163,0.00001166,152344],"352":[1598540400000,0.00001167,0.00001175,0.0000116,0.00001167,116882],"353":[1598544000000,0.00001165,0.0000117,0.00001155,0.00001156,297043],"354":[1598547600000,0.00001158,0.00001165,0.00001145,0.00001149,800277],"355":[1598551200000,0.00001149,0.00001166,0.00001146,0.00001166,238354],"356":[1598554800000,0.00001164,0.00001171,0.00001149,0.00001153,344519],"357":[1598558400000,0.00001152,0.00001153,0.00001142,0.00001149,558338],"358":[1598562000000,0.00001151,0.00001153,0.00001143,0.00001152,108587],"359":[1598565600000,0.0000115,0.00001151,0.00001131,0.0000115,287655],"360":[1598569200000,0.00001146,0.00001149,0.00001142,0.00001143,205805],"361":[1598572800000,0.00001144,0.00001149,0.0000114,0.00001144,78184],"362":[1598576400000,0.00001145,0.00001157,0.00001142,0.00001156,138452],"363":[1598580000000,0.00001156,0.00001171,0.00001156,0.0000117,86593],"364":[1598583600000,0.00001168,0.00001171,0.00001157,0.00001157,86260],"365":[1598587200000,0.00001156,0.0000116,0.00001149,0.00001149,237238],"366":[1598590800000,0.0000115,0.00001154,0.00001146,0.00001151,376765],"367":[1598594400000,0.00001151,0.00001154,0.00001147,0.00001149,168730],"368":[1598598000000,0.00001153,0.00001156,0.00001142,0.00001145,283653],"369":[1598601600000,0.00001144,0.0000115,0.0000112,0.00001132,885068],"370":[1598605200000,0.00001135,0.00001137,0.00001126,0.00001128,186971],"371":[1598608800000,0.0000113,0.00001138,0.0000113,0.00001134,206633],"372":[1598612400000,0.00001133,0.00001143,0.00001132,0.00001135,84894],"373":[1598616000000,0.00001139,0.0000115,0.00001135,0.00001142,268539],"374":[1598619600000,0.00001142,0.00001153,0.00001132,0.00001137,621974],"375":[1598623200000,0.00001135,0.0000114,0.00001126,0.00001126,560966],"376":[1598626800000,0.00001131,0.00001148,0.00001123,0.00001146,585890],"377":[1598630400000,0.00001146,0.00001151,0.00001138,0.00001145,334764],"378":[1598634000000,0.00001149,0.0000115,0.00001137,0.00001137,145318],"379":[1598637600000,0.00001138,0.0000115,0.00001136,0.00001141,143341],"380":[1598641200000,0.00001143,0.00001144,0.00001137,0.00001144,180442],"381":[1598644800000,0.00001143,0.00001144,0.00001135,0.00001139,99665],"382":[1598648400000,0.0000114,0.00001143,0.00001132,0.00001138,152057],"383":[1598652000000,0.00001138,0.00001139,0.00001133,0.00001134,70627],"384":[1598655600000,0.00001134,0.00001145,0.00001134,0.00001143,99926],"385":[1598659200000,0.0000114,0.00001145,0.00001138,0.00001144,52024],"386":[1598662800000,0.00001143,0.00001145,0.00001139,0.00001144,100704],"387":[1598666400000,0.00001142,0.00001155,0.00001142,0.00001149,180635],"388":[1598670000000,0.0000115,0.00001154,0.00001149,0.00001149,57774],"389":[1598673600000,0.00001153,0.0000116,0.00001145,0.00001149,191302],"390":[1598677200000,0.00001149,0.00001155,0.00001145,0.00001146,105937],"391":[1598680800000,0.00001149,0.00001153,0.00001145,0.00001151,212140],"392":[1598684400000,0.0000115,0.00001151,0.00001145,0.00001149,184550],"393":[1598688000000,0.00001149,0.00001175,0.00001149,0.00001171,754620],"394":[1598691600000,0.00001172,0.00001174,0.00001166,0.00001168,277768],"395":[1598695200000,0.00001169,0.0000117,0.00001152,0.0000116,459700],"396":[1598698800000,0.0000116,0.00001163,0.00001149,0.00001159,246105],"397":[1598702400000,0.0000116,0.00001162,0.0000115,0.0000115,203728],"398":[1598706000000,0.0000115,0.00001154,0.00001145,0.0000115,273230],"399":[1598709600000,0.00001147,0.00001156,0.00001145,0.00001154,117601],"400":[1598713200000,0.00001151,0.00001176,0.00001146,0.00001169,931243],"401":[1598716800000,0.00001168,0.00001176,0.00001159,0.00001171,487259],"402":[1598720400000,0.00001171,0.00001176,0.0000117,0.00001174,312689],"403":[1598724000000,0.00001171,0.00001176,0.00001169,0.00001175,459343],"404":[1598727600000,0.00001174,0.00001202,0.00001172,0.00001198,3114897],"405":[1598731200000,0.00001198,0.000012,0.00001184,0.00001198,1160672],"406":[1598734800000,0.00001199,0.00001214,0.00001187,0.00001195,790424],"407":[1598738400000,0.00001193,0.00001194,0.00001181,0.00001183,74466],"408":[1598742000000,0.00001184,0.00001188,0.0000117,0.00001184,394522],"409":[1598745600000,0.00001184,0.00001186,0.00001177,0.00001178,41544],"410":[1598749200000,0.00001178,0.00001199,0.00001178,0.00001184,339819],"411":[1598752800000,0.00001183,0.00001188,0.00001178,0.00001186,65516],"412":[1598756400000,0.00001186,0.00001204,0.00001182,0.00001203,391482],"413":[1598760000000,0.000012,0.0000121,0.00001191,0.00001194,519902],"414":[1598763600000,0.00001193,0.00001194,0.00001182,0.00001194,203961],"415":[1598767200000,0.00001194,0.000012,0.0000118,0.0000118,361356],"416":[1598770800000,0.0000118,0.00001186,0.00001177,0.00001177,326985],"417":[1598774400000,0.00001177,0.0000118,0.00001172,0.00001177,187516],"418":[1598778000000,0.00001179,0.00001179,0.00001165,0.00001175,522997],"419":[1598781600000,0.00001172,0.00001181,0.00001171,0.00001177,67808],"420":[1598785200000,0.00001178,0.00001183,0.00001169,0.0000117,359380],"421":[1598788800000,0.00001174,0.00001177,0.00001167,0.00001168,322899],"422":[1598792400000,0.00001168,0.00001169,0.00001152,0.00001157,638491],"423":[1598796000000,0.00001156,0.00001165,0.00001154,0.00001163,108324],"424":[1598799600000,0.00001162,0.00001167,0.00001152,0.00001167,417522],"425":[1598803200000,0.00001166,0.00001169,0.0000115,0.00001152,226553],"426":[1598806800000,0.00001155,0.00001168,0.00001154,0.00001168,111762],"427":[1598810400000,0.00001168,0.0000117,0.00001163,0.00001166,119425],"428":[1598814000000,0.00001163,0.0000117,0.00001162,0.00001164,82590],"429":[1598817600000,0.00001164,0.0000117,0.0000116,0.0000116,67525],"430":[1598821200000,0.0000116,0.00001171,0.00001159,0.00001164,255301],"431":[1598824800000,0.00001166,0.00001169,0.00001163,0.00001168,40298],"432":[1598828400000,0.00001166,0.00001171,0.0000115,0.00001153,282324],"433":[1598832000000,0.00001153,0.00001165,0.00001153,0.00001162,59200],"434":[1598835600000,0.00001163,0.00001165,0.00001155,0.00001158,110635],"435":[1598839200000,0.00001158,0.0000116,0.00001153,0.00001157,73220],"436":[1598842800000,0.00001157,0.00001163,0.00001156,0.00001163,88708],"437":[1598846400000,0.00001159,0.0000117,0.00001155,0.00001163,113939],"438":[1598850000000,0.00001164,0.00001165,0.00001153,0.00001164,165713],"439":[1598853600000,0.00001162,0.00001166,0.00001157,0.0000116,250486],"440":[1598857200000,0.00001158,0.00001167,0.00001147,0.00001163,629172],"441":[1598860800000,0.00001163,0.00001192,0.00001163,0.00001172,1008567],"442":[1598864400000,0.00001172,0.00001182,0.00001163,0.0000118,83265],"443":[1598868000000,0.00001181,0.00001195,0.00001177,0.00001192,413537],"444":[1598871600000,0.00001192,0.00001192,0.0000117,0.00001181,174275],"445":[1598875200000,0.00001178,0.00001179,0.00001157,0.00001161,444106],"446":[1598878800000,0.00001161,0.00001163,0.00001156,0.0000116,257009],"447":[1598882400000,0.0000116,0.00001165,0.00001155,0.00001162,194130],"448":[1598886000000,0.00001162,0.00001167,0.00001151,0.00001153,254253],"449":[1598889600000,0.00001153,0.00001182,0.00001152,0.00001171,386948],"450":[1598893200000,0.00001171,0.00001178,0.00001166,0.00001169,349777],"451":[1598896800000,0.0000117,0.00001176,0.00001165,0.00001172,138134],"452":[1598900400000,0.0000117,0.00001177,0.00001165,0.00001172,266197],"453":[1598904000000,0.00001169,0.00001175,0.00001163,0.00001169,132444],"454":[1598907600000,0.00001168,0.00001172,0.0000116,0.0000117,139229],"455":[1598911200000,0.0000117,0.00001171,0.0000116,0.00001167,76073],"456":[1598914800000,0.00001166,0.0000117,0.00001163,0.00001169,40474],"457":[1598918400000,0.0000117,0.0000117,0.00001133,0.00001144,1284443],"458":[1598922000000,0.00001146,0.00001154,0.00001138,0.00001146,322343],"459":[1598925600000,0.00001145,0.00001153,0.00001145,0.00001147,182500],"460":[1598929200000,0.00001147,0.00001157,0.00001145,0.00001154,77758],"461":[1598932800000,0.00001152,0.00001155,0.00001137,0.0000115,451689],"462":[1598936400000,0.0000115,0.00001151,0.0000114,0.0000114,218725],"463":[1598940000000,0.00001141,0.00001156,0.00001127,0.00001137,1100700],"464":[1598943600000,0.00001136,0.00001146,0.0000113,0.00001135,1099708],"465":[1598947200000,0.00001133,0.00001142,0.00001129,0.00001138,329131],"466":[1598950800000,0.00001138,0.00001139,0.00001122,0.00001125,401462],"467":[1598954400000,0.00001128,0.00001133,0.00001118,0.00001126,223864],"468":[1598958000000,0.00001126,0.00001127,0.00001111,0.00001118,593431],"469":[1598961600000,0.0000112,0.00001122,0.00001092,0.00001104,2150793],"470":[1598965200000,0.00001102,0.0000111,0.00001097,0.0000111,680057],"471":[1598968800000,0.00001111,0.00001118,0.00001076,0.00001107,723571],"472":[1598972400000,0.00001107,0.0000111,0.00001082,0.00001087,628668],"473":[1598976000000,0.00001087,0.00001117,0.00001076,0.00001097,757983],"474":[1598979600000,0.00001097,0.00001117,0.00001096,0.00001115,204836],"475":[1598983200000,0.00001116,0.00001118,0.000011,0.00001105,289150],"476":[1598986800000,0.00001104,0.0000111,0.00001097,0.00001103,170835],"477":[1598990400000,0.00001103,0.00001106,0.0000109,0.00001091,454187],"478":[1598994000000,0.00001094,0.000011,0.00001089,0.00001089,149334],"479":[1598997600000,0.00001094,0.00001108,0.00001094,0.00001096,231599],"480":[1599001200000,0.00001096,0.00001099,0.00001086,0.00001095,247574],"481":[1599004800000,0.00001094,0.00001115,0.00001088,0.00001097,584183],"482":[1599008400000,0.00001097,0.00001097,0.00001075,0.00001083,826309],"483":[1599012000000,0.00001083,0.00001106,0.00001083,0.00001106,388253],"484":[1599015600000,0.00001105,0.00001113,0.00001086,0.00001091,607747],"485":[1599019200000,0.0000109,0.00001109,0.00001087,0.00001099,401308],"486":[1599022800000,0.00001099,0.00001104,0.00001095,0.00001098,171337],"487":[1599026400000,0.00001097,0.00001113,0.00001097,0.00001101,275166],"488":[1599030000000,0.00001102,0.00001109,0.00001096,0.00001105,188502],"489":[1599033600000,0.00001107,0.00001108,0.000011,0.00001108,314121],"490":[1599037200000,0.00001108,0.00001114,0.000011,0.00001112,268443],"491":[1599040800000,0.00001112,0.00001151,0.00001109,0.00001112,804007],"492":[1599044400000,0.00001109,0.00001117,0.0000107,0.00001112,1730564],"493":[1599048000000,0.0000111,0.0000113,0.00001095,0.00001113,405242],"494":[1599051600000,0.00001115,0.00001123,0.00001102,0.00001109,602711],"495":[1599055200000,0.00001111,0.00001125,0.00001106,0.00001116,175539],"496":[1599058800000,0.00001115,0.00001116,0.00001104,0.00001112,214132],"497":[1599062400000,0.00001113,0.00001127,0.00001105,0.0000111,437358],"498":[1599066000000,0.00001112,0.00001114,0.00001104,0.00001107,160932],"499":[1599069600000,0.00001106,0.00001107,0.00001103,0.00001107,41772],"level":"debug","message":"fetchOHLCV"} |
@bennyn apologies if the data is not in the best format. If follows the format:
|
Thanks for providing this data. I tried to reproduce your result of "63.476620248325204" when using SMMA: import candles from '../test/fixtures/RSI/500-candles-WRX-BTC-1h.json';
// ...
for (const candle of Object.values(candles)) {
const closingPrice = candle[4];
rsi.update(closingPrice);
// console.log('RSI', , rsi.getResult().valueOf());
if (rsi.getResult().eq('63.476620248325204')) {
console.log(new Date(candle[0]).toISOString());
process.exit(0);
}
} Unfortunately this condition never turns true, so I am not getting the same results as you did. Can you please check if I am holding it wrong? Here is a test case which imports your 500 candles and uses EMA to get a RSI result of "70". This fails too. What's the expected RSI after importing all 500 candles? |
Hey @bennyn on the data set I provided the RSI at the 500th candle should be around 44.6, but I believe when I pulled the data the 500th candle was still in progress, so it might be better to look at the 499th candle that had closed. Which should be around 48.8, https://uk.tradingview.com/chart/WBgn29wN/ - 500th Candle was at Running the test case is a little beyond me, although I hope the image helps to see the surrounding values. |
Unfortunately I cannot view your chart. The website tells me:
I tested your candles with EMA and RSI interval 14 but with my current implementation I am getting:
Are you sure that TradingView uses EMA to calculate the RSI? |
I merged the feature to use EMA with RSI just now. I also added an |
Hey @bennyn, thanks for that I tested both the EMA and SMMA versions of the RSI and yes, you are right, it seems they still don't match up :/ Here is also a document on RSI from TradingView - although marketing could be out of sync with how the dev team has actually implemented it. I'm a little lost as to why it's not working, potentially the EMA interval? Although here is more data this time on ETH/BTC from Binance, which should make testing easier. https://www.tradingview.com/chart/?symbol=BINANCE%3AETHBTC <-- this should work ;) and thanks again for all your help! My code:
DATA SET |
I checked the RSI implementation of two other libraries (FinTA & Tulip Node aka tulind). For my investigation I used the 500 candles you provided on 2020-09-02T18:10:23Z and a RSI interval of 14. In order to use your candles with FinTA, I converted them into a CSV format: data.csv
Here is the Python code which I used to run FinTA: import pandas as pd
from finta import TA
dataFile = ("data.csv")
ohlc = pd.read_csv(dataFile, index_col="date", parse_dates=True)
dataSeries = TA.RSI(ohlc, 14, "close")
for result in dataSeries:
print(result) And here is what I coded in JavaScript to test tulind: const tulind = require('tulind');
const dataFile = require('./src/data.json');
const ohlc = Object.values(dataFile);
const closes = ohlc.map(([time, open, high, low, close, volume]) => (close));
tulind.indicators.rsi.indicator([closes], [14], (error, [dataSeries]) => {
for (const result of dataSeries) {
console.log(result);
}
}); What was interesting to notice is that tulind only returns 486 values because it skips the first 14 to fulfill the minimum requirement of the RSI interval. When comparing the results of FinTA and tulind, I noticed that the RSI values are very different and converge only towards the end. After feeding 325 candles, both RSI calculations start to match up to 8 decimal places but before the results are very different. However, I don't know why the results are so different. Here are my measurements: First 28 out of 500 / FinTA
First 28 out of 500 / Tulind
Last 28 out of 500 / FinTA
Last 28 out of 500 / Tulind
|
Here are the results from this library: First 28 out of 500 / new RSI(14, SMMA)
Last 28 out of 500 / new RSI(14, SMMA)
First 28 out of 500 / new RSI(14, EMA)
Last 28 out of 500 / new RSI(14, EMA)
Looking at the results, using RSI with SMMA using my library (trading-signals) goes hand-in-hand with what tulind calculates. When switching to EMA the results become different (as expected). FinTA seems to be the one which is off in general. 🤷 |
@StevenJE I added tests to verify the integrity with "tulind" (#71) and released a new patch version of "trading-signals": https://www.npmjs.com/package/trading-signals/v/1.1.1 |
bennyn: terrific work on library however as this thread details/explores, I can't get the RSI to match TradingView on SPY still.. I'm using same 14 period closes and I've tried variations of EMA and SMMA and no parameters. In fact the price action doesn't even respond predictably to 70/30 its often more opposite of the trend. I'm testing 1 minute OHLC from 2020-09-08 |
Hi @Cinemacloud, do you know what "black magic" is used in TradingView? I have checked my implementation and as proven it is compliant with the implementation from FinTA & Tulip Node. |
Ha @bennyn, good question. I don't know but I've spent many hours now trying to get TV alignment to various libs including yours without success yet. Here is the 2020-09-08 1m dataset if you would try to do a similar test with results that match TV I'd be most grateful. Data: https://pastebin.com/cKXHd8N1 |
After some investigation, I have found that the RSI indicator provides the same result as TradingView when you provide |
const rsi = new RSI(14)
Get OHLCV data from Binance.
... update with with last 500 (1h) candles using closed value.
...
https://uk.tradingview.com/chart/WBgn29wN/ - 1h WRXBTC Binance
at 4am for example I'm getting
RSI: 63.476620248325204 where as trading view shows 70
The text was updated successfully, but these errors were encountered: