You can see in the code below that under both Daily/Weekly timeframes there is a condition with the same name bbUP. This appears to be causing an issue and I am unsure why? Basically when I sort by C9 [bbUP], the correct value is returned ie BollingerUP[20](Close) for the daily bar. HOWEVER when I change bbUP[1], it doesn’t return the value for the previous daily bar but rather the BB for previous weekly bar!!?
TIMEFRAME(daily)
// def inds
ma20 = average[20](close)
bbUP = BollingerUP[20](close)
//ma50 higher than prior day
c1 = ma20 > ma20[1]
c8 = high>bbUP
c9=bbUP[1]
TIMEFRAME(weekly)
//def inds
ma40 = average[40](close)
ma80 = average[80](close)
ma200 = average[200](Close)
bbUP = BollingerUP[20](close)
bbDW = BollingerDown[20](close)
//40 period ma (200day ma) trending higher
c2 = ma40[1] > ma40[3]
//200 period ma trending higher
c3 = ma200>ma200[5]
Anyone able to provide some much needed insight?
JSParticipant
Senior
Hi,
You can’t use the same variable name in different time frames, this causes confusion…
For example, use:
bbUPDaily
bbUPWeekly
I guessed as much, I already adjusted the code accordingly.