Well it took me a while but i dived into thinkscript. And luckily it is much differnt than ninja.I can usually trudge my way through. Anyway this hasnt been fully tested but it appears to work well.
If any of you listen to shadow trader he uses certain pivot points. Well i coded them for tos now.
It is adjustable for open times. I suggest setting chart to day only then adjusting time to that.
It is also adjustable to show pviots above or below. Basically when you have allot of pivots the screen gets squished and you lose perspective. Well you can adjust it so it only shows the pivots when the price is towards them. as in its only gonna show s1 pivot and s2 until price break say s1 then you will see pivot s1, and s2.
thanks
tim
here is a pic with the dynamic turned on, hence only three levels but no squished chart
here is with off so you see all the lines. note the chart kinda squished
and the code
#built by timmyb, tradersbase.com
input DynamicHide = {"No", default "Yes"};
input showOnlyToday = YES;
input Market_Open_Time = 0830;
input Market_Close_Time = 1616;
def h = DynamicHide;
def day = getDay();
def lastDay = getLastDay();
def isToday = if(day == lastDay, 1, 0);
def shouldPlot = if(showOnlyToday and isToday, 1, if(!showOnlyToday, 1, 0));
def pastOpen = if((secondsTillTime(Market_Open_Time) > 0), 0, 1);
def pastClose = if((secondsTillTime(Market_Close_Time) > 0), 0, 1);
def marketOpen = if(pastOpen and !pastClose, 1, 0);
def firstBar = if (day[1] != day, 1, 0);
def closingBell = if secondsTillTime(Market_Close_Time)[1] > 0 and
secondsTillTime(Market_Close_Time) <= 0 or
(secondsTillTime(Market_Close_Time)[1] < secondsTillTime(Market_Close_Time)
and secondsTillTime(Market_Close_Time)[1] > 0) then 1 else 0;
rec lclose = if IsNaN(close[-1]) then lclose[1] else close;
rec regHoursHigh = if(high > regHoursHigh[1] and marketOpen, high,
if(marketOpen and !firstBar, regHoursHigh[1], high));
rec regHoursLow = if(low < regHoursLow[1] and marketOpen, low,
if(marketOpen and regHoursLow[1] > 0 and !firstBar, regHoursLow[1], low));
rec runningClose = compoundValue(1, if closingbell then close[1] else runningClose[1], close);
rec prevClose = compoundValue(1, if closingBell then runningClose else prevClose[1], close);
rec prevHigh = compoundValue(1, if closingBell then regHoursHigh[1] else prevHigh[1], high);
rec prevLow = compoundValue(1, if closingBell then regHourslow[1] else prevlow[1], low);
rec prevHigh2 = compoundValue(1, if closingBell then prevHigh[1] else prevHigh2[1], high);
rec prevLow2 = compoundValue(1, if closingBell then prevLow[1] else prevlow2[1], low);
plot pivot = if shouldPlot then (prevHigh + prevClose + prevLow) / 3 else double.nan;
pivot.SetStyle(curve.FIRM);
pivot.SetDefaultColor(color.BLACK);
plot s1 = if shouldPlot then (2 * pivot) - prevHigh else double.nan;
s1.SetStyle(curve.FIRM);
s1.SetDefaultColor(color.dark_green);
plot r1 = if shouldPlot then (2 * pivot) - prevLow else double.nan;
r1.SetStyle(curve.FIRM);
r1.SetDefaultColor(color.DaRK_RED);
plot r2 = if shouldPlot then pivot + ( r1 - s1) else double.nan;
r2.SetStyle(curve.FIRM);
r2.SetDefaultColor(color.DaRK_RED);
plot s2 = if shouldPlot then pivot - ( r1 - s1) else double.nan;
s2.SetStyle(curve.FIRM);
s2.SetDefaultColor(color.DaRK_GREEN);
plot s3 = if shouldPlot then prevLow - 2 * (prevHigh - pivot) else double.nan;
s3.SetStyle(curve.FIRM);
s3.SetDefaultColor(color.DaRK_GREEN);
plot r3 = if shouldPlot then prevHigh + 2 * (pivot - prevLow) else double.nan;
r3.SetStyle(curve.FIRM);
r3.SetDefaultColor(color.DaRK_RED);
pivot.setHiding(h and (lclose > r2 or lclose < s2));
r1.setHiding(h and lclose < s1);
r2.setHiding(h and lclose < r1);
r3.setHiding(h and lclose < r2);
s1.setHiding(h and lclose > r1);
s2.setHiding(h and lclose > s1);
s3.setHiding(h and lclose > s2);