Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Settings=
- {
- Name = "HV Example",
- period = 8,
- line =
- {
- {
- Name = "HV",
- Color = RGB(255, 0, 0),
- Type = TYPE_LINE,
- Width = 2
- }
- }
- }
- function Init()
- return 1
- end
- function OnCalculate(index)
- if index < Settings.period then
- return nil
- else
- local start_index = index - Settings.period + 1
- local high = H(start_index)
- local low = L(start_index)
- local open = O(start_index)
- for i = start_index, index do
- if H(i) > high then
- high = H(i)
- end
- if L(i) < low then
- low = L(i)
- end
- end
- return (high - low) / open * 16
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement