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
|
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
|