#==================
# Floor Trader Pivots# FazDane# Last Update 17 Mar 2009
# Shadow Trader Uses the Floor Trader Pivots# PIVOT = (High + Close + Low)/3# R3 = High + 2(Pivot - Low)# R2 = Pivot + (R1 - S1)# R1 = (2*Pivot) - Low# S1 = (2*Pivot) - High# S2 = Pivot - (R1 - S1)# S3 = Low - 2(Hi - Pivot)
input showOnlyToday = NO;input Market_Open_Time = 0930;input Market_Close_Time = 1600;
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] <> 0) then 1 else 0;
rec regHoursHigh = if(high > regHoursHigh[1] and marketOpen, high, if(marketOpen and !firstBar, regHoursHigh[1], high));rec regHoursLow = if(low <> 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);
# PIVOT = (High + Close + Low)/3
rec Piviot = (prevHigh + prevClose + prevLow) / 3;
# R3 = High + 2(Pivot - Low)
rec R3 = prevHigh + 2 * ( Piviot - prevLow );
# S1 = (2*Pivot) - High
rec S1 = (2 * Piviot) - prevHigh; # R1 = (2*Pivot) - Low
rec R1 = (2 * Piviot) - prevLow;
# R2 = Pivot + (R1 - S1)
rec R2 = Piviot + (R1 - S1);
# S2 = Pivot - (R1 - S1)
rec S2 = Piviot - (R1 - S1);
# S3 = Low - 2(Hi - Pivot)
rec S3 = prevLow - 2 * (prevHigh - Piviot);
#Piviot Plotplot PlPiviot = if shouldPlot then Piviot else double.nan;PlPiviot.SetStyle(curve.SHORT_DASH);PlPiviot.SetDefaultColor(color.white);PlPiviot.SetLineWeight(3);
plot Resl = if shouldPlot then R1 else double.nan;Resl.SetDefaultColor(color.dark_red);Resl.SetLineWeight(3);
plot Sup1 = if shouldPlot then S1 else double.nan;Sup1.SetDefaultColor(color.dark_green);Sup1.SetLineWeight(3);
plot Res2 = if shouldPlot then R2 else double.nan;Res2.SetDefaultColor(color.darK_red);Res2.SetStyle(curve.LONG_DASH);Res2.SetLineWeight(3);
plot Sup2 = if shouldPlot then S2 else double.nan;Sup2.SetStyle(curve.LONG_DASH);Sup2.SetDefaultColor(color.dark_green);Sup2.SetLineWeight(3);
plot Res3 = if shouldPlot then R3 else double.nan;Res3.SetDefaultColor(color.light_red);Res3.SetLineWeight(3);
plot Sup3 = if shouldPlot then S3 else double.nan;Sup3.SetDefaultColor(color.light_green);sup3.SetLineWeight(3);sup3.SetLineWeight(3);
#==================
# Floor Trader Pivots# FazDane# Last Update 17 Mar 2009
# Shadow Trader Uses the Floor Trader Pivots# PIVOT = (High + Close + Low)/3# R3 = High + 2(Pivot - Low)# R2 = Pivot + (R1 - S1)# R1 = (2*Pivot) - Low# S1 = (2*Pivot) - High# S2 = Pivot - (R1 - S1)# S3 = Low - 2(Hi - Pivot)
input showOnlyToday = NO;input Market_Open_Time = 0930;input Market_Close_Time = 1600;
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] <> 0) then 1 else 0;
rec regHoursHigh = if(high > regHoursHigh[1] and marketOpen, high, if(marketOpen and !firstBar, regHoursHigh[1], high));rec regHoursLow = if(low <> 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);
# PIVOT = (High + Close + Low)/3
rec Piviot = (prevHigh + prevClose + prevLow) / 3;
# R3 = High + 2(Pivot - Low)
rec R3 = prevHigh + 2 * ( Piviot - prevLow );
# S1 = (2*Pivot) - High
rec S1 = (2 * Piviot) - prevHigh; # R1 = (2*Pivot) - Low
rec R1 = (2 * Piviot) - prevLow;
# R2 = Pivot + (R1 - S1)
rec R2 = Piviot + (R1 - S1);
# S2 = Pivot - (R1 - S1)
rec S2 = Piviot - (R1 - S1);
# S3 = Low - 2(Hi - Pivot)
rec S3 = prevLow - 2 * (prevHigh - Piviot);
#Piviot Plotplot PlPiviot = if shouldPlot then Piviot else double.nan;PlPiviot.SetStyle(curve.SHORT_DASH);PlPiviot.SetDefaultColor(color.white);PlPiviot.SetLineWeight(3);
plot Resl = if shouldPlot then R1 else double.nan;Resl.SetDefaultColor(color.dark_red);Resl.SetLineWeight(3);
plot Sup1 = if shouldPlot then S1 else double.nan;Sup1.SetDefaultColor(color.dark_green);Sup1.SetLineWeight(3);
plot Res2 = if shouldPlot then R2 else double.nan;Res2.SetDefaultColor(color.darK_red);Res2.SetStyle(curve.LONG_DASH);Res2.SetLineWeight(3);
plot Sup2 = if shouldPlot then S2 else double.nan;Sup2.SetStyle(curve.LONG_DASH);Sup2.SetDefaultColor(color.dark_green);Sup2.SetLineWeight(3);
plot Res3 = if shouldPlot then R3 else double.nan;Res3.SetDefaultColor(color.light_red);Res3.SetLineWeight(3);
plot Sup3 = if shouldPlot then S3 else double.nan;Sup3.SetDefaultColor(color.light_green);sup3.SetLineWeight(3);sup3.SetLineWeight(3);
#==================