Login Page - Create Account

Support Board


Date/Time: Fri, 14 Mar 2025 18:42:35 +0000



Post From: CBBOAC Formula - Average of Time

[2022-06-24 03:32:24]
SavantTrader - Posts: 110
Within a CBBOAC, I am wanting to take an average of the last 3 values of the [Numbers Bars Calculated Values][Bar Duration](SG30) and compare it to the current value of [Bar Duration](SG30).

However, due to the fact that (obviously) Bar Duration is expressed as time, I'm not able to compare the "average" to anything.

Can someone tell me how I can take the average of a time value [Bar Duration] and compare it against the current bar's duration (plus 60%)?

For example, I am able to do this for other things, such as ATR:

IDx.SG1>IDy.SG1*1.6 (where x=ATR study, y=EMA of ATR)
This asks "is the current bar ATR greater than 160% of the EMA (over whatever period the EMA study is set for)"

I would like to do the above with [Bar Duration] but the comparison becomes meaningless.

Is there a way to accomplish the above using only a CBBOAC formula?

I can compare durations to a constant by doing this:

IDx.SG1>TIMEVALUE("00:02:01"),

However, instead of a constant, I'd like to compare it to the EMA of the time values.

If this is still unclear, how can I do this (which fails due to illegal comparison):

IDx.SG1>IDy.SG1*1.6 where x=bar duration, y=EMA of bar duration.

Thank you... any tips or hints appreciated. I'm stuck on this one.
Date Time Of Last Edit: 2022-06-24 07:00:35