My strategy checks whether Stochastics K is greater than D:
Stochastics(7, 14, 1).K[1] > Stochastics(7, 14, 1).D[1]
And I print out the values and the comparison:
Print("K: "+ Stochastics(7, 14, 1).K[1] +" D: "+ Stochastics(7, 14, 1).D[1]+ " "+ (Stochastics(7, 14, 1).K[1] > Stochastics(7, 14, 1).D[1]));
Here's what I got:
K: -9.80548975348938E-12 D: 64.2857142857133 False
K: 99.999999999999 D: 99.9999999999992 False
K: 40.0000000000003 D: 32.4247593774356 True
K: -9.80548975348938E-12 D: 64.2857142857133 False
K: 99.999999999999 D: 99.9999999999992 False
K: 40.0000000000003 D: 32.4247593774356 True
K: -9.80548975348938E-12 D: 64.2857142857133 False
K: 99.999999999999 D: 99.9999999999992 False
K: 40.0000000000003 D: 32.4247593774356 True
It's giving me 3 different sets of values, of which, only the third one is what the actual values are, the 40 and 32 set. And btw, how is there a negative K value? And 99.999999999999 is definitely bigger than 99.9999999999992
And if I do:
Stochastics(7, 14, 1).K[0] > Stochastics(7, 14, 1).D[0]
I get:
K: 99.9999999999902 D: 78.5714285714276 True
K: 49.999999999999 D: 40.7142857142849 True
K: 99.9999999999902 D: 78.5714285714276 True
K: 49.999999999999 D: 44.9999999999992 True
K: 46.666666666667 D: 29.1916766706687 True
K: 46.666666666667 D: 29.1916766706687 True
K: 99.9999999999902 D: 85.7142857142847 True
K: 49.999999999999 D: 46.4285714285706 True
What is going on?
Note: I'm using 3 time intervals.
And, this is using Real Time Data.
EDIT:
I just made a test with just the original interval 5 minutes, printing the values out as time goes:
Print("K: "+ Stochastics(7, 14, 1).K[1] +" D: "+ Stochastics(7, 14, 1).D[1]+ " "+ (Stochastics(7, 14, 1).K[1] > Stochastics(7, 14, 1).D[1]));
This should just give me one set of the same values right? No, I got these as soon as I enable the strategy:
K: 14.2857142857146 D: 49.0377203512988 False
K: 21.4285714285718 D: 42.0989448410947 False
K: 13.3333333333337 D: 36.4849097533754 False
K: 40.0000000000003 D: 32.4247593774356 True
K: 33.3333333333337 D: 29.6678671468591 True
K: 46.666666666667 D: 29.1916766706687 True
K: 53.3333333333336 D: 31.7687074829936 True
etc. etc.
And none of these values are correct, which as of 23:10 EST 9/27/2015, for the 5 minute chart, K is 81.82, D is 41.42
Comment