Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 12/29/2006 Posts: 44
|
is there any heikin ashi candle layout or code available i could download for SF?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I've seen at least two possibilities. Please try the following RealCode Indicator for the version where the HaOpen equals the previous HaOpen plus the previous HaClose divided by two:
Static HaO As Single
Static HaC As Single
If isFirstBar Then
HaO = Price.Open
Else
HaO = (HaO + HaC) / 2
End If
HaC = (Price.Open + Price.High + Price.Low + Price.Close) / 4
openValue = HaO
highValue = System.Math.Max(HaO, Price.High)
lowValue = System.Math.Min(HaO, Price.Low)
Plot = HaC
Or the following RealCode Indicator for the version where the HaOpen equals the previous HaOpen plus the previous Close (not HaClose) divided by two:
Static HaO As Single
Static HaC As Single
If isFirstBar Then
HaO = Price.Open
Else
HaO = (HaO + Price.Last(1)) / 2
End If
HaC = (Price.Open + Price.High + Price.Low + Price.Close) / 4
openValue = HaO
highValue = System.Math.Max(HaO, Price.High)
lowValue = System.Math.Min(HaO, Price.Low)
Plot = HaC
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/29/2006 Posts: 44
|
thx bruce. that works well - just wondering if you had any idea how i could code colors: red for down and green for up. and create an ability to have a rule which says buy the first green candle without a lower wick, and vice versa on the short side. thx again.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
There are again two major possibilities for Painting the Indicator. The first RealCode Paint Brush compares the current Close to the previous Close for up and down days (right-click on the Indicator, select Edit Colors, check Paint Indicator with RealCode and then Edit):
If Line.Value > Line.Value(1) Then
PlotColor = Color.Green
Else If Line.Value < Line.Value(1) Then
PlotColor = Color.Red
Else
PlotColor = Color.Yellow
End If
While the second RealCode Paint Brush compares the current Close to the current Open for up and down days:
If Line.Value > Line.Open Then
PlotColor = Color.Green
Else If Line.Value < Line.Open Then
PlotColor = Color.Red
Else
PlotColor = Color.Yellow
End If
That there are two ways to color the Indicator means there are two different ways the Rules could be interpreted as well. I'll start with the version comparing the current Close to the previous Close. Based on your description, I think the Buy RealCode Rule would be (you need to Drag and Drop the Heikin Ashi Indicator into the RealCode to create something similar to the first line):
'# HA = indicator.HeikinAshi
'# Cumulative
Static State As Integer
If isFirstBar Then
State = 0
Else
If State = 0 AndAlso _
HA.Value > HA.Value(1) Then
State = 1
End If
If State = 1 AndAlso _
HA.Low = System.Math.Min(HA.Open, HA.Value) Then
State = 2
End If
If HA.Value <= HA.Value(1) Then
State = 0
End If
End If
If State = 2 Then
Pass
State = 3
End If
While the Short RealCode Rule would be:
'# HA = indicator.HeikinAshi
'# Cumulative
Static State As Integer
If isFirstBar Then
State = 0
Else
If State = 0 AndAlso _
HA.Value < HA.Value(1) Then
State = 1
End If
If State = 1 AndAlso _
HA.High = System.Math.Max(HA.Open, HA.Value) Then
State = 2
End If
If HA.Value >= HA.Value(1) Then
State = 0
End If
End If
If State = 2 Then
Pass
State = 3
End If
If you are comparing the current Close to the current Open, I think the Buy RealCode Rule would be:
'# HA = indicator.HeikinAshi
'# Cumulative
Static State As Integer
If isFirstBar Then State = 0
If State = 0 AndAlso _
HA.Value > HA.Open Then
State = 1
End If
If State = 1 AndAlso _
HA.Low = HA.Open Then
State = 2
End If
If HA.Value <= HA.Open Then
State = 0
End If
If State = 2 Then
Pass
State = 3
End If
While the Short RealCode Rule would be:
'# HA = indicator.HeikinAshi
'# Cumulative
Static State As Integer
If isFirstBar Then State = 0
If State = 0 AndAlso _
HA.Value < HA.Open Then
State = 1
End If
If State = 1 AndAlso _
HA.High = HA.Open Then
State = 2
End If
If HA.Value >= HA.Open Then
State = 0
End If
If State = 2 Then
Pass
State = 3
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 4/30/2010 Posts: 3
|
I am new to StockFinder and tried to use the code for the Heikin Ashi candle. When I pasted the code from the forum it only generated a line like a separate indicator. Please let me know the step by which I would plaqce the code to create the candles in my price chart. Thanks!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Keith_stl,
You need to change the Plot Style. Right-click on the Indicator and select Edit. Then change the Plot Style to Candlestick, HLC Bar or OHLC Bar.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 4/30/2010 Posts: 3
|
Thanks Bruce, I got that to work on my chart. I like to use the Heikin Ashi candle with the Ichimoku Cloud. Is it possible to have the Heikin Ashicandle and Ichimoku Cloud in the same chart?
Keith
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Keith_stl,
Drag and Drop the Heikin Ashi Candle Indicator to the Ichimoku Cloud Indicator and select Overlay. Then right-click on the Heikin Ashi Candle Indicator and select Scaling | Scale With | (pretty much anything in the Ichimoku Cloud Indicator).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 4/30/2010 Posts: 3
|
Perfect. Thanks for your fast response.
|
|
Registered User Joined: 4/20/2010 Posts: 20
|
Nice job Bruce. The painted HA bars are a thing of beauty. I'm a new user and had just sent in a suggestion/request the other day for HA bars.
|
|
Registered User Joined: 2/28/2005 Posts: 825
|
While in edit to change from Line to Candlestick I then moved to the right (Paint Scheme) and selected Colored Candles from the drop down menu thus getting my red/green candlesticks.Eliminating the need for additional code .
|
|
Guest-1 |