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 |

Request Real Code Indicators for Candles,Condensed Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
jsatt11
Posted : Friday, February 6, 2015 1:50:39 PM
Registered User
Joined: 11/26/2007
Posts: 116

Bruce,


The Feb 2015 S&C has an article 'Candlesticks,Condensed'. It uses three calculations to form the candle Signature.
I would like to have the Real Code indicator created for Candle Signature, and additionally  three separate indicators for HO, HC, and OL.
I need to have the segment count and moving average range editable.
The  calculations are:
Candle signature = HO-HC-OL where:
 HO = Round(((( high - open) / Candle range ) * Rangemultiplier) / Segment divisor)
 HC = Round(((( high - close) / Candle range ) * Rangemultiplier) / Segment divisor)
 OL = Round(((( open - low) / Candle range ) * Range multiplier) / Segment divisor)
 
The other calculation specifications are:
 Segment count = Number of slices into which the average range candle will be cut
 Segment divisor = 100/segment count
 Average range = N-period moving average of range
 Candle range = High - low
 Range multiplier = Candle range/average range
 Candle range = Candle range / 100
 Range multiplier = Range multiplier > 1, 1, rangemultiplier
 
Thank you for all you do for us!
Jim

 

Bruce_L
Posted : Friday, February 6, 2015 4:03:21 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

I've tried to format this in as close as possible to description given in the Trader's Tips to show that programming this can be done in a pretty straightforward manner.

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Candle Signature
'|******************************************************************
'# SegmentCount = UserInput.Integer = 5
'# AvgPeriod = UserInput.Integer = 10
If CurrentIndex >= AvgPeriod - 1 Then
Dim averageRange As Single = Price.AVGH(AvgPeriod) - Price.AVGL(AVGPeriod)
Dim segmentDivisor As Single = 100 / SegmentCount
Dim candleRange As Single = Price.TradeRange
Dim rangeMultiplier As Single = candleRange / averageRange
candleRange = candleRange / 100
If rangeMultiplier > 1 Then rangeMultiplier = 1
Dim HO As Single = Math.Round((Price.High - Price.Open) / _
	candleRange * rangeMultiplier / segmentDivisor)
Dim HC As Single = Math.Round((Price.High - Price.Close) / _
	candleRange * rangeMultiplier / segmentDivisor)
Dim OL As Single = Math.Round((Price.Open - Price.Low) / _
		candleRange * rangeMultiplier / segmentDivisor)
	OpenValue = HO
	HighValue = HC
	LowValue = OL
	Plot = OL
Else
	OpenValue = Single.NaN
	HighValue = Single.NaN
	LowValue = Single.NaN
	Plot = Single.NaN
End If

Note that it outputs OL twice because there isn't a data format in StockFinder which outputs just three values.

You can 1-period moving averages and set the Average of to Open to extract HO, to High to extract HC or to Low or Close to extract OL.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jsatt11
Posted : Monday, February 9, 2015 9:44:16 AM
Registered User
Joined: 11/26/2007
Posts: 116

Bruce,

Thanks for coding the Condensed Candles. It looks good. But I would like to have the HO, HC and OL as separate indicators. When I create them with the 1-period MA, then drag them  to my new real code condition I get errors after draging the second MA to the condition.

The error is "Protected ReadOnly Property MA() as WBI CommonBlocks ScriptingLine' has multiple definitions with identicle signatures."

Is there a way I can resolve this to get my three indicators on my real code condition?

 

 
Bruce_L
Posted : Tuesday, February 10, 2015 1:14:31 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Candle Signature HO
'|******************************************************************
'# SegmentCount = UserInput.Integer = 5
'# AvgPeriod = UserInput.Integer = 10
If CurrentIndex >= AvgPeriod - 1 Then
	Dim averageRange As Single = Price.AVGH(AvgPeriod) - Price.AVGL(AVGPeriod)
	Dim segmentDivisor As Single = 100 / SegmentCount
	Dim candleRange As Single = Price.TradeRange
	Dim rangeMultiplier As Single = candleRange / averageRange
	candleRange = candleRange / 100
	If rangeMultiplier > 1 Then rangeMultiplier = 1
	Dim HO As Single = Math.Round((Price.High - Price.Open) / _
		candleRange * rangeMultiplier / segmentDivisor)
	Plot = HO
Else
	Plot = Single.NaN
End If


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Bruce_L
Posted : Tuesday, February 10, 2015 1:15:44 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Candle Signature HC
'|******************************************************************
'# SegmentCount = UserInput.Integer = 5
'# AvgPeriod = UserInput.Integer = 10
If CurrentIndex >= AvgPeriod - 1 Then
	Dim averageRange As Single = Price.AVGH(AvgPeriod) - Price.AVGL(AVGPeriod)
	Dim segmentDivisor As Single = 100 / SegmentCount
	Dim candleRange As Single = Price.TradeRange
	Dim rangeMultiplier As Single = candleRange / averageRange
	candleRange = candleRange / 100
	If rangeMultiplier > 1 Then rangeMultiplier = 1
	Dim HC As Single = Math.Round((Price.High - Price.Close) / _
		candleRange * rangeMultiplier / segmentDivisor)
	Plot = HC
Else
	Plot = Single.NaN
End If


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Bruce_L
Posted : Tuesday, February 10, 2015 1:16:57 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Candle Signature OL
'|******************************************************************
'# SegmentCount = UserInput.Integer = 5
'# AvgPeriod = UserInput.Integer = 10
If CurrentIndex >= AvgPeriod - 1 Then
	Dim averageRange As Single = Price.AVGH(AvgPeriod) - Price.AVGL(AVGPeriod)
	Dim segmentDivisor As Single = 100 / SegmentCount
	Dim candleRange As Single = Price.TradeRange
	Dim rangeMultiplier As Single = candleRange / averageRange
	candleRange = candleRange / 100
	If rangeMultiplier > 1 Then rangeMultiplier = 1
	Dim OL As Single = Math.Round((Price.Open - Price.Low) / _
		candleRange * rangeMultiplier / segmentDivisor)
	Plot = OL
Else
	Plot = Single.NaN
End If


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jsatt11
Posted : Tuesday, February 10, 2015 8:42:34 PM
Registered User
Joined: 11/26/2007
Posts: 116

Bruce,

I created the 3 indicators and created a condition per below.

'# MIH = chart.MyIndicatorHO
'# MIO = chart.MyIndicatorOL
'# MIH = chart.MyIndicatorHC
 

If MIH.value = 1 AndAlso MIO.value = 2 AndAlso MIH.value = 3 Then pass

But got same error:

"Protected ReadOnly Property MIH() as WBI CommonBlocks ScriptingLine' has multiple definitions with identicle signatures."

 

 
 
Bruce_L
Posted : Wednesday, February 11, 2015 2:05:00 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

They need to have different names. So maybe something like the following instead.

'# MIHO = chart.MyIndicatorHO
'# MIOL = chart.MyIndicatorOL
'# MIHC = chart.MyIndicatorHC


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jsatt11
Posted : Wednesday, February 11, 2015 3:05:44 PM
Registered User
Joined: 11/26/2007
Posts: 116

Bruce,

It looks like it is working. Thanks! Now on to more testing.

 

Jim

Bruce_L
Posted : Wednesday, February 11, 2015 3:12:08 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.



-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.