Registered User Joined: 12/30/2004 Posts: 123
|
This is my first day using Stockfinder so please understand I'm new at this.
I have just input the code listed September 2010 Traders Tips to calculate the color scheme for the Clear Method and the compiler gives me errors wherever "Line.High" and "Line.Low" are showing. This may be because of a new version of the compiler that does not like "Line". Could you please post code that will compile for the Clear Method. Also, I would like to add a green UP arrow when the color turns green and a red DOWN arrow when the color turns red. Thank you for your help.
CJ
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The RealCode as given will compile when used as a RealCode Paint Scheme.
- Left-click on the Price History to bring up its Edit window.
- Select Paint Scheme | New Paint Scheme.
- Select Edit (to the right of Apply RealCode).
- Replace everything in the RealCode Editor with the following:
Static Swing As Integer
Static HighestLow As Single
Static LowestHigh As Single
If isFirstBar Then
Swing = 0
HighestLow = Line.Low
LowestHigh = Line.High
End If
HighestLow = System.Math.Max(HighestLow, Line.Low)
LowestHigh = System.Math.Min(LowestHigh, Line.High)
If Line.Low > LowestHigh Then
Swing = 1
HighestLow = Line.Low
LowestHigh = Line.High
Else If Line.High < HighestLow Then
Swing = -1
HighestLow = Line.Low
LowestHigh = Line.High
End If
If Swing = 1 Then
PlotColor = Color.Lime
Else If Swing = -1 Then
PlotColor = Color.Red
Else
PlotColor = Color.Yellow
End If
A RealCode Condition that should Pass when the Color Scheme changes from Red to Green could be written as:
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Clear Red to Green
'|******************************************************************
Static Swing As Integer
Static HighestLow As Single
Static LowestHigh As Single
If isFirstBar Then
Swing = 0
HighestLow = Price.Low
LowestHigh = Price.High
End If
HighestLow = System.Math.Max(HighestLow, Price.Low)
LowestHigh = System.Math.Min(LowestHigh, Price.High)
If Price.Low > LowestHigh Then
If Swing = -1 Then
Pass
End If
Swing = 1
HighestLow = Price.Low
LowestHigh = Price.High
Else If Price.High < HighestLow Then
Swing = -1
HighestLow = Price.Low
LowestHigh = Price.High
End If
A RealCode Condition that should Pass when the Color Scheme changes from Green to Red could be written as:
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Clear Green to Red
'|******************************************************************
Static Swing As Integer
Static HighestLow As Single
Static LowestHigh As Single
If isFirstBar Then
Swing = 0
HighestLow = Price.Low
LowestHigh = Price.High
End If
HighestLow = System.Math.Max(HighestLow, Price.Low)
LowestHigh = System.Math.Min(LowestHigh, Price.High)
If Price.Low > LowestHigh Then
Swing = 1
HighestLow = Price.Low
LowestHigh = Price.High
Else If Price.High < HighestLow Then
If Swing = 1 Then
Pass
End If
Swing = -1
HighestLow = Price.Low
LowestHigh = Price.High
End If
Right-clicking on the Conditions after they are created and selecting Show True Markers will bring up an Edit window for the True Marker for the Condition allowing you to adjust the Color and Style as desired.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|