Daily candle count and Color into lower time to apply more intraday filter.

Hi All,

I want to calculate daily candle count and previous day candle color into intraday time Frame.

The result is correct in daily time Frame , When I switch to lower time frame 1 hours, result is not showing correctly.

CandleColor 	= IIf( C > O , 1, IIf( C < O , -1, Null ) );
ChangeSignal	=IIf(CandleColor==Ref(CandleColor,-1), 0, 1);
CandleCount 	=BarsSince(ChangeSignal)+1;
barClosePct		=IIf(CandleColor==1,(High-Close)*100/(High-Low), IIf(CandleColor==-1, (Close -Low)*100/ (High-Low), 99));

preCandleColor	=TimeFrameExpand(CandleColor, inDaily, mode);
preCandleCount	=TimeFrameExpand(CandleCount, inDaily, mode);
preBarClosePct	=TimeFrameExpand(BarClosePct, inDaily, mode);
preDate			=TimeFrameExpand(todayDate, inDaily, mode);

AddColumn(preDate, "preDate", 1);
AddColumn( preCandleColor, "preCandleColor", 1 ); 
AddColumn( preCandleCount, "preCandleCount", 1); 
AddColumn( preBarClosePct, "preBarClosePct", 1.2 );

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.