Module: DhanHQ::Analysis::MoneynessHelper

Defined in:
lib/dhanhq/analysis/helpers/moneyness_helper.rb

Overview

Helper module to determine the recommended moneyness (ITM/ATM/OTM) based on market conditions

Class Method Summary collapse

Class Method Details

.pick_moneyness(indicators:, min_adx:, strong_adx:, bias: nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dhanhq/analysis/helpers/moneyness_helper.rb', line 9

def pick_moneyness(indicators:, min_adx:, strong_adx:, bias: nil)
  # Mark bias as intentionally observed for future rules
  bias&.to_sym

  m60 = indicators[:m60] || {}
  adx = m60[:adx].to_f
  rsi = m60[:rsi].to_f

  return :atm if adx < min_adx
  return :otm if adx >= strong_adx && rsi >= 60

  :atm
end