How To Get Higest And Lowest Bar index

How To Get Higest And Lowest Bar index

Manage alerts

Loading saved threads...

Hesam Aghajani · External communityPost link
External question — Stack Overflow Stack Exchange Author: Hesam Aghajani Original post: https://stackoverflow.com/questions/63816699 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Hello This is my script i convert that from MQL4 to Pinescript it's not Working i test llb and hhb return that was value of of index not that index how can i fix it ? // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © hesamx98 //@version=4 study("My Script") hhb = highest(high,bar_index)[24] llb = lowest(low,bar_index)[24] if bar_index == hhb label.set_text(hhb, "Buy") label.set_color(hhb, color.green) label.set_yloc(hhb, yloc.belowbar) label.set_style(hhb, label.style_labelup) if bar_index == llb label.set_text(llb, "Sell") label.set_color(llb, color.red) label.set_yloc(llb, yloc.abovebar) label.set_style(llb, label.style_labeldown)
Quote
Report
André · External communityPost link
External answer — Stack Overflow Stack Exchange Author: André Original post: https://stackoverflow.com/a/63818158 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. You're passing in bar_index for the length parameter of the functions highest and lowest which doesn't make sense...and then are asking for the value of that from 24 bars ago. I'm guessing you're intending to do something like this: hhb = highest(high, 24)
Quote
Report

Post Reply

Checking account access…