Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Average high or low over a set number of days Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
riptide681
Posted : Monday, April 7, 2008 8:02:15 AM
Registered User
Joined: 12/13/2006
Posts: 14

In real code, can you use an average high price over say 28 days in the formula?  Thanks

Bruce_L
Posted : Monday, April 7, 2008 2:28:03 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
The normal way to do this would be to create an Indicator for High:

- Select RealCode Editor | Indicator.
- Use the following RealCode:

Plot = Price.High

And then add a Moving Average onto the High. You could then create drag this Moving Average into a new RealCode Indicator, Condition or Paint Brush.

Real Code Volume Multiplier


It is possible to do this entirely using RealCode however.

- Select RealCode Editor | Indicator.
- Use the following RealCode.

'# Period = UserInput.Integer = 28
Static Sum As Single
If isFirstBar Then
    Sum = 0
End If
If CurrentIndex < Period Then
    Sum += Price.High
Else
    Sum += Price.High - Price.High(Period)
End If
If CurrentIndex >= Period-1 Then Plot = Sum/Period

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.