Login Page - Create Account

Support Board


Date/Time: Thu, 16 May 2024 03:04:38 +0000



Post From: Color bar

[2017-09-04 14:36:07]
Sawtooth - Posts: 3997
You'll need two instances of the Color Bar Based On Alert Condition study, one for each color/direction.

Try this:
Put these formulas on the alerts tab of the respective color bar study:

Green bar:
=OR(
AND(ID1.SG1>ID1.SG1[-1],ID2.SG2[-2]>ID2.SG2[-1],ID2.SG2>ID2.SG2[-1]),
AND(ID1.SG1[-2]>ID1.SG1[-1],ID1.SG1>ID1.SG1[-1],ID2.SG2>ID2.SG2[-1])
)
Red bar:
=OR(
AND(ID1.SG1<ID1.SG1[-1],ID2.SG2[-2]<ID2.SG2[-1],ID2.SG2<ID2.SG2[-1]),
AND(ID1.SG1[-2]<ID1.SG1[-1],ID1.SG1<ID1.SG1[-1],ID2.SG2<ID2.SG2[-1])
)
where the EMA is ID1 and the MACD is ID2; edit as needed.

These formulas will color the price bar at the first occurrence of both lines sloped in the same direction.

Limitation: a missed coloring might occur if any line segments are equal to the previous.
The solution to this is to use different formulas in a spreadsheet study, as in this example in post #6:
alert condition kijun sen