input showlabels=yes; input showarrows=no; input showribbon=yes; input sentimentcandles=yes; input alerts=yes; input arrowsfromtime=930; def ema1 = MovAvgExponential(close, 200, 0, no); def ema2 = MovAvgExponential(close, 72, 0, no); input timeFrame = {default DAY, WEEK, MONTH}; def cap = getAggregationPeriod(); def errorInAggregation = timeFrame == timeFrame.DAY and cap >= AggregationPeriod.WEEK or timeFrame == timeFrame.WEEK and cap >= AggregationPeriod.MONTH; assert(!errorInAggregation, "timeFrame should be not less than current chart aggregation period"); def yyyyMmDd = getYyyyMmDd(); def periodIndx; switch (timeFrame) { case DAY: periodIndx = yyyyMmDd; case WEEK: periodIndx = Floor((daysFromDate(first(yyyyMmDd)) + getDayOfWeek(first(yyyyMmDd))) / 7); case MONTH: periodIndx = roundDown(yyyyMmDd / 100, 0); } def isPeriodRolled = compoundValue(1, periodIndx != periodIndx[1], yes); def volumeSum; def volumeVwapSum; def volumeVwap2Sum; if (isPeriodRolled) { volumeSum = volume; volumeVwapSum = volume * vwap; volumeVwap2Sum = volume * Sqr(vwap); } else { volumeSum = compoundValue(1, volumeSum[1] + volume, volume); volumeVwapSum = compoundValue(1, volumeVwapSum[1] + volume * vwap, volume * vwap); volumeVwap2Sum = compoundValue(1, volumeVwap2Sum[1] + volume * Sqr(vwap), volume * Sqr(vwap)); } def price = volumeVwapSum / volumeSum; def superE= (ema1+ema2+price )/3; def superema=supere; def today=getday()>=getlastDay(); def hi = if today and hi[1]==0 then high else if today and high>hi[1] then high else hi[1] ; def Lo = if today and lo[1]==0 then low else if today and low (hi+lo)/2; def redema= close<(hi+lo)/2; def fifty=superema ; plot BULlish =if today and showribbon and close>fifty and !greenema then lowestAll(low)-5*tickSize() else double.NaN; buLlish.setPaintingStrategy(paintingStrategy.SQUARES); bullish.setDefaultColor(color.WHITE); bullish.setLineWeight(5); plot BULlish2 =if today and showribbon and close>fifty and greenema then lowestAll(low)-5*tickSize() else double.NaN; buLlish2.setPaintingStrategy(paintingStrategy.SQUARES); bullish2.setDefaultColor(color.GREEN); bullish2.setLineWeight(5); plot bearish =if today and showribbon and close=0 and close crosses above fifty then low else double.NaN; bull.setPaintingStrategy(paintingStrategy.ARROW_UP); bull.setDefaultColor(color.green); bull.setLineWeight(3); plot Bear=if showarrows and secondsFromTime(arrowsfromtime)>=0 and close crosses below fifty then high else double.NaN; Bear.setPaintingStrategy(paintingStrategy.ARROW_dOWN); Bear.setDefaultColor(color.red); Bear.setLineWeight(3); addlabel(showlabels and today and close>fifty and !greenema ," NEUTRAL",COLOR.white); addlabel(showlabels and today and close>fifty and greenema ," STRONG BULLISH",COLOR.GREEN); addlabel(showlabels and today and closefifty and greenema then color.green else if today and sentimentcandles and close>fifty and !greenema then color.WHITE else color.curRENT); def green= today and close>fifty and greenema; def red= today and close