I translated the following PCF to RealCode, I hope there is more compact RealCode version.
9 * ((C0 < AVGC10.0 AND AVGC20.0 < AVG(AVGC20.0,3)) - (C0 > AVGC10.0 AND AVGC20.0 > AVG(AVGC20.0,3))) +
8 * ((C1 < AVGC10.1 AND AVGC20.1 < AVG(AVGC20.1,3)) - (C1 > AVGC10.1 AND AVGC20.1 > AVG(AVGC20.1,3))) +
7 * ((C2 < AVGC10.2 AND AVGC20.2 < AVG(AVGC20.2,3)) - (C2 > AVGC10.2 AND AVGC20.2 > AVG(AVGC20.2,3))) +
6 * ((C3 < AVGC10.3 AND AVGC20.3 < AVG(AVGC20.3,3)) - (C3 > AVGC10.3 AND AVGC20.3 > AVG(AVGC20.3,3))) +
5 * ((C4 < AVGC10.4 AND AVGC20.4 < AVG(AVGC20.4,3)) - (C4 > AVGC10.4 AND AVGC20.4 > AVG(AVGC20.4,3))) +
4 * ((C5 < AVGC10.5 AND AVGC20.5 < AVG(AVGC20.5,3)) - (C5 > AVGC10.5 AND AVGC20.5 > AVG(AVGC20.5,3))) +
3 * ((C6 < AVGC10.6 AND AVGC20.6 < AVG(AVGC20.6,3)) - (C6 > AVGC10.6 AND AVGC20.6 > AVG(AVGC20.6,3))) +
2 * ((C7 < AVGC10.7 AND AVGC20.7 < AVG(AVGC20.7,3)) - (C7 > AVGC10.7 AND AVGC20.7 > AVG(AVGC20.7,3))) +
1 * ((C8 < AVGC10.8 AND AVGC20.8 < AVG(AVGC20.8,3)) - (C8 > AVGC10.8 AND AVGC20.8 > AVG(AVGC20.8,3)))) = 1
Dim cum1 As Single
Dim cum2 As Single
Dim cum3 As Single
cum1 = 0
cum2 = 0
If price.close < price.AVGC(10) And PRICE.AVGC(20, 0) < (price.AVGC(20) + price.AVGC(20, 1) + price.AVGC(20, 2)) / 3 Then
cum1 = -1
Else
cum1 = 0
End If
If price.close > price.AVGC(10) And PRICE.AVGC(20, 0) > (price.AVGC(20) + price.AVGC(20, 1) + price.AVGC(20, 2)) / 3 Then
cum2 = -1
Else
cum2 = 0
End If
cum3 = 9 * (cum1 - cum2)
If price.close(1) < price.AVGC(10, 1) And PRICE.AVGC(20, 1) < (price.AVGC(20, 1) + price.AVGC(20, 2) + price.AVGC(20, 3)) / 3 Then
cum1 = -1
Else
cum1 = 0
End If
If price.close(1) > price.AVGC(10, 1) And PRICE.AVGC(20, 1) > (price.AVGC(20, 1) + price.AVGC(20, 2) + price.AVGC(20, 3)) / 3 Then
cum2 = -1
Else
cum2 = 0
End If
cum3 = cum3 + (8 * (cum1 - cum2))
If price.close(2) < price.AVGC(10, 2) And PRICE.AVGC(20, 2) < (price.AVGC(20, 2) + price.AVGC(20, 3) + price.AVGC(20, 4)) / 3 Then
cum1 = -1
Else
cum1 = 0
End If
If price.close(2) > price.AVGC(10, 2) And PRICE.AVGC(20, 1) > (price.AVGC(20, 2) + price.AVGC(20, 3) + price.AVGC(20, 4)) / 3 Then
cum2 = -1
Else
cum2 = 0
End If
cum3 = cum3 + (7 * (cum1 - cum2))
If price.close(3) < price.AVGC(10, 3) And PRICE.AVGC(20, 3) < (price.AVGC(20, 3) + price.AVGC(20, 4) + price.AVGC(20, 5)) / 3 Then
cum1 = -1
Else
cum1 = 0
End If
If price.close(3) > price.AVGC(10, 3) And PRICE.AVGC(20, 3) > (price.AVGC(20, 3) + price.AVGC(20, 4) + price.AVGC(20, 5)) / 3 Then
cum2 = -1
Else
cum2 = 0
End If
cum3 = cum3 + (6 * (cum1 - cum2))
If price.close(4) < price.AVGC(10, 4) And PRICE.AVGC(20, 4) < (price.AVGC(20, 4) + price.AVGC(20, 5) + price.AVGC(20, 6)) / 3 Then
cum1 = -1
Else
cum1 = 0
End If
If price.close(4) > price.AVGC(10, 4) And PRICE.AVGC(20, 4) > (price.AVGC(20, 4) + price.AVGC(20, 5) + price.AVGC(20, 6)) / 3 Then
cum2 = -1
Else
cum2 = 0
End If
cum3 = cum3 + (5 * (cum1 - cum2))
If price.close(5) < price.AVGC(10, 5) And PRICE.AVGC(20, 5) < (price.AVGC(20, 5) + price.AVGC(20, 6) + price.AVGC(20, 7)) / 3 Then
cum1 = -1
Else
cum1 = 0
End If
If price.close(5) > price.AVGC(10, 5) And PRICE.AVGC(20, 5) > (price.AVGC(20, 5) + price.AVGC(20, 6) + price.AVGC(20, 7)) / 3 Then
cum2 = -1
Else
cum2 = 0
End If
cum3 = cum3 + (4 * (cum1 - cum2))
If price.close(6) < price.AVGC(10, 6) And PRICE.AVGC(20, 6) < (price.AVGC(20, 6) + price.AVGC(20, 7) + price.AVGC(20, 8)) / 3 Then
cum1 = -1
Else
cum1 = 0
End If
If price.close(6) > price.AVGC(10, 6) And PRICE.AVGC(20, 6) > (price.AVGC(20, 6) + price.AVGC(20, 7) + price.AVGC(20, 8)) / 3 Then
cum2 = -1
Else
cum2 = 0
End If
cum3 = cum3 + (3 * (cum1 - cum2))
If price.close(7) < price.AVGC(10, 7) And PRICE.AVGC(20, 7) < (price.AVGC(20, 7) + price.AVGC(20, 8) + price.AVGC(20, 9)) / 3 Then
cum1 = -1
Else
cum1 = 0
End If
If price.close(7) > price.AVGC(10, 7) And PRICE.AVGC(20, 7) > (price.AVGC(20, 7) + price.AVGC(20, 8) + price.AVGC(20, 9)) / 3 Then
cum2 = -1
Else
cum2 = 0
End If
cum3 = cum3 + (2 * (cum1 - cum2))
If price.close(8) < price.AVGC(10, 8) And PRICE.AVGC(20, 8) < (price.AVGC(20, 8) + price.AVGC(20, 9) + price.AVGC(20, 10)) / 3 Then
cum1 = -1
Else
cum1 = 0
End If
If price.close(8) > price.AVGC(10, 8) And PRICE.AVGC(20, 8) > (price.AVGC(20, 8) + price.AVGC(20, 9) + price.AVGC(20, 10)) / 3 Then
cum2 = -1
Else
cum2 = 0
End If
cum3 = cum3 + (1 * (cum1 - cum2))
If system.Math.Sign(cum3) = 1 Then
plot = 1
Else
plot = 0
End If