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 Averages 4, 9, 18 day Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
arathod
Posted : Friday, November 20, 2009 11:58:50 AM
Platinum Customer Platinum Customer

Joined: 10/20/2008
Posts: 357
how can I write a rule for

4 to be above 9
9 to be above 18



but i want to paint it  ONLY the first time this rule is met. (not every bar when they are in that order, otherwise there is too much lights and also cannot scan the first time rule is met.
 
tks much.
Bruce_L
Posted : Friday, November 20, 2009 12:17:16 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
If you Drag and Drop the Moving Averages into the Code tab of the RealCode Editor, it should create something similar to the first three lines of the following RealCode Rule (I had to change variable names assigned so they weren't all just MA):

'# MA4 = indicator.MovingAverage.4
'# MA9 = indicator.MovingAverage.9
'# MA18 = indicator.MovingAverage.18
If MA4.Value > MA9.Value AndAlso _
    MA9.Value > MA18.Value AndAlso _
    (MA4.Value(1) <= MA9.Value(1) OrElse _
    MA9.Value(1) <= MA18.Value(1)) Then Pass

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Winnie
Posted : Sunday, August 18, 2013 1:04:37 AM
Registered User
Joined: 10/7/2004
Posts: 1,006

How is the best way to write a RealCode Condition where the EMA13 is above the EMA26 with a UserIput Period.  If the EMA13 fall below the EMA26 in the UserIput Period it does not pass.

UserInput: EMA13 ( I can Drag and Drop the EMA13 into the Code tab of the RealCode Editor )

UserInput: EMA26 ( I can Drag and Drop the EMA26 into the Code tab of the RealCode Editor )

UserInput: Period 10

 

Thanks Winnie

Winnie
Posted : Sunday, August 18, 2013 10:45:26 AM
Registered User
Joined: 10/7/2004
Posts: 1,006

I forgot to mention, if the EMA13 is above the EMA26 longer than the UserIput Period, it does not pass.

It only passes within the UserInput Period.

Thanks Winnie

Bruce_L
Posted : Monday, August 19, 2013 9:32:17 AM


Worden Trainer

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

All of the same caveats apply:

'# MA13 = chart.MovingAverage.13
'# MA26 = chart.MovingAverage.26
'# Period = UserInput.Integer = 10
Static Count As Integer
If MA13.Value > MA26.Value Then
	Count += 1
Else
	Count = 0
End If
If 0 < Count AndAlso Count <= Period Then
	Pass
End If


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Winnie
Posted : Monday, August 19, 2013 12:25:55 PM
Registered User
Joined: 10/7/2004
Posts: 1,006

Bruce, Thank you; question, why does the program change the first two lines of the RealCode Condition from chart. To indicator.unlinked. as noted below?  It happens when I save the Condition, the results for are the same.

Original Input:

'# MA13 = chart.MovingAverage.3

'# MA26 = chart.MovingAverage

 

Program changed after I saved the condtion to:

'# MA13 = indicator.unlinked.MovingAverage.3

'# MA26 = indicator.unlinked.MovingAverage

Bruce_L
Posted : Monday, August 19, 2013 12:31:17 PM


Worden Trainer

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

Because the saved condition cannot count on the same indicators being available on the chart when it is loaded, it makes copies of the indicators and bottles them into the condition so it can use them when it is added to another chart.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Winnie
Posted : Monday, August 19, 2013 1:10:17 PM
Registered User
Joined: 10/7/2004
Posts: 1,006

Thank you, Winnie

 

 

 

Bruce_L
Posted : Monday, August 19, 2013 1:12:58 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.