In the simple code below I using a one minute chart of the S&P Emini and I've added a 5min data series of the same symbol (data2). When the the 5 min adx is turned up (ADX2Value > ADX2Value[1]) I want the 1 min candlesticks to be painted green when and stay green while this condition is met.
What is happening is one candlestick turns green every 5 minutes while the condition is meet. For example: If the 5 min adx turns up and and remains up lets say for 20 minutes. I will get a green candle at lets say at 00:05 then another green candle at 00:10 and again at 00:15 and again at 00:20.
I would like the one min candlestick to be painted in real time when the 5 min adx turns up, lets say that happens to be 00:03 and each candle to stay painted green while the condition is meet.
If you would please advise, I've worked on this for quite so time and can not figure how to do this....Thank you!
Code: Select all
inputs:
ADXLenght ( 10 );
variables:
ADX2Value( 0 );
ADX2Value = ADX( ADXLenght ) of Data2 ;
if
ADX2Value > ADX2Value[1] then
PlotPaintBar(High, Low, Open, Close, "Data1", green)
else
PlotPaintBar(High, Low, Open, Close, "Data1", White) ;
Mac