Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Platinum Customer
Joined: 10/20/2008 Posts: 357
|
How to make an indicator or condition that is true if the
donchian bottom keeps rising or stays at the same level. It should be false if it moves down and stay down. Thank you.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following RealCode Condition. The DCTop and DCBottom lines were created by dragging and dropping the Donchian Channels into the Code tab of the RealCode Editor.
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Donchian Bottom
'|******************************************************************
'# DCTop = chart.DonchianChannels.0
'# DCBottom = chart.DonchianChannels.1
Static Direction As Integer
If isFirstBar Then
Direction = 0
End If
If DCBottom.Value > DCBottom.Value(1) Then
Direction = 1
Else If DCBottom.Value < DCBottom.Value(1) Then
Direction = -1
End If
If Direction = 0 Then
SetIndexInvalid
Else
If Direction = 1 Then
Pass
End If
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 10/20/2008 Posts: 357
|
Thanks Bruce. But it did not work for YNDX. The donch bottom started falling but the signal did not cease. Appreciate your help. Basically I want to buy when the donch bottom is rising. (specifically, donch bottom of the ratio of price to sp-500). Thank you very much.
|
|
Platinum Customer
Joined: 10/20/2008 Posts: 357
|
Let me futher clarify. I think what is happening is that your code takes into account top donch also. But I want to focus on bottom donch only. Thank you.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Using the default 15 period Donchain Channels applied to price history, the condition is most definitely working on my computer. The two most recent times it is true on a daily chart of YNDX are from December 3, 2013 through January 23, 2014 and February 26, 2014 and March 3, 2014.
The top Donchian Channel is not used at all in the calculations. It just shows up because that is what happens when you drag and drop the Donchian Channels into the RealCode?
Do you have more than one set of Donchian Channels plotted on the chart? Does the name of the Donchian Channels as imported into the RealCode match the Donchian Channels on the chart and are they still linked?
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 10/20/2008 Posts: 357
|
Thanks. My bad.
I have a request though. I tried to apply it to donch on a ratio or price history to price for symbol but did not work. Is there a way to make it work on a ratio please? Thank you.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It should work on any Donchian Channels. You just need to drag and drop those particular Donchian Channels into the RealCode to create the DCTop and DCBottom lines.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |