full candle %
Forums › ProRealTime English forum › ProBuilder support › full candle %
- This topic has 7 replies, 3 voices, and was last updated 4 years ago by jebus89.
-
-
07/07/2020 at 4:31 PM #138656
Created an indicator showing how much of a candle = the body of the candle, but im getting some weird results, 99% of the candles look correct, but im getting some that are above 100% which shouldnt happen. Would love some help as to why this is happening.
12345678910a = high-lowif close > open thenb = close - openelsif close < open thenb = open - closeendifc = (b/a)*100return c07/07/2020 at 4:35 PM #138658Nevermind i think i have solved it myself by adding this to the code:
12345678910111213141516a = high-lowif close > open thenb = close - openelsif close < open thenb = open - closeendifc = (b/a)*100if c > 100 thenc = 0elsif c < 100 thenc = cendifreturn cI think what went wrong is that when open = close then it got buggy..
07/07/2020 at 4:53 PM #138661Lines 2-6 can be written in just one line:
1b = abs(close - open)07/07/2020 at 5:26 PM #138665Lines 2-6 can be written in just one line:
1b = abs(close – open)Could you explain how the abs piece of code replaces mine? 🙂
While your at it Roberto, could you help me with how to write this piece of code more simple if its possible?
123if a or a[1] or a[2] or a[3] or a[4] thenb = 1endif07/07/2020 at 5:56 PM #138672Because when CLOSE > OPEN you have, say, 100, while when CLOSE < OPEN you have -100. ABS() is a function that converts negative numbers into positive numbers, so the result will always be positive (which is what you need).
The answer to the second question is:
1b = (summation[5](a) > 0) //will sum a[0] through a[4] and if the result is > 0 will assign the logical value 1 (true) to b07/07/2020 at 5:59 PM #13867307/07/2020 at 6:00 PM #138674Too fast again Roberto!
1 user thanked author for this post.
07/07/2020 at 6:13 PM #138677 -
AuthorPosts
Find exclusive trading pro-tools on