Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###########################################################################
- #QuickCheck - Automatically Validate Basic Criteria For Stock Selection
- #Creator: u/--SubZer0--
- #Version: 1.5
- #Last Updated: 11.20.2022
- #Attributtion:
- #RealRelativeStrength: u/WorkPiece
- #RelativeVolume: u/HurlTeaInTheSea
- #############################################################################
- #Hide the price plot as we dont need it for this indicator
- HidePricePlot(yes);
- input symbolUpPrefix = " ";
- input symbolDownPrefix = " ";
- input ComparedWithSecurity = "SPY";
- input minPrice = 10;
- input minBidAskSpread = 0.03;
- input minATR = 2;
- input atrLength = 14;
- input nDaysForDailyVolumeAverage = 50;
- input minVolumeForToday = 1500000;
- input minDailyAverageVolume = 2000000; #default average of 2M shares traded over n days
- DefineGlobalColor("SymbolUpState", CreateColor(100,150,45));
- DefineGlobalColor("SymbolDownState", CreateColor(175,45,40));
- DefineGlobalColor("MeetsCriteria", CreateColor(70,170,200));
- DefineGlobalColor("DoesNotMeetCriteria", Color.GRAY);
- DefineGlobalColor("WarningState", CreateColor(240,140,45));
- DefineGlobalColor("SeparatorRowColor", Color.WHITE);
- def priceType = FundamentalType.CLOSE;
- def aggregationPeriod = AggregationPeriod.DAY;
- #Determine if Market is up or down
- def dComparedSymbolLast = close(priceType = "Last", symbol = ComparedWithSecurity);
- def dComparedSymbolPrevDayClose = close(period = aggregationPeriod, symbol = ComparedWithSecurity)[1];
- def dComparedSymbolDayChange = dComparedSymbolLast - dComparedSymbolPrevDayClose;
- def isComparedSymbolUp = (dComparedSymbolDayChange >= 0);
- #Determine if current stock is up or down
- def dStockLast = close(priceType = "Last");
- def dStockPrevDayClose = close(period = aggregationPeriod)[1];
- def dStockDayChange = dStockLast - dStockPrevDayClose;
- def isStockUp = (dStockDayChange > 0);
- def dComparedSymbolPercentChange = (dComparedSymbolDayChange/dComparedSymbolPrevDayClose);
- def dStockPercentChange = (dStockDayChange/dStockPrevDayClose);
- def todayOpen = open(period = aggregationPeriod);
- def todayHigh = high(period = aggregationPeriod);
- def todayLow = low(period = aggregationPeriod);
- def YHigh = high(period = aggregationPeriod)[1];
- def YLow = low(period = aggregationPeriod)[1];
- def dVWAP = reference VWAP()."VWAP";
- def twentyDayHigh = Highest(high(period=AggregationPeriod.DAY)[1], 20);
- def twentyDayLow = Lowest(low(period=AggregationPeriod.DAY)[1], 20);
- def dCurrentDailyStockVolume = volume(period=aggregationPeriod);
- def dAvgDailyStockVolume = Average(volume(period=aggregationPeriod)[1], nDaysForDailyVolumeAverage);
- def dStockVolumeFill = dCurrentDailyStockVolume / dAvgDailyStockVolume;
- def dCurrentDailyComparedSymbolVolume = volume(symbol = ComparedWithSecurity, period=aggregationPeriod);
- def dAvgDailyComparedSymbolVolume = Average(volume(symbol = ComparedWithSecurity, period=aggregationPeriod)[1], nDaysForDailyVolumeAverage);
- def dComparedSymbolVolumeFill = dCurrentDailyComparedSymbolVolume / dAvgDailyComparedSymbolVolume;
- ############################################################
- #Show if the ComparedSymbol is up for the day or down (Up = above YClose and Down = below YClose)
- AddLabel( yes,
- (if isComparedSymbolUp then symbolUpPrefix else symbolDownPrefix )
- + " "
- + ComparedWithSecurity
- + " "
- + AsText(dComparedSymbolLast, "%1$.2f")
- + " ("
- + (if isComparedSymbolUp then "+" else "")
- + AsText(dComparedSymbolDayChange, "%1$.2f")
- + ") ",
- if isComparedSymbolUp
- then GlobalColor("SymbolUpState")
- else GlobalColor("SymbolDownState")
- );
- ############################################################
- #Is current ticker is up for the day or down? (Up = above YClose and Down = below YClose)
- AddLabel( yes,
- if ComparedWithSecurity == GetSymbol()
- then " "
- else
- (if isStockUp then symbolUpPrefix else symbolDownPrefix )
- + " "
- + GetSymbol()
- + " "
- + AsText(dStockLast, "%1$.2f")
- + " ("
- + (if isStockUp then "+" else "")
- + AsText(dStockDayChange, "%1$.2f")
- + ") ",
- if ComparedWithSecurity == GetSymbol()
- then GlobalColor("SeparatorRowColor")
- else if isStockUp
- then GlobalColor("SymbolUpState")
- else GlobalColor("SymbolDownState")
- );
- ############################################################
- # Compare net change % of current stock v/s SPY
- AddLabel( yes,
- (if (dStockPercentChange >= dComparedSymbolPercentChange)then symbolUpPrefix else symbolDownPrefix )
- + " NET CHG %"
- + " "
- + AsPercent(dStockPercentChange)
- + ( if ComparedWithSecurity != GetSymbol()
- then (" / " + AsPercent(dComparedSymbolPercentChange) )
- else "" )
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockPercentChange >= dComparedSymbolPercentChange) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockPercentChange <= dComparedSymbolPercentChange) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if isStockUp then
- if (dStockPercentChange >= dComparedSymbolPercentChange) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockPercentChange <= dComparedSymbolPercentChange)then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- );
- ############################################################
- #Get current bid-ask spread
- def bidAskSpread = close(priceType = PriceType.ASK) - close(priceType = PriceType.BID);
- AddLabel( yes,
- (if (bidAskSpread > minBidAskSpread) then symbolUpPrefix else symbolDownPrefix )
- + " SPREAD"
- + " "
- + AsText(bidAskSpread, NumberFormat.TWO_DECIMAL_PLACES)
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (bidAskSpread > minBidAskSpread) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- else
- if (bidAskSpread > minBidAskSpread) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (bidAskSpread > minBidAskSpread) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if (bidAskSpread > minBidAskSpread)then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
- ############################################################
- #Is current ATR above or below desired ATR on a daily timeframe?
- def currentATR = Round(WildersAverage(TrueRange(high(period = aggregationPeriod),
- close(period = aggregationPeriod),
- low(period = aggregationPeriod)
- ),
- atrLength), 2
- );
- AddLabel( yes,
- (if (currentATR > minATR) then symbolUpPrefix else symbolDownPrefix )
- + " ATR(" + atrLength + "D)"
- + " "
- + AsText((currentATR))
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (currentATR > minATR) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (currentATR > minATR) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if isStockUp then
- if (currentATR > minATR) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (currentATR > minATR)then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- );
- ############################################################
- #Get number of transactions per minute
- #input showTxCount = yes;
- #def tradeAggregationPeriod = AggregationPeriod.FIVE_MIN;
- #def txCount = tick_count( period=tradeAggregationPeriod, priceType=PriceType.LAST);
- #def txCount = tick_count;
- #def pastTxCount = tick_count( period=tradeAggregationPeriod, priceType=PriceType.LAST)[1];
- #AddLabel( yes,
- # " TRADES "
- # + AsText(txCount, "%1$.0f")
- # + " | "
- # + AsText(pastTxCount, "%1$.0f")
- # + " ",
- # Color.White
- # );
- ############################################################
- #Get Day Type - Up-Side, Down-Side, Inside,
- AddLabel( yes,
- if (dStockLast > YHigh)
- then " DAY-TYPE UP "
- else if (dStockLast >= YLow)
- then " DAY-TYPE INSIDE "
- else " DAY-TYPE DOWN ",
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockLast > YHigh) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast < YLow) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if isStockUp then
- if (dStockLast > YHigh) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast < YLow)then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- );
- ############################################################
- #Add empty row as separator
- AddLabel( yes,
- " ",
- GlobalColor("SeparatorRowColor")
- );
- ############################################################
- #Source: https://www.reddit.com/r/RealDayTrading/comments/rpi75s/real_relative_strength_indicator/
- #Real Relative Strength (Rolling)
- #Created By u/WorkPiece 12.26.21
- #Concept by u/HSeldon2020
- input RRSLength = 12; #Hint RRSLength: value of 12 on 5m chart = 1 hour of rolling data
- ##########Rolling Price Change##########
- def comparedRollingMove = close(symbol = ComparedWithSecurity) - close(symbol = ComparedWithSecurity)[RRSLength];
- def symbolRollingMove = close - close[RRSLength];
- ##########Rolling ATR Change##########
- def symbolRollingATR = WildersAverage(TrueRange(high[1], close[1], low[1]), RRSLength);
- def comparedRollingATR = WildersAverage(TrueRange(high(symbol = ComparedWithSecurity)[1], close(symbol = ComparedWithSecurity)[1], low(symbol = ComparedWithSecurity)[1]), RRSLength);
- ##########Calculations##########
- def powerIndex = comparedRollingMove / comparedRollingATR;
- def expectedMove = powerIndex * symbolRollingATR;
- def diff = symbolRollingMove - expectedMove;
- def RRS = diff / symbolRollingATR;
- AddLabel( yes,
- if ComparedWithSecurity == GetSymbol()
- then " RRS NA "
- else
- (if (RRS > 0) then symbolUpPrefix else symbolDownPrefix )
- + " RRS "
- + " "
- + AsText((RRS))
- + " ",
- if ComparedWithSecurity == GetSymbol()
- then GlobalColor("MeetsCriteria")
- else
- if isComparedSymbolUp then
- if isStockUp then
- if (RRS > 0) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (RRS > 0) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (RRS > 0) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (RRS > 0)then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
- ############################################################
- # Source: https://www.reddit.com/r/RealDayTrading/comments/ue4ujq/tostv_timebased_relative_volume_rvol_a_better/
- # /u/HurlTeaInTheSea v1.0
- # Intraday Relative Volume (RVol) indicator:
- # still works on higher timeframe but it's not a "day" average anymore, so throw error to avoid confusion
- addlabel(GetAggregationPeriod() > aggregationPeriod, "RVol is only valid for daily timeframe or lower");
- input _nDayAverageForRVOL = 20;
- def days = Max(_nDayAverageForRVOL, 1);
- # detect new session of day
- def isNewDay = GetYYYYMMDD() != GetYYYYMMDD()[1];
- def cVol; # cumulative volume
- def cVolComp; # cumulative volume of comp security
- def beforeNewDayBars; # save bar number before new day
- def len; # count number of new days
- if isNewDay {
- cVol = volume;
- cVolComp = volume(symbol = ComparedWithSecurity);
- beforeNewDayBars = BarNumber() - 1;
- len = len[1] + 1;
- } else {
- cVol = cVol[1] + volume;
- cVolComp = cVolComp[1] + volume(symbol = ComparedWithSecurity);
- beforeNewDayBars = beforeNewDayBars[1];
- len = len[1];
- }
- # starting from last bar of previous session, go back in time and accumulate volume up to current time relative to trading day
- # stop after N day cumulative volume average collected
- def skip = BarNumber() - beforeNewDayBars;
- def aVol = fold i = skip to Max(skip, BarNumber())
- with v = 0
- while BarNumber() >= days + 1 && len >= days + 1 && len - 1 - GetValue(len, i) < days
- do If(GetTime() - RegularTradingStart(GetYYYYMMDD()) >= GetValue(GetTime(), i) - RegularTradingStart(GetValue(GetYYYYMMDD(), i)), v + GetValue(volume, i) / days, v);
- def aVolComp = fold j = skip to Max(skip, BarNumber())
- with w = 0
- while BarNumber() >= days + 1 && len >= days + 1 && len - 1 - GetValue(len, j) < days
- do If(GetTime() - RegularTradingStart(GetYYYYMMDD()) >= GetValue(GetTime(), j) - RegularTradingStart(GetValue(GetYYYYMMDD(), j)), w + GetValue(volume(symbol = ComparedWithSecurity), j) / days, w);
- def _rVol = if aVol > 0 then cVol / aVol else 0;
- def _rVolComp = if aVolComp > 0 then cVolComp / aVolComp else 0;
- AddLabel( yes,
- (if _rVol > 1 then symbolUpPrefix else symbolDownPrefix )
- + " RVOL(" + _nDayAverageForRVOL + "D)"
- + " "
- + AsPercent(Round(_rVol))
- + ( if ComparedWithSecurity != GetSymbol()
- then (" / " + AsPercent(Round(_rVolComp)) )
- else "" )
- + " ",
- if isComparedSymbolUp then
- if isStockUp then
- if (_rVol > 1.25 and _rVol > _RvolComp) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (_rVol > 1.25 and _rVol > _RvolComp) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if isStockUp then
- if (_rVol > 1.25 and _rVol > _RvolComp) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (_rVol > 1.25 and _rVol > _RvolComp)then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- );
- ############################################################
- #Show current volume, average daily volume, volume fill
- def cvFactorStock = if( dCurrentDailyStockVolume < 1000000) then 1000 else 1000000;
- def dCurrentDailyStockVolume_factor = Round(dCurrentDailyStockVolume / cvFactorStock, 2);
- def avFactorStock = if( dAvgDailyStockVolume < 1000000) then 1000 else 1000000;
- def dAvgDailyStockVolume_factor = Round(dAvgDailyStockVolume / avFactorStock, 2);
- AddLabel( yes,
- (if dAvgDailyStockVolume >= minDailyAverageVolume then symbolUpPrefix else symbolDownPrefix )
- + " AvVOL(" + nDaysForDailyVolumeAverage + "D)"
- + " "
- + dAvgDailyStockVolume_factor
- + (if(dAvgDailyStockVolume < 1000000) then "K" else "M")
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (dAvgDailyStockVolume > minDailyAverageVolume) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dAvgDailyStockVolume > minDailyAverageVolume) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if isStockUp then
- if (dAvgDailyStockVolume > minDailyAverageVolume) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dAvgDailyStockVolume > minDailyAverageVolume) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- );
- AddLabel( yes,
- (if dCurrentDailyStockVolume >= minVolumeForToday then symbolUpPrefix else symbolDownPrefix )
- + " VOLUME"
- + " "
- + AsText(dCurrentDailyStockVolume_factor,NumberFormat.TWO_DECIMAL_PLACES)
- + (if(dCurrentDailyStockVolume < 1000000) then "K" else "M")
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (dCurrentDailyStockVolume > minVolumeForToday) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dCurrentDailyStockVolume > minVolumeForToday) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if isStockUp then
- if (dCurrentDailyStockVolume > minVolumeForToday) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dCurrentDailyStockVolume > minVolumeForToday)then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- );
- ############################################################
- # Compare vol fill % of SPY vs current stock
- AddLabel( yes,
- (if (dStockVolumeFill > dComparedSymbolVolumeFill) then symbolUpPrefix else symbolDownPrefix )
- + " VOL FILL"
- + " "
- + AsPercent(Round(dStockVolumeFill))
- + ( if ComparedWithSecurity != GetSymbol()
- then (" / " + AsPercent(Round(dComparedSymbolVolumeFill)) )
- else "" )
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockVolumeFill < dComparedSymbolVolumeFill) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- else
- if (dStockVolumeFill < dComparedSymbolVolumeFill) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (dStockVolumeFill < dComparedSymbolVolumeFill) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if (dStockVolumeFill < dComparedSymbolVolumeFill)then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
- ############################################################
- #Add empty row as separator
- AddLabel( yes,
- " ",
- GlobalColor("SeparatorRowColor")
- );
- ############################################################
- #Is current ticker above or below YClose on an intraday timeframe?
- AddLabel( yes,
- (if isStockUp then symbolUpPrefix else symbolDownPrefix )
- + " YCLOSE "
- + " "
- + AsText((dStockDayChange))
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockLast > dStockPrevDayClose) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > dStockPrevDayClose) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (dStockLast > dStockPrevDayClose) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > dStockPrevDayClose)then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
- ############################################################
- #Is current ticker above or below VWAP on an intraday timeframe?
- AddLabel( yes,
- (if dStockLast > dVWAP then symbolUpPrefix else symbolDownPrefix )
- + " VWAP "
- + " "
- + AsText((dStockLast-dVWAP))
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockLast > dVWAP) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > dVWAP) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (dStockLast > dVWAP) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > dVWAP) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
- ############################################################
- #Is current ticker above or below today's Open on an intraday timeframe?
- AddLabel( yes,
- (if dStockLast > todayOpen then symbolUpPrefix else symbolDownPrefix )
- + " OPEN "
- + " "
- + AsText((dStockLast-todayOpen))
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockLast > todayOpen) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > todayOpen) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (dStockLast > todayOpen) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > todayOpen)then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
- ############################################################
- #Is current ticker above or below YHigh/YLow on an intraday timeframe?
- AddLabel( yes,
- (if dStockLast > YHigh then symbolUpPrefix else symbolDownPrefix )
- + " YHIGH "
- + " "
- + AsText((dStockLast-yHigh))
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockLast > YHigh) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > YHigh) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (dStockLast > YHigh) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > YHigh)then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
- AddLabel( yes,
- (if dStockLast > YLow then symbolUpPrefix else symbolDownPrefix )
- + " YLOW "
- + " "
- + AsText((dStockLast-yLow))
- + " ",
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockLast > YLow) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > YLow) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (dStockLast > YLow) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > YLow)then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
- ############################################################
- #Is current ticker above or below 20-Day High/Low on a daily timeframe?
- AddLabel( yes,
- (if dStockLast > twentyDayHigh then symbolUpPrefix else symbolDownPrefix )
- + " D20 HIGH "
- + " "
- + AsText((dStockLast-twentyDayHigh))
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockLast > twentyDayHigh) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > twentyDayHigh) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (dStockLast > twentyDayHigh) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > twentyDayHigh)then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
- AddLabel( yes,
- (if dStockLast > twentyDayLow then symbolUpPrefix else symbolDownPrefix )
- + " D20 LOW "
- + " "
- + AsText((dStockLast-twentyDayLow))
- + " ",
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockLast > twentyDayLow) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > twentyDayLow) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (dStockLast > twentyDayLow) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > twentyDayLow)then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
- ############################################################
- #Is current ticker above or below 50/100/200SMA on an intraday timeframe?
- def averageType = AverageType.SIMPLE;
- def d50SMA = MovingAverage(averageType,
- Fundamental(priceType, period = aggregationPeriod),
- 50
- );
- def d100SMA = MovingAverage(averageType,
- Fundamental(priceType, period = aggregationPeriod),
- 100
- );
- def d200SMA = MovingAverage(averageType,
- Fundamental(priceType, period = aggregationPeriod),
- 200
- );
- AddLabel( yes,
- (if dStockLast > d50SMA then symbolUpPrefix else symbolDownPrefix )
- + " 50SMA(D) "
- + " "
- + AsText((dStockLast-d50SMA))
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockLast > d50SMA) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > d50SMA) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (dStockLast > d50SMA) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > d50SMA)then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
- AddLabel( yes,
- (if dStockLast > d100SMA then symbolUpPrefix else symbolDownPrefix )
- + " 100SMA(D) "
- + " "
- + AsText((dStockLast-d100SMA))
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockLast > d100SMA) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > d100SMA) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (dStockLast > d100SMA) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > d100SMA)then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
- AddLabel( yes,
- (if dStockLast > d200SMA then symbolUpPrefix else symbolDownPrefix )
- + " 200SMA(D) "
- + " "
- + AsText((dStockLast-d200SMA))
- + " " ,
- if isComparedSymbolUp then
- if isStockUp then
- if (dStockLast > d200SMA) then
- GlobalColor("MeetsCriteria")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > d200SMA) then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("WarningState")
- else
- if isStockUp then
- if (dStockLast > d200SMA) then
- GlobalColor("WarningState")
- else GlobalColor("DoesNotMeetCriteria")
- else
- if (dStockLast > d200SMA)then
- GlobalColor("DoesNotMeetCriteria")
- else GlobalColor("MeetsCriteria")
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement