Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 3/18/2010 Posts: 35
|
In the Sep '10 Tech Analysis Stocks/Commodities mag in Trader's Tips there was a code listing for this strategy. I entered the code but in some cases my candle color doesn't match what is in the figure. Here's what I entered:
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
I can't post my chart but on some days the color is different. Any ideas?
|
|
Registered User Joined: 12/31/2005 Posts: 2,499
|
QUOTE (gllawson) In the Sep '10 Tech Analysis Stocks/Commodities mag in Trader's Tips there was a code listing for this strategy. I entered the code but in some cases my candle color doesn't match what is in the figure.
Here's what I entered:
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
I can't post my chart but on some days the color is different. Any ideas?
|
|
Registered User Joined: 3/18/2010 Posts: 35
|
That worked, thanks!
|
|
Registered User Joined: 8/19/2008 Posts: 19
|
Is it possible to have this as an indicator? One for uptrend and one for down. For example on the uptrend would it be possible to create a line that would show the Highet Low and Lowest high for downtrend.(like figure 5 in S&C,pg20) I would like to be able to use it for backtesting some ideas.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
jtr,
I'm not understanding the two different Indicators thing. You would need to stop Plotting. This could be done by Plotting Single.NaN, but you would probably need to use the Shape Plot Style for it to look even Close to correct (it's not a bad Plot Style to use even for the single Indicator version).
As a single Indicator, the RealCode for an wouldn't be much different than the RealCode for the Paint Scheme (and you can use the RealCode Paint Scheme on it to Paint it if desired - possibly with different colors).
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Clear
'|******************************************************************
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
Swing = -1
HighestLow = Price.Low
LowestHigh = Price.High
End If
If Swing = 1 Then
Plot = HighestLow
Else If Swing = -1 Then
Plot = LowestHigh
Else
Plot = Single.NaN
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |