Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/7/2004 Posts: 56
|
'# period = userinput.integer = 10
Dim MinL As Single
MinL = Price.MinLow(Period)
plot = MinL.AVG(Period)
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I'm not a programmer, but I'll try to explain it the best I can.
MinL is a variable of the Single data type (it only returns one value). You would need something that returns a RealCodeIndicatorCalculation data type (which returns a dated series of values) to chain the methods together because AVG(Period) requires multiple values for its calculations.
The RealCode API lists the outputs types of the RealCode Methods and Properties.
There isn't a method that returns a minimum as a RealCodeIndicatorCalculation data type of which I am aware.
So you could do a Moving Average first and then a minimum (which would obviously not return the same Value):
'# Period = UserInput.Integer
Plot = Price.MovingAverage(Period).MinLow(Period)
But not a minimum first and then a Moving Average without importing the minimum as an Indicator (the first line was created by Dragging and Dropping a Max or Min of Line Indicator into the RealCode Editor).
'# MoMo = chart.MaxorMinofLine
'# Period = UserInput.Integer = 10
Plot = MoMo.AVG(Period)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 56
|
I thought there was only a syntax error in that code. This explanation would have never occured to me. You probably explain things better because you're not a programmer.
I looked up in RealCode API the difference between MovingAverage and AVG methods however I noticed that neither MovingAverage(period, barStyle) nor AVG(period, barStyle) work when I copy-paste into editor the examples given:
Plot = price.MovingAverage(30,RealCodeIndicator.BarValue.High).XAVG(5)
plot = price.AVG(30,RealCodeIndicator.BarValue.Low).Value
AVGH, AVGL, AVGO cannot be used to chain more functions with, so how to use average of High or Low with other functions?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I think you need to substitute the Indicator of interest for RealCodeIndicator. So the first example would actually look like:
Plot = Price.MovingAverage(30, Price.BarValue.High).XAVG(5)
While the second example would actually look like:
Plot = Price.AVG(30, Price.BarValue.Low).Value
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 56
|
AAhh! Of course.
Thank you, Bruce.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |