Created
April 8, 2021 02:54
-
-
Save oilking143/d38b7789729d0377bcdcb0a3ebeb6eca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Nick Rypock Trailing Reverse Function with correction filter | |
and dynamic period of trend calculating | |
Copyright (c) konkop 2001 | |
*/ | |
Parameter: | |
K(Numeric), // %Coeff. of correction | |
Max_per(Numeric) // Max. Dynamic Period for Calculating Trend | |
Variables: Trend(Close), Period(0) | |
// Trend Calculation | |
Value1 = IntraDayMultipier | |
Condition1 = (Close >= Trend) // UpTrend | |
Condition2 = (Close < Trend) // DownTrend | |
// SetUp Period When Trend Begin | |
If ((Close Cross over Trend) or (Close Cross Below Trend)) Then | |
Period = 0 | |
End If | |
If Period < Max_per Then | |
// Counting UpTrends with dynamic period | |
If Condition1 Then | |
Period = Period + 1 | |
Trend = HighestValue(Close, Period) * (1 - (K / 100) / Value1) | |
End If | |
// Counting DownTrends with dynamic period | |
If Condition2 Then | |
Period = Period + 1 | |
Trend = LowestValue(Close, Period) * (1 + (K / 100) / Value1) | |
End If | |
Else | |
// Counting UpTrends with constant period | |
If Condition1 Then | |
Trend = HighestValue(Close, Max_per) * (1 - (K / 100) / Value1) | |
End If | |
// Counting DownTrends with constant period | |
If Condition2 Then | |
Trend = LowestValue(Close, Max_per) * (1 + (K / 100) / Value1) | |
End if | |
End If | |
NRTR = Trend | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment