简体   繁体   中英

Get high and low of previous condition candle

I am trying to figure out how to get the high and low of the most recent previous candle that meets one of my conditions. I know to get a prior candles high you can use the [1], but if I do not know the number of how far back the previous candle is, how can I approach this?

high and low of most recent candle that has met condition

I have tried to use the calling prior data function with brackets, however, the problem is I am unaware as to how far back the last occurrence of the condition being met is, and it is always changing so I can not have a static number inside the brackets.

When your condition is met, you should record the bar_index:

if myconditionismet then
    BarIndexWhenConditionIsMet := bar_index

Then you can use BarIndexWhenConditionIsMet to retrieve the high and the low your are looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM