thinkscript

# hint: AAAAAAAAAAAA_Jin # – Version: 21 # – By: Mr Stockboto # – Release Date: June 11, 2017 #hint: 5 Day Volume Period Weighted Moving Average (VWAP), #hint: Mid Point half way between Weighted Moving Average (WMA) 34 and Hull MA (HMA) 5, TTM Squeeze, #hint: Day VWAP based McClellan Summation Index # This script displays: # 5 Day Ago Anchored VWAP. # WMA 34, Mid Point, with a cloud between the two. # Blue Cloud Mid Point is above WMA 34. Red Cloud Mid Point is below WMA 34 # Labels at top left of chart display: # VWAP # Green when price is above the VWAP Line, Red price is currently below VWAP Line. # Cyan when within VWAPCrossWithin number of bars from close crossing any VWAP line. # +2 means price is above VWAP +2 line. # +1 price is above VWAP +1 line, but below the +2 line # Line price is betwen the VWAP line and the +/- 1 line. Which can be determined by Red/Green color. # -1 price is below VWAP +1 line, but above the -1 line # -2 means price is below VWAP +2 line. # (#) number within () is the number of bars since close crossed the indicated VWAP line # Cloud # Red Mid Point is below WMA 34. Green Mid Point is below WMA 34. # (#) number within () is number of bars since Mid Point Crossed WMA # Slope # Green Slope is positive, Red Slope value is negative (i.e. below zero) # +/_# is the slope value. # (#) number within () is number of bars since slope flipped above/below zero. # Change # Green Change is positive, Red Change value is negative (i.e. below zero) # +/_# is the Change value. There is no (#) for Change. # MSI # Green MSI is positive, Red MSI value is negative (i.e. below zero) # +/_# is the MSI value. There is no (#) for MSI. # TTM # Green when TTM Squeeze Histogram is above zero # Red when Histogram is below zero # Gray when Histogram is zero # Letter N indicate Normal, S indicates TTM is currently in a Squeeze. # (#) number within () indicates number of bars since TTM Histogram crossed above/below zero. # CYAN / DARK GRAY boxes to the right of each component label contains the parameter value # assigned to each. It is dark gray when the cross happened beyond the parameter number of bars, # it is cyan when the cross happened within shown # of bars. Except for Change, change is a range # of +/- # shown, so if parameter is set to 5, then it will be dark gray when change is greater # than or equal to negative 5 and less than or equal to positive 5. It will be cyan when # the value of change is beyond that range. declare lower; # # # # # # # # # # # # # # # # # # # # # # # # # BEGIN PARAMETERS SECTION # # # # # # # # # # # # # # # # # # # # # # # # # # input VWAPIntraAnchor = 5; input VWAPDaysAnchor = 22; input ShowFlags = yes; input ShowVWAP = no; input ShowMSI = yes; input ShowSlope = yes; input ShowMACloud = no; input ShowFlipLabels = yes; input ShowVFI = no; input ShowVFISlope = no; input ShowVFILabels = yes; input ShowMSILabels = yes; input ShowRTHBorders = yes; input MACrossWithin = 5; input VWAPCrossWithin = 5; input TTMCrossWithin = 5; input TTMCrossLevel = 2; input SlopeCrossWithin = 5; input Change5Beyond = 5; input Change15Beyond = 25; input ChangeDayBeyond = 10; # # # # # # # # # # # # # # # # # # # # # # # # # # # # BEGIN GLOBAL VARIABLES SECTION # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def ConfirmSlopeChange = if GetAggregationPeriod() < AggregationPeriod.THIRTY_MIN then .01 else if GetAggregationPeriod() == AggregationPeriod.THIRTY_MIN then .01 else .01; def currentDate = GetYYYYMMDD(); def firstChartDate = LowestAll(currentDate); def lastTradingDate = if !IsNaN(close) and IsNaN(close[-1]) then currentDate else Double.NaN; def lastChartDate = HighestAll(lastTradingDate); def daysTillLast = CountTradingDays( if currentDate > lastChartDate then lastChartDate else currentDate, lastChartDate); # This process provides variables identifying begin and end of the day # and the true begin and end of regular trading hours, if extended hours are # displayed or not, regardless of stock/future instrument displayed on the chart # without requiring the user to provide any values such as 0930 for start time. def RTHStart = RegularTradingStart(GetYYYYMMDD()); def RTHEnd = RegularTradingEnd(GetYYYYMMDD()); def startDay = if RTHStart != RTHStart[1] then yes else no; def endDay = if RTHEnd != RTHEnd[1] then yes else no; def isTradingHours = if GetTime() >= RegularTradingStart(GetYYYYMMDD()) and GetTime() <= RegularTradingEnd(GetYYYYMMDD()) then yes else no; def tradingStart = if isTradingHours and (!isTradingHours[1] or startDay) then yes else no; def tradingEnd = if isTradingHours[1] and (!isTradingHours or endDay) then yes else no; # # # # # # # # # # # # # # # # # # # # # # # BEGIN SCRIPTS SECTION # # # # # # # # # # # # # # # # # # # # # # # # script Normalize { input CurrentValue = 0; input OldScaleHigh = 1; input OldScaleLow = 0; input NewScaleHigh = 1; input NewScaleLow = 0; def ValueAsPercent = 1 – ((OldScaleHigh – CurrentValue) / (OldScaleHigh – OldScaleLow)); plot Value = (ValueAsPercent * (NewScaleHigh – NewScaleLow)) + NewScaleLow; } # END script Normalize # # # # # # # # # # # # # # # # # # # # # # # # # # # # BEGIN MOVING AVERAGE SECTION # # # # # # # # # # # # # # # # # # # # # # # # # # # # input hma5AverageType = AverageType.SIMPLE; input hma5Period = 5; input wma34AverageType = AverageType.WEIGHTED; input wma34Period = 34; def maMultiplier = 1000; def hma5 = MovingAverage(hma5AverageType, close, hma5Period); plot wma34 = MovingAverage(wma34AverageType, close, wma34Period); plot midPoint = wma34 + ((hma5 – wma34) / 2); def MaLongFlag = if midPoint[1] < wma34[1] and midPoint >= wma34 then yes else no; def MaShortFlag = if midPoint[1] >= wma34[1] and midPoint < wma34 then yes else no; def MaCrossBar = if MaLongFlag or MaShortFlag then BarNumber() else MaCrossBar[1]; def MaFromCross = BarNumber() – MaCrossBar; def MaInRange = if MaFromCross <= MACrossWithin then yes else no; def GreenCloud = if midPoint >= wma34 then yes else no; def RedCloud = if midPoint < wma34 then yes else no; # # # # # # # # # # # # # # # # # # # # # # # # # # # BEGIN TTM_SQUEEZE SECTION # # # # # # # # # # # # # # # # # # # # # # # # # # # def TTMSqueeze = TTM_Squeeze().SqueezeAlert; def TTMHistogram = TTM_Squeeze().Histogram; def TTMLongFlag = if (TTMHistogram[1] < TTMCrossLevel and TTMHistogram >= TTMCrossLevel) then yes else no; def TTMShortFlag = if TTMHistogram[1] >= -TTMCrossLevel and TTMHistogram < -TTMCrossLevel then yes else no; def TTMCrossBar = if TTMLongFlag or TTMShortFlag then BarNumber() else TTMCrossBar[1]; def TTMFromCross = BarNumber() – TTMCrossBar; def TTMInRange = if TTMFromCross <= TTMCrossWithin then yes else no; def GreenTTM = if TTMHistogram >= TTMCrossLevel then yes else no; def RedTTM = if TTMHistogram < -TTMCrossLevel then yes else no; def TTMUp = TTMHistogram > TTMHistogram[1]; def TTMDown = TTMHistogram < TTMHistogram[1]; # # # # # # # # # # # # # # # # # # # # # # # # BEGIN VWAP SECTION # # # # # # # # # # # # # # # # # # # # # # # # input vwapMidWidth = 1.0; input vwapWideWidth = 2.0; input vwapSlopeLength = 5; input vwapSlopeLookBack = 8; def AnchorDaysAgo = if GetAggregationPeriod() < AggregationPeriod.DAY then VWAPIntraAnchor else VWAPDaysAnchor; def totalChartDays = CountTradingDays( firstChartDate, lastChartDate); #def totalChartDays = lastChartDate – firstChartDate; def remainder = totalChartDays % AnchorDaysAgo; def newDay = CompoundValue(1, currentDate != currentDate[1], yes); def dayNumber = if BarNumber() == 0 then 0 else if newDay then dayNumber[1] + 1 else dayNumber[1]; def anchorCount = if BarNumber() == 0 then 0 else if newDay and dayNumber < remainder – 1 then 1 else if newDay and anchorCount[1] == AnchorDaysAgo then 1 else if newDay then anchorCount[1] + 1 else anchorCount[1]; def volumeSum; def volumeVwapSum; def volumeVwap2Sum; if newDay and anchorCount == 1 { 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 deviation = Sqrt(Max(volumeVwap2Sum / volumeSum – Sqr(price), 0)); plot vwapLine = price; plot vwapMidUpper = price + vwapMidWidth * deviation; plot vwapMidLower = price + -vwapMidWidth * deviation; plot vwapWideUpper = price + vwapWideWidth * deviation; plot vwapWideLower = price + -vwapWideWidth * deviation; def vwapSlope = ((vwapLine – vwapLine[vwapSlopeLength]) / vwapSlopeLength) / close * 100000; def vwapSlopeUp = if vwapSlope[vwapSlopeLookBack] > 1 then yes else no; def vwapSlopeDn = if vwapSlope[vwapSlopeLookBack] < -1 then yes else no; def vwapSlopeUpFlag = if vwapSlopeLength == fold i1 = 0 to vwapSlopeLength while vwapSlopeUp[i1] do i1 then yes else no; def vwapSlopeDnFlag = if vwapSlopeLength == fold i2 = 0 to vwapSlopeLength while vwapSlopeDn[i2] do i2 then yes else no; def vwapCrossBar; vwapCrossBar = if (close[1] < vwapWideUpper and close > vwapWideUpper) or (close[1] > vwapWideUpper and close < vwapWideUpper) or (close[1] > vwapWideLower and close < vwapWideLower) or (close[1] < vwapWideLower and close > vwapWideLower) or (close[1] > vwapMidUpper and close < vwapMidUpper) or (close[1] < vwapMidUpper and close > vwapMidUpper) or (close[1] > vwapMidLower and close < vwapMidLower) or (close[1] < vwapMidLower and close > vwapMidLower) or (close[1] > vwapLine and close < vwapLine) or (close[1] < vwapLine and close > vwapLine) then BarNumber() else vwapCrossBar[1]; def vwapFromCross = BarNumber() – vwapCrossBar; def vwapInRange = if vwapFromCross <= VWAPCrossWithin then yes else no; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # BEGIN McClellan Summation Index SECTION # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def mcFastLength = 8; def mcSlowLength = 21; def mcMultiplier = 1000; def SlopeLength = 5; def SlopeLookBack = 8; def IsCumulative = yes; def RatioAdjusted = yes; def advances = close * mcMultiplier; def declines = vwapLine * mcMultiplier; def breadth; def neutral_level; def raw; if (RatioAdjusted) { raw = advances – declines; if 1 == 3 { # For resting change 1 == 3 to 1 == 1 and insert desired breadth value below. breadth = raw; } else if raw >= 1250 or raw <= -1250 { breadth = fold bigIndex = 0 to 1000 with foldRawBig = raw while foldRawBig > 1250 or foldRawBig < -1250 do if raw / bigIndex < 1250 or raw / bigIndex > -1250 then raw / bigIndex else if raw / (bigIndex + 0.1) < 1250 and raw / (bigIndex + 0.1) > -1250 then raw / (bigIndex + 0.1) else if raw / (bigIndex + 0.2) < 1250 and raw / (bigIndex + 0.2) > -1250 then raw / (bigIndex + 0.2) else if raw / (bigIndex + 0.3) < 1250 and raw / (bigIndex + 0.3) > -1250 then raw / (bigIndex + 0.3) else if raw / (bigIndex + 0.4) < 1250 and raw / (bigIndex + 0.4) > -1250 then raw / (bigIndex + 0.4) else if raw / (bigIndex + 0.5) < 1250 and raw / (bigIndex + 0.5) > -1250 then raw / (bigIndex + 0.5) else if raw / (bigIndex + 0.6) < 1250 and raw / (bigIndex + 0.6) > -1250 then raw / (bigIndex + 0.6) else if raw / (bigIndex + 0.7) < 1250 and raw / (bigIndex + 0.7) > -1250 then raw / (bigIndex + 0.7) else if raw / (bigIndex + 0.8) < 1250 and raw / (bigIndex + 0.8) > -1250 then raw / (bigIndex + 0.8) else if raw / (bigIndex + 0.9) < 1250 and raw / (bigIndex + 0.9) < -1250 then raw / (bigIndex + 0.9) else raw; } else if raw >= 10 or raw <= -10 or raw == 0 { breadth = raw; } else { breadth = fold smallIndex = 0 to 1000 with foldRawSmall = raw while foldRawSmall > -10 and foldRawSmall < 10 do if raw * smallIndex > 10 or raw * smallIndex < -10 then raw * smallIndex else if raw * (smallIndex + 0.1) > 10 or raw * (smallIndex + 0.1) < -10 then raw * (smallIndex + 0.1) else if raw * (smallIndex + 0.2) > 10 or raw * (smallIndex + 0.2) < -10 then raw * (smallIndex + 0.2) else if raw * (smallIndex + 0.3) > 10 or raw * (smallIndex + 0.3) < -10 then raw * (smallIndex + 0.3) else if raw * (smallIndex + 0.4) > 10 or raw * (smallIndex + 0.4) < -10 then raw * (smallIndex + 0.4) else if raw * (smallIndex + 0.5) > 10 or raw * (smallIndex + 0.5) < -10 then raw * (smallIndex + 0.5) else if raw * (smallIndex + 0.6) > 10 or raw * (smallIndex + 0.6) < -10 then raw * (smallIndex + 0.6) else if raw * (smallIndex + 0.7) > 10 or raw * (smallIndex + 0.7) < -10 then raw * (smallIndex + 0.7) else if raw * (smallIndex + 0.8) > 10 or raw * (smallIndex + 0.8) < -10 then raw * (smallIndex + 0.8) else if raw * (smallIndex + 0.9) > 10 or raw * (smallIndex + 0.9) < -10 then raw * (smallIndex + 0.9) else raw; } neutral_level = 75; } else { raw = Double.NaN; breadth = advances – declines; neutral_level = 75; } def emaFastCorr = ExpAverage(CompoundValue(1, if !IsNaN(breadth) then breadth else emaFastCorr[1], 0), mcFastLength); def emaSlowCorr = ExpAverage(CompoundValue(1, if !IsNaN(breadth) then breadth else emaSlowCorr[1], 0), mcSlowLength); def mcClellanOsc = if !IsNaN(close) then emaFastCorr – emaSlowCorr else Double.NaN; def mcClellanSummationIndex = mcClellanSummationIndex[1] + if !IsNaN(breadth) then mcClellanOsc else 0; plot MSI; if IsNaN(close) { MSI = Double.NaN; } else if (IsCumulative) { MSI = Round(neutral_level + mcClellanSummationIndex, 0); } else { MSI = Round(neutral_level + mcClellanOsc – (10 * emaFastCorr + 20 * emaSlowCorr), 0); } def MSIUp = if MSI > MSI[1] then yes else no; def MSIDown = if MSI < MSI[1] then yes else no; plot SlopePhaseMSI = MSI; def Slope = MSI – MSI[1]; def SIHigh = HighestAll(MSI); def SILow = LowestAll(MSI); def SlpHigh = HighestAll(Slope); def SlpLow = LowestAll(Slope); plot SlopePlot = Normalize(Slope, SlpHigh, SlpLow, SIHigh, SILow); def Change = Slope – Slope[1]; def ChangeThreshold = if GetAggregationPeriod() >= AggregationPeriod.DAY then ChangeDayBeyond else if GetAggregationPeriod() >= AggregationPeriod.FIFTEEN_MIN then Change15Beyond else if GetAggregationPeriod() < AggregationPeriod.FIFTEEN_MIN then Change5Beyond else Change5Beyond; def ChangeConfirmed = if Change <= -ChangeThreshold or Change >= ChangeThreshold then yes else no; def SlopeUp = Slope > Slope[1]; def SlopeDown = Slope < Slope[1]; def SlopeFlip = if (Slope[1] < 0 and Slope >= 0) or (Slope[1] > 0 and Slope <= 0) then yes else no; def SlopeFlipBar = if SlopeFlip then BarNumber() else SlopeFlipBar[1]; def SlopeFromFlip = BarNumber() – SlopeFlipBar; def SlopeInRange = if SlopeFromFlip <= SlopeCrossWithin then yes else no; plot SlopeFlipUp = if (Slope[1] < ConfirmSlopeChange and Slope >= ConfirmSlopeChange) then MSI else Double.NaN; plot SlopeFlipDown = if (Slope[1] > -ConfirmSlopeChange and Slope <= -ConfirmSlopeChange) then MSI else Double.NaN; def ChangeAtFlip = if SlopeFlip then Change else ChangeAtFlip[1]; def ChangeInit = if SlopeFlip then yes else if ChangeInit[1] and ChangeAtFlip * Change < 0 then no else ChangeInit[1]; def SlopePhase = {default “Continuation”, “Initiation”, “Termination”}; if ChangeInit { SlopePhase = SlopePhase.Initiation; } else if !ChangeInit and ChangeAtFlip * Change < 0 { SlopePhase = SlopePhase.Termination; } else { SlopePhase = SlopePhase.Continuation; } def SlopeDirection = {default “None”, “ConfirmedUp”, “UnConfirmedUp”, “ConfirmedDown”, “UnConfirmedDown”, “ReinstatedDown”}; if Slope >= ConfirmSlopeChange { SlopeDirection = SlopeDirection.ConfirmedUp; } else if Slope >= 0 and Slope < ConfirmSlopeChange { SlopeDirection = SlopeDirection.UnConfirmedUp; } else if Slope <= -ConfirmSlopeChange { SlopeDirection = SlopeDirection.ConfirmedDown; } else if Slope < 0 and Slope > -ConfirmSlopeChange { SlopeDirection = SlopeDirection.UnConfirmedDown; } else { SlopeDirection = SlopeDirection.None; } # # # # # # # # # # # # # # # # # # # # # BEGIN VFI SECTION # # # # # # # # # # # # # # # # # # # # # # input VFISmoothLength = 8; input length = 50; input maxVolumeCutOff = 2.5; Assert(maxVolumeCutOff > 0, “‘max volume cut off’ must be positive: ” + maxVolumeCutOff); def cutOff = 0.2 * StDev(Log(hlc3) – Log(hlc3[1]), 30) * close; def hlcChange = hlc3 – hlc3[1]; def avgVolume = Average(volume, 50)[1]; def minVolume = Min(volume, avgVolume * maxVolumeCutOff); def dirVolume = if hlcChange > cutOff then minVolume else if hlcChange < -cutOff then -minVolume else 0; def vfiRaw = ExpAverage(Sum(dirVolume, length) / avgVolume, 3); def VFI = Inertia(vfiRaw, VFISmoothLength); plot VFIPlot = Normalize(VFI, HighestAll(VFI), LowestAll(VFI), SIHigh, SILow); def VFISlope = Round((VFI – VFI[1]), 2); def VFIHigh = HighestAll(VFISlope); def VFILow = LowestAll(VFISlope); plot VFISlopePlot = Normalize(VFISlope, VFIHigh, VFILow, SIHigh, SILow); def VFIChange = VFISlope – VFISlope[1]; def VSlope = Round((VFISlope * 10), 2); def VChange = Round(VFIChange, 2); def VFIUp = VFI >= VFI[1]; def VFIDown = VFI < VFI[1]; # # # # # # # # # # # # # # # # # # # # # # # # # # # BEGIN 3C SPECIFIC SECTION # # # # # # # # # # # # # # # # # # # # # # # # # # # input UpWindow = 20; input DownWindow = 50; input MALength = 2; input CCCLength = 1; input Show3C = no; input ShowLine = yes; input SmoothLength = 15; def TSV; if AbsValue(close – close[1]) > high – low && close[1] > close then { TSV = -1; } else if AbsValue(close – close [1]) > high – low && close > close [1] then { TSV = 1; } else if AbsValue (close – close[1]) < high – low then { TSV = ((close – close[1]) / (high – low)) * Power(volume, (3 / 4)); } else { TSV = 0; } def TSVX = Average(TSV, MALength); def UpCondition = (TSVX > TSVX[UpWindow]); def DownCondition = (TSVX < TSVX[DownWindow]); def CCC = If(UpCondition, If (DownCondition, 0, 1), If (DownCondition, -1, 0)); def ThreeC = TotalSum(Average(CCC, CCCLength)); def ThreeCLine = Inertia(ThreeC, SmoothLength); def ThreeCUp = if ThreeCLine >= ThreeCLine[1] then yes else no; def ThreeCDown = if ThreeCLine < ThreeCLine[1] then yes else no; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # BEGIN TRADE DIRECTION FLAG SPECIFIC SECTION # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # SET LONG CRITERIA HERE plot FlagLong = if TTMUp and ThreeCUp and VFIUp and MSIUp then SlopePlot else Double.NaN; # # SET SHORT CRITERIA HERE plot FlagShort = if TTMDown and ThreeCDown and VFIDown and MSIDown then SlopePlot else Double.NaN; # # EDITING BELOW THIS POINT IS GENERALLY NOTE NECESSARY plot FlagBoth = if FlagLong and FlagShort then SlopePlot else Double.NaN; # # # # # # # # # # # # # # # # # # # # # # # BEGIN DISPLAY SECTION # # # # # # # # # # # # # # # # # # # # # # # # # # EDITING THIS SECTION IS GENERALLY NOT NECESSARY FlagLong.SetPaintingStrategy(PaintingStrategy.ARROW_UP); #FlagLong.SetPaintingStrategy(PaintingStrategy.POINTS); FlagLong.SetLineWeight(5); FlagLong.SetDefaultColor(Color.GREEN); FlagLong.HideBubble(); FlagLong.HideTitle(); FlagLong.SetHiding(if !ShowFlags then yes else no); FlagShort.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); #FlagShort.SetPaintingStrategy(PaintingStrategy.POINTS); FlagShort.SetLineWeight(5); FlagShort.SetDefaultColor(Color.RED); FlagShort.HideBubble(); FlagShort.HideTitle(); FlagShort.SetHiding(if !ShowFlags then yes else no); FlagBoth.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS); FlagBoth.SetLineWeight(5); FlagBoth.SetDefaultColor(Color.CYAN); FlagBoth.HideBubble(); FlagBoth.HideTitle(); FlagBoth.SetHiding(if !ShowFlags then yes else no); midPoint.SetStyle(Curve.LONG_DASH); midPoint.SetDefaultColor(Color.MAGENTA); midPoint.SetLineWeight(2); midPoint.HideBubble(); midPoint.HideTitle(); midPoint.SetHiding(if !ShowMACloud then yes else no); wma34.SetDefaultColor(Color.DARK_GRAY); wma34.SetLineWeight(2); wma34.HideBubble(); wma34.HideTitle(); wma34.SetHiding(if !ShowMACloud then yes else no); AddCloud(if ShowMACloud then wma34 else Double.NaN, if ShowMACloud then midPoint else Double.NaN, CreateColor(255, 0, 0), CreateColor(55, 55, 200)); vwapLine.SetStyle(Curve.FIRM); vwapLine.SetDefaultColor(Color.CYAN); vwapLine.SetDefaultColor(Color.MAGENTA); vwapLine.SetLineWeight(2); vwapLine.HideBubble(); vwapLine.HideTitle(); vwapLine.SetHiding(if !ShowVWAP then yes else no); vwapWideUpper.SetStyle(Curve.FIRM); vwapWideUpper.SetDefaultColor(Color.GREEN); vwapWideUpper.SetLineWeight(1); vwapWideUpper.HideBubble(); vwapWideUpper.HideTitle(); vwapWideUpper.SetHiding(if !ShowVWAP then yes else no); vwapMidUpper.SetStyle(Curve.LONG_DASH); vwapMidUpper.SetDefaultColor(Color.GREEN); vwapMidUpper.SetLineWeight(1); vwapMidUpper.HideBubble(); vwapMidUpper.HideTitle(); vwapMidUpper.SetHiding(if !ShowVWAP then yes else no); vwapMidLower.SetStyle(Curve.LONG_DASH); vwapMidLower.SetDefaultColor(Color.RED); vwapMidLower.SetLineWeight(1); vwapMidLower.HideBubble(); vwapMidLower.HideTitle(); vwapMidLower.SetHiding(if !ShowVWAP then yes else no); vwapWideLower.SetStyle(Curve.FIRM); vwapWideLower.SetDefaultColor(Color.RED); vwapWideLower.SetLineWeight(1); vwapWideLower.HideBubble(); vwapWideLower.HideTitle(); vwapWideLower.SetHiding(if !ShowVWAP then yes else no); SlopePlot.SetPaintingStrategy(PaintingStrategy.LINE); SlopePlot.AssignValueColor(if Slope >= Slope[1] then Color.CYAN else Color.PLUM); SlopePlot.SetLineWeight(3); SlopePlot.HideBubble(); SlopePlot.HideTitle(); SlopePlot.SetHiding(if !ShowSlope then yes else no); SlopeFlipUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP); SlopeFlipUp.SetLineWeight(3); SlopeFlipUp.SetDefaultColor(Color.WHITE); SlopeFlipUp.HideTitle(); SlopeFlipUp.HideBubble(); SlopeFlipUp.SetHiding(if !ShowSlope then yes else no); SlopeFlipDown.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); SlopeFlipDown.SetLineWeight(3); SlopeFlipDown.SetDefaultColor(Color.WHITE); SlopeFlipDown.HideBubble(); SlopeFlipDown.HideTitle(); SlopeFlipDown.SetHiding(if !ShowSlope then yes else no); MSI.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS); MSI.AssignValueColor( if Slope == 0 or SlopeDirection == SlopeDirection.None then Color.BLUE else if SlopeDirection == SlopeDirection.ConfirmedUp then Color.GREEN else if SlopeDirection == SlopeDirection.UnConfirmedUp then Color.BLUE else if SlopeDirection == SlopeDirection.ConfirmedDown then Color.DARK_RED else if SlopeDirection == SlopeDirection.UnConfirmedDown then Color.BLUE else Color.WHITE); MSI.SetLineWeight(3); MSI.HideTitle(); MSI.HideBubble(); MSI.SetHiding(if !ShowMSI then yes else no); SlopePhaseMSI.SetPaintingStrategy(PaintingStrategy.POINTS); SlopePhaseMSI.AssignValueColor(if SlopePhase == SlopePhase.Continuation then MSI.TakeValueColor() else if SlopePhase == SlopePhase.Initiation then Color.ORANGE else if SlopePhase == SlopePhase.Termination then Color.BLUE else Color.YELLOW); SlopePhaseMSI.SetLineWeight(3); SlopePhaseMSI.HideTitle(); SlopePhaseMSI.HideBubble(); SlopePhaseMSI.SetHiding(if !ShowMSI then yes else no); VFIPlot.SetLineWeight(3); VFIPlot.AssignValueColor(if VFI >= VFI[1] then Color.cyan else Color.PLUM); VFIPlot.SetHiding(if !ShowVFI then yes else no); VFISlopePlot.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS); VFISlopePlot.AssignValueColor(color.DARK_GRAY); VFISlopePlot.SetLineWeight(2); VFISlopePlot.HideTitle(); VFISlopePlot.HideBubble(); VFISlopePlot.SetHiding(if ShowVFISlope then no else yes); AddVerticalLine(ShowRTHBorders and tradingStart, “Trading S”, Color.GRAY); AddVerticalLine(ShowRTHBorders and tradingEnd, “Trading E”, Color.GRAY); AddVerticalLine(ShowRTHBorders and tradingStart and tradingEnd, “Trading S&E”, Color.GRAY); AddLabel(ShowMSILabels, ” MSI: ” + MSI , if MSI >= 0 then Color.GREEN else Color.RED); AddLabel(ShowMSILabels, “ | MSlope: ” + Slope + ” (” + Slope[1] + ” : ” + Slope[2] + ” : ” + Slope[3] + “) Xed ” + SlopeFromFlip + ” ” , if Slope >= 0 then Color.GREEN else Color.RED); AddLabel(ShowMSILabels, ” MChange: ” + Change + ” (” + Change[1] + ” : ” + Change[2] + ” : ” + Change[3] + “) ” , if Change >= 0 and ChangeConfirmed then Color.GREEN else if Change < 0 and ChangeConfirmed then Color.RED else Color.WHITE); AddLabel(ShowVFILabels, ” VFI: ” + Round(VFI, 0) + ” (” + Round(VFI[1], 0) + ” : ” + Round(VFI[2], 0) + ” : ” + Round(VFI[3], 0) + “) ” , if VFI >= 0 then Color.GREEN else Color.RED); AddLabel(ShowVFILabels, ” |VSlope: ” + Round(VSlope, 0) + ” (” + Round(VSlope[1], 0) + ” : ” + Round(VSlope[2], 0) + ” : ” + Round(VSlope[3], 0) + “) ” , if VSlope >= 0 then Color.GREEN else Color.RED); AddLabel(ShowVFILabels, “VChange: ” + VChange + ” (” + VFIChange[1] + ” : ” + VFIChange[2] + ” : ” + VFIChange[3] + “) ” , if VChange >= 0 then Color.GREEN else Color.RED); AddLabel(ShowFlipLabels, ” VWAP ” + if close > vwapWideUpper then “+2 (” + vwapFromCross + “) ” else if close < vwapWideLower then “-2 (” + vwapFromCross + “) ” else if close > vwapMidUpper then “+1 (” + vwapFromCross + “) ” else if close < vwapMidLower then “-1 (” + vwapFromCross + “) ” else “Line (” + vwapFromCross + “) ” , if close > vwapLine then Color.GREEN else if close < vwapLine then Color.RED else Color.GRAY); AddLabel(ShowFlipLabels, ” Cloud (” + MaFromCross + “) “, if GreenCloud then Color.GREEN else if !GreenCloud then Color.RED else Color.GRAY); AddLabel(ShowFlipLabels, ” TTM ” + if TTMSqueeze then “s ” + AsText(TTMHistogram , NumberFormat.TWO_DECIMAL_PLACES) + ” (” + TTMFromCross + “) ” else “n ” + AsText(TTMHistogram , NumberFormat.TWO_DECIMAL_PLACES) + ” (” + TTMFromCross + “) ” , if TTMHistogram == 0 then Color.GRAY else if TTMHistogram > 0 then Color.GREEN else Color.RED); AddLabel(yes, “3C TSVX ” + Round(TSVX, 0) + ” (” + Round(TSVX[1], 0) + ” : ” + Round(TSVX[2], 0) + ” : ” + Round(TSVX[3], 0) + “) ” , if ThreeCUp then Color.GREEN else Color.RED); AddChartBubble(FlagLong and !FlagLong[1], msi, “S ” + Slope + “\nC ” + change + “\nC ” + close, color.green); AddChartBubble(FlagShort and !FlagShort[1], msi, “S ” + Slope + “\nC ” + change + “\nC ” + close, color.red);

Leave a Reply