I think my logic might be wrong here. What I'm trying to do sounds like it should be simple to do, but I'm not sure how to do it with the way TOS scripts work.
I simply was to:
def earnings_day = if(HasEarnings()) then BarNumber() else 0;
def earnings_drift = if(HasEarnings()) then BarNumber() + earnings_drift_length else 0;
AssignPriceColor(if(earnings_day) then Color.LIME else Color.GRAY);
So, on earnings day the variables are set correctly, but then they are set back to 0 and lost the day after. Somehow, I need to maintain those variables so I can evaluate the subsequent days after earnings.
I simply was to:
- Set a length input (I got that part)
- Paint the price bar on the day earnings are reported (I got that part)
- Paint each day after that for the length of bars given (I don't have that part)
- Stop painting the bars after the length of bars is reached
- Repeat the process at the next earnings date.
def earnings_day = if(HasEarnings()) then BarNumber() else 0;
def earnings_drift = if(HasEarnings()) then BarNumber() + earnings_drift_length else 0;
AssignPriceColor(if(earnings_day) then Color.LIME else Color.GRAY);
So, on earnings day the variables are set correctly, but then they are set back to 0 and lost the day after. Somehow, I need to maintain those variables so I can evaluate the subsequent days after earnings.