OK I feel like this should be a much simpler solve than it has proved to be. Need help.
I have a working ORB indicator that plots 3 lines:
I want to create a cloud that dynamically changes colors based on price action, using the lines/plots above.
1. NO cloud color until price closes above or below the opening range
2. Find the first break of the opening range
3a. If this first break of ORB is a break of the range low, then the cloud is RED and the cloud is painted between the MID and the LOW
3b. The cloud would stay RED until there is a close above the range high - then the cloud would switch to green (but still using the MID and LOW)
4a. If the first break of the ORB is a break of the range high, then the cloud is GREEN and the cloud is painted between the MID and the HIGH
4b. The cloud would stay GREEN until there is a close below the range low - then the cloud would switch to RED (but still using the MID and HIGH)
For the life of me, I cannot figure this out.
I've tried if/then statements in my addcloud, two separate addcloud, etc.
But I am doing something wrong and would love some help.
But I'm clueless at this point on adding "conditional/dynamic" cloud using AddCloud (or multiple AddCloud)
I have a working ORB indicator that plots 3 lines:
- plot Range_High = Range_Top;
- plot Range_Low = Range_Below;
- plot Range_Mid = (Range_High + Range_Low)/2;
I want to create a cloud that dynamically changes colors based on price action, using the lines/plots above.
1. NO cloud color until price closes above or below the opening range
2. Find the first break of the opening range
3a. If this first break of ORB is a break of the range low, then the cloud is RED and the cloud is painted between the MID and the LOW
3b. The cloud would stay RED until there is a close above the range high - then the cloud would switch to green (but still using the MID and LOW)
4a. If the first break of the ORB is a break of the range high, then the cloud is GREEN and the cloud is painted between the MID and the HIGH
4b. The cloud would stay GREEN until there is a close below the range low - then the cloud would switch to RED (but still using the MID and HIGH)
For the life of me, I cannot figure this out.
I've tried if/then statements in my addcloud, two separate addcloud, etc.
But I am doing something wrong and would love some help.
But I'm clueless at this point on adding "conditional/dynamic" cloud using AddCloud (or multiple AddCloud)
Code:
#------ Inputs for ORB plots
input PeriodStartTime = 0930;
input PeriodEndTime = 0939;
#------ Definitions for ORB plots
def Range_Top = if SecondsFromTime(PeriodEndTime) >= 0 then Range_Top[1] else
if SecondsFromTime(PeriodStartTime) == 0 then high else
if SecondsFromTime(PeriodStartTime) < 0 then Double.NaN else
if SecondsFromTime(PeriodStartTime) > 0 and SecondsFromTime(PeriodEndTime) <= 0
and high > Range_Top[1] then high else Range_Top[1];
def Range_Below = if SecondsFromTime(PeriodEndTime) >= 0 then Range_Below[1] else
if SecondsFromTime(PeriodStartTime) == 0 then low else
if SecondsFromTime(PeriodStartTime) < 0 then Double.NaN else
if SecondsFromTime(PeriodStartTime) > 0 and SecondsFromTime(PeriodEndTime) <= 0
and low < Range_Below[1] then low else Range_Below[1];
plot Range_High = Range_Top;
plot Range_Low = Range_Below;
plot Range_Mid = (Range_High + Range_Low)/2;
Last edited by a moderator: