The BAR
function allows extracting values from chart bars. This function has 5 possible objects. Through it you can extract high, low, open and close prices and also volume from a certain chart bar. As default, values will be extracted from the bar with the same index set in Trigger Indicator Buffer Shift and Confirm Indicator Buffer Shift inputs (depending on whether this condition is a trigger or a confirmation condition), but you can define a different bar index. To do that, you just need to add a semicolon (;
) after the main object and then write the index of the bar you want to get the values from. Keep always in mind that the latest chart bar (most recent one) matches the index 0, the next one the index 1, and so on.
Syntax | bar(object;bar_index) | ||
---|---|---|---|
Parameters | object | Bar object from which the value should be extracted from. It can be any of these keywords: HIGH , LOW , OPEN , CLOSE or VOL . | |
HIGH | Highest price value from the matching chart’s bar. | ||
LOW | Lowest price value from the matching chart’s bar | ||
OPEN | Open price value from the matching chart’s bar. | ||
COSE | Close price value from the matching chart’s bar. | ||
VOL | Volume value from the matching chart’s bar. | ||
bar_index (optional) | Index of the chart’s bar you want to get the values from. This parameter is optional. When not set, it defaults to the values set in Trigger Indicator Buffer Shift and Confirm Indicator Buffer Shift inputs. | ||
Single-sided | No | ||
Example | bar(OPEN)>VAL(1.3450) | ||
This condition triggers the corresponding event if the Open Price of the chart’s bar with the same index as the one set in Trigger Indicator Buffer Shift (since it is a trigger condition) is higher than 1.3450. | |||
bar(CLOSE;2)<VAL(1.3345) | |||
This condition triggers the corresponding event if the Close Price of the chart’s bar with the index 2, which matches the 3rd most recent bar, is lower than 1.3345. |