Registered User Joined: 4/12/2008 Posts: 41
|
I want to create a rule in RC that points out peaks or swing highs, the rule does this:At least 5 lower highs to the left, AND TO THE RIGHT of the bar. Whats the syntax? Thanks
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If you want a Rule that would identify this at the correct Point on the Chart, you could try something like the following if the Highs only need to be lower than the center High:
If Price.MaxHigh(5, -5) < Price.High AndAlso _
Price.MaxHigh(5, 1) < Price.High Then Pass
If you want a Rule that would identify this at the correct Point on the Chart, you could try something like the following if the Highs need to be lower than the adjacent High closest to the center High:
If Price.High(-5) < Price.High(-4) AndAlso _
Price.High(-4) < Price.High(-3) AndAlso _
Price.High(-3) < Price.High(-2) AndAlso _
Price.High(-2) < Price.High(-1) AndAlso _
Price.High(-1) < Price.High AndAlso _
Price.High(1) < Price.High AndAlso _
Price.High(2) < Price.High(1) AndAlso _
Price.High(3) < Price.High(2) AndAlso _
Price.High(4) < Price.High(3) AndAlso _
Price.High(5) < Price.High(4) Then Pass
These sorts of Rules use future values however and should never be used in Backtesting. If you are going to use the Rules in BackScanner you should create a Rule for when the swing high was detected, not for Bar which actually was the swing high. This involves adding 5 to all of the Offsets in the RealCode. If you want a Rule that would identify a pivot high where it was detected, you could try something like the following if the Highs only need to be lower than the center High:
If Price.MaxHigh(5) < Price.High(5) AndAlso _
Price.MaxHigh(5, 6) < Price.High(5) Then Pass
If you want a Rule that would identify a pivot high where it was detected, you could try something like the following if the Highs need to be lower than the adjacent High closest to the center High:
If Price.High < Price.High(1) AndAlso _
Price.High(1) < Price.High(2) AndAlso _
Price.High(2) < Price.High(3) AndAlso _
Price.High(3) < Price.High(4) AndAlso _
Price.High(4) < Price.High AndAlso _
Price.High(6 ) < Price.High AndAlso _
Price.High(7) < Price.High(6 ) AndAlso _
Price.High(8) < Price.High(7) AndAlso _
Price.High(9) < Price.High(8) AndAlso _
Price.High(10) < Price.High(9) Then Pass
-Bruce Personal Criteria Formulas TC2000 Support Articles
|