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 |

MOVING AVERAGE 1 on dochian bottom Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
arathod
Posted : Wednesday, August 27, 2014 7:41:35 PM
Platinum Customer Platinum Customer

Joined: 10/20/2008
Posts: 357

How to create that condition that as long as donch moves up, we have a continouos true condition. the condition becomes untrue i.e. false only when the MA falls. Thank you.

Bruce_L
Posted : Thursday, August 28, 2014 10:37:52 AM


Worden Trainer

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

You could use something to the logic in the following to create your own RealCode Condition.

'# Cumulative
'# MA = chart.MovingAverage
Static Up As Boolean
If isFirstBar OrElse _
	MA.Value < MA.Value(1) = True Then
	Up = False
Else If MA.Value > MA.Value(1) = True Then
	Up = True
End If
If Up = True Then
	Pass
End If


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
arathod
Posted : Friday, August 29, 2014 6:08:29 PM
Platinum Customer Platinum Customer

Joined: 10/20/2008
Posts: 357

Bruce, Somehow this returned that result that included the true condition even when the MA fell. could you please look into it. My MA was ma 1 of ratio of price to price for symbol. Have a nice long weekend! Thank you. 

Bruce_L
Posted : Tuesday, September 2, 2014 1:04:45 PM


Worden Trainer

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

It absolutely does not do so on my computer. It just works and it seems to work correctly. Do you have specific example symbols where it is not working for you? If so, I would also need the settings of the Donchian Channels and the parent indicator of the Donchian Channels to try and troubleshoot the issue on my end.

Is the Donchian Channel of something other than price?

RealCode rounds imported indicators to two digits past the decimal place, so it is possible for the moving average of the lower Donchian Channel to have moved down and not trigger the change from true to false if the value of the moving average before and after are the same when rounded to two digits past the decimal. This should only happen if the Donchian Channel is of something besides common stock prices however.

The only way to get around this rounding is to not import an indicator into the RealCode and to calculate the lower Donchian Channel value within the RealCode. The following RealCode Condition does this for price (but you generally shouldn't need it for price).

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.1 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Lower Donchian Increasing
'|******************************************************************
'# Cumulative
'# Period = UserInput.Integer = 15
'# Offset = UserInput.Integer = 1
Static Up As Single
If isFirstBar Then
	Up = False
End If
If CurrentIndex > Period + Offset Then
	If Price.MinLow(Period, Offset) > _
		Price.MinLow(Period, Offset + 1) Then
		Up = True
	Else If Price.MinLow(Period, Offset) < _
		Price.MinLow(Period, Offset + 1) Then
		Up = False
	End If
	If Up = True Then
		Pass
	End If
Else
	SetIndexInvalid
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.