Cwparker23
Member
Code:
################################
# Original script by Cwparker23#
################################
# Original script by Cwparker23 #
#-----------------
#DISCLAIMER
#-----------------
#I am not a certified financial advisor. The content of this page/site and tools are for informational purposes only and does not constitute financial or legal advice. Under no circumstances will the author be responsible for errors or use of this tool and site. User assumes all risks.
input TimeFrame1 = AggregationPeriod.DAY;
input showOnlyLastPeriod = yes;
def prevPrice = open(period = TimeFrame1)[-1];
plot OPEN = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else open (period = TimeFrame1);
OPEN.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
OPEN.SetDefaultColor(Color.WHITE);
OPEN.SetLineWeight (2);
def H = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else high(period = TimeFrame1);
def L = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else low(period = TimeFrame1);
##############################################
input length = 10;
def Data2 = HIGH (period = TimeFrame1) - open (period = TimeFrame1);
def Data3 = open (period = TimeFrame1) - LOW (period = TimeFrame1);
def avg2 = Average(Data2, length);
def avg3 = Average(Data3, length);
def SDh = StDev(Data2, length);
def dh = avg2 + (1 * SDh);
def SD2h = StDev(Data2, length);
def d2h = avg2 + (2 * SD2h);
def SDd = StDev(Data3, length);
def dd = avg3 + (1 * SDd);
def SD2d = StDev(Data3, length);
def d2d = avg3 + (2 * SD2d);
plot RHavg = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else open (period = TimeFrame1) + avg2;
RHavg.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
RHavg.SetDefaultColor(Color.DARK_ORANGE);
RHavg.SetLineWeight (2);
plot RLavg = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else open (period = TimeFrame1) - avg3;
RLavg.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
RLavg.SetDefaultColor(Color.DARK_ORANGE);
RLavg.SetLineWeight (2);
plot RmidAvg = (rlavg + rhavg)/2 ;
RmidAvg.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
RmidAvg.SetDefaultColor(Color.pink);
RmidAvg.SetLineWeight (2);
plot RHsd1 = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else open (period = TimeFrame1) + dh;
plot RLsd1 = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else open (period = TimeFrame1) - dd;
plot RHsd2 = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else open (period = TimeFrame1) + d2h;
plot RLsd2 = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else open (period = TimeFrame1) - d2d;
RHsd1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
RHsd1.SetDefaultColor(Color.YELLOW);
RHsd1.SetLineWeight (2);
RLsd1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
RLsd1.SetDefaultColor(Color.YELLOW);
RLsd1.SetLineWeight (2);
RHsd2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
RHsd2.SetDefaultColor(Color.YELLOW);
RHsd2.SetLineWeight (2);
RLsd2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
RLsd2.SetDefaultColor(Color.YELLOW);
RLsd2.SetLineWeight (2);
DefineGlobalColor("SD2 LOWER", Color.YELLOW);
DefineGlobalColor("SD2 UPPER", Color.YELLOW);
AddCloud(RHsd2, RHsd1, GlobalColor("SD2 UPPER"), GlobalColor("SD2 UPPER"));
AddCloud(RLsd1, RLsd2, GlobalColor("SD2 LOWER"), GlobalColor("SD2 LOWER"));
DefineGlobalColor("SD1 UPPER", Color.DARK_ORANGE);
DefineGlobalColor("SD1 LOWER", Color.DARK_ORANGE);
AddCloud(RHavg, RHsd1, GlobalColor("SD1 UPPER"), GlobalColor("SD1 UPPER"));
AddCloud(RLavg, RLsd1, GlobalColor("SD1 LOWER"), GlobalColor("SD1 LOWER"));
plot Sma_C = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else Average(CLOSE(period = TimeFrame1), length);
Sma_C.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Sma_C.SetDefaultColor(Color.BLUE);
Sma_C.SetLineWeight (2);
plot LowestLow = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else Lowest(LOW(period = TimeFrame1), length);
LowestLow.SetDefaultColor(GetColor(8));
LowestLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LowestLow.SetDefaultColor(Color.CYAN);
LowestLow.SetLineWeight (2);
plot HighestHigh = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else Highest(high(period = TimeFrame1), length);
HighestHigh.SetDefaultColor(GetColor(1));
HighestHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
HighestHigh.SetDefaultColor(Color.CYAN);
HighestHigh.SetLineWeight (2);
plot MidPoint = (HighestHigh + LowestLow)/2;
MidPoint.SetDefaultColor(GetColor(1));
MidPoint.SetPaintingStrategy(PaintingStrategy.dASHES);
MidPoint.SetDefaultColor(Color.CYAN);
MidPoint.SetLineWeight (1);
input ShowBubbles = yes;
input MoveShowBubbles = 5;
def X1 = MoveShowBubbles + 1;
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , RmidAvg , Concat( " Rmid Avg | ", AsDollars (RmidAvg)) , Color.pink, no);
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , Sma_C , Concat( " SMA_C | ", AsDollars (Sma_C)) , Color.BLUE, no);
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , HighestHigh , Concat( " Highest High | ", AsDollars (HighestHigh)) , Color.CYAN, yes);
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , LowestLow , Concat( " Lowest Low | ", AsDollars (LowestLow)) , Color.CYAN, no);
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , MidPoint , Concat( " Mid Point | ", AsDollars (MidPoint)) , Color.CYAN, no);
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , MidPoint , Concat( " Mid Point | ", AsDollars (MidPoint)) , Color.CYAN, no);
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , OPEN , Concat( " Open | ", AsDollars (OPEN)) , Color.WHITE, no);
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , RHavg , Concat( " RHavg | ", AsDollars (RHavg)) , Color.DARK_ORANGE, yes);
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , RLavg , Concat( " RLavg | ", AsDollars (RLavg)) , Color.DARK_ORANGE, NO);
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , RHsd1 , Concat( " SD1 | ", AsDollars (RHsd1)) , Color.YELLOW, yes);
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , RHsd2 , Concat( " SD2 | ", AsDollars (RHsd2)) , Color.YELLOW, yes);
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , RLsd1 , Concat( " SD1 | ", AsDollars (RLsd1)) , Color.YELLOW, no);
AddChartBubble(ShowBubbles and !IsNaN(close[X1]) and IsNaN(close[MoveShowBubbles]) , RLsd2 , Concat( " SD2 | ", AsDollars (RLsd2)) , Color.YELLOW, no);