Open ricardonunesdev opened 2 years ago
I dont think so. A bullish hammer has a tail that is bigger (2x in this code) than the body. Line 18 identifies the body as (daysClose - days Open). The tail is identified as (daysOpen - daysLow). So the body is <= 2x tail.
Rehan
On Fri, Jan 14, 2022 at 10:04 AM Ricardo Nunes @.***> wrote:
Hi @marcus-n3rd https://github.com/marcus-n3rd,
I love this module and use it everyday.
But it looks like your Bullish Hammer calculation is incorrect.
File: technicalindicators/src/candlestick/BullishHammerStick.ts Line: 18
isBullishHammer = isBullishHammer && (daysClose - daysOpen) <= 2 * (daysOpen - daysLow);
This means that the body should be twice the size of the wick (body <= 2 * wick).
It should be the other way around.
isBullishHammer = isBullishHammer && (daysClose - daysOpen) * 2 <= (daysOpen - daysLow);
Meaning that the wick should be twice the size of the body (2 * body <= wick).
Right?
Best regards, Ricardo Nunes
— Reply to this email directly, view it on GitHub https://github.com/anandanand84/technicalindicators/issues/250, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5VM4ZHAHDSD72XGAWILHLUWBCSLANCNFSM5L7FQ6RA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi @rlmomin,
I agree with your logic, but now with the code.
Example:
If the body has a size of 10 and the tail has a size of 5, 10 <= 5 x 2
returns true, even though this is clearly not a hammer (body@10 is 2x the tail@5).
The actual formula should be 2 x body <= tail
which would return false for the above values 2 x 10 <= 5
but would return true if the body has a size of 5 and the tail a size of 10 (a hammer) 2 x 5 <= 10
.
The logic is correct but the code is reversed.
Best regards, Ricardo Nunes
Yes, you are correct. The formula should be 2 x body <= tail. Thank you for the example. Good catch.
On Fri, Jan 14, 2022 at 11:08 AM Ricardo Nunes @.***> wrote:
Hi @rlmomin https://github.com/rlmomin,
I agree with your logic, but now with the code.
Example: If the body has a size of 10 and the tail has a size of 5, 10 <= 5 x 2 returns true, even though this is clearly not a hammer @. is 2x the @.). The actual formula should be 2 x body <= tail which would return false for the above values 2 x 10 <= 5 but would return true if the body has a size of 5 and the tail a size of 10 (a hammer) 2 x 5 <= 10.
The logic is correct but the code is reversed.
Best regards, Ricardo Nunes
— Reply to this email directly, view it on GitHub https://github.com/anandanand84/technicalindicators/issues/250#issuecomment-1013302640, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5VM43FPKLJDLPS7FOUGM3UWBJ75ANCNFSM5L7FQ6RA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
Created a PR #253 with a fix for this issue.
Hi @anandanand84 and @marcus-n3rd,
I love this module, but it looks like your Bullish Hammer calculation is incorrect.
File: technicalindicators/src/candlestick/BullishHammerStick.ts (link) Line: 18
isBullishHammer = isBullishHammer && (daysClose - daysOpen) <= 2 * (daysOpen - daysLow);
This means that the body should be twice the size of the wick (body <= 2 * wick).
It should be the other way around.
isBullishHammer = isBullishHammer && (daysClose - daysOpen) * 2 <= (daysOpen - daysLow);
Meaning that the wick should be twice the size of the body (2 * body <= wick).
Right?
Best regards, Ricardo Nunes