It plots correctly on my system. I tested it on an hour chart. You
have to plot it on the shortest time frame chart you use. If you want
to see it in an hour chart then use an hour chart and the day values
will staircase just as you said. On an hour plot the flat period is 7
bars.
It may seem to jump to the next day's value but remember there are
6.5 hours in a trading day. The hour plot for the "last hour" will
extend into the next day, well not really. I use IB and it gets
weirder since IB does not time stamp their data and my "last bar" is
16:14 but then I also have another "last bar" at 16:15 using ER2
futures contract. Try plotting using 24 hours and see if that makes a
difference. That way you won't have a half hour as the last hour and
will plot differently.
You calculated three other values inDaily. You have to expand them
before you write them to the interpretation window. Also,
you use the
same name in the settimeframe and after you expanded it. That may
work but it is confusing. Had you used different names you might have
caught the error of not expanding the other three variables. I would
use something like this. I prefaced the expanded values with an "e"
rather than "r" to differentiate the two.
ePivot = TimeFrameExpand( Rpivot, inDaily );
eHigh = TimeFrameExpand( PHigh, inDaily );
eLow = TimeFrameExpand( PLow, inDaily );
eClose = TimeFrameExpand( PClose, inDaily );
"PHigh: " + NumToStr( eHigh, 1.2 );
"PLow: " + NumToStr( eLow, 1.2 );
"PClose: " + NumToStr( eClose, 1.2 );
Plot(ePivot, "Rolling Pivot",colorLightGr ey);
Barry
--- In amibroker@xxxxxxxxx ps.com, James <jamesmemphis@ ...> wrote:
>
> Hello,
> I cannot
figure out how to get the following indicator to plot
correctly using TimeFrameExpand. It always seems to go to the next
days value on the last bar of the previous day. I am looking at this
on ES futures, but it should be the same on stocks. Regardless of the
time frame I have selected, 5min, 15min, 30min, etc. the indicator
staircases to the next days value on the last bar of the day. Doesn't
matter if you are looking at 24 hours or day session. It could
probably be fixed with x-shift, but that wouldn't be the proper fix
because PClose is being calculated improperly.
> Also, is there any way to get rid of the staircases in a line and
just have the horizontal values, ie., just a horizontal line for each
day.
> Thanks in advance,
> James
>
> SetFormulaName ("Rolling Pivot");
> TimeFrameSet
> RollPer = Param("Period" , 3, 1, 20, 1);
> PHigh =
HHV(Ref(H,-1) ,RollPer) ;
> PLow = LLV(Ref(L,-1) ,RollPer) ;
> PClose = Ref(C,-1);
> RPivot = (PHigh + PLow + Pclose)/3;TimeFrame Restore
> RPivot = TimeFrameExpand( Rpivot,
inDaily );"PHigh: ""PLow: ""PClose: "Plot(RPivot, "Rolling
Pivot",colorLightGr ey); + NumToStr( PClose, 1.2 ); + NumToStr( PLow,
1.2 ); + NumToStr( PHigh, 1.2 );();( inDaily );
>