Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Clear Method Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
gllawson
Posted : Sunday, August 29, 2010 7:22:49 PM
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?
jas0501
Posted : Sunday, August 29, 2010 8:39:46 PM
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?
gllawson
Posted : Monday, August 30, 2010 12:36:43 AM
Registered User
Joined: 3/18/2010
Posts: 35
That worked, thanks!
jtr
Posted : Thursday, September 2, 2010 10:43:26 PM
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.
Bruce_L
Posted : Friday, September 3, 2010 8:11:20 AM


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
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.