Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
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.
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
Registered User Joined: 10/7/2004 Posts: 1,006
|
Thank you, Winnie
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |