Registered User Joined: 10/14/2008 Posts: 23
|
I'm creating a realcode paintbrush. I'm using a moving average and MACD histogram. The system automatically created '# variables named MA and MH, resp. I'm getting an error message "MA not declared" and "MH not declared"
Doesn't the '# line constitute a declaration? Code as Follows:
'# MH = indicator.MACDHistogram
'# MA = indicator.MovingAverage.6 '11Bar EMA
If MA.Value > MA.Value(1) And MH.Value > MH.Value(1) Then
PlotColor = Color.Green
ElseIf MA.Value < MA.Value(1) And MH.Value < MH.Value(1) Then
PlotColor = Color.Red
Else
PlotColor = Color.Blue
End If
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
My assumption is the formatting looks as follows:
'# MH = indicator.MACDHistogram
'# MA = indicator.MovingAverage.6
'11Bar EMA
If MA.Value > MA.Value(1) And MH.Value > MH.Value(1) Then
PlotColor = Color.Green
ElseIf MA.Value < MA.Value(1) And MH.Value < MH.Value(1) Then
PlotColor = Color.Red
Else PlotColor = Color.Blue
End If
Based on the assigned names, I'm also going to assume this is in SF4 and not in SF5. When I just paste your RealCode into the Paint Brush for Price History on my Charts I get the same messages. That said, if I add Moving Average.6 and a MACD Histogram Indicators to the Charts, the error messages go away and the Price History is Painted based on the RealCode Paint Brush.
Do you still have the Moving Average and MACD Histogram on the same Chart where you are attempting to use the RealCode Paint Brush? StockFinder 5 has the abilitiy to use reference Indicators that aren't Charted (using slightly different syntax), but StockFinder 4 does not.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|