Bull vs Bear meter

carey3

New member
VIP
This is a strategy I've been working on. It uses several indicators to determine a score between Bulls vs Bears and the score is an alert on the top of the chart. BvsB: # # is -14 to +14.
1728962764045.png

If everything aligns in the technical analysis, it will also indicate Bullish or Bearish. I have it set to show the indicators and if the indicator is Bullish or Bearish.
1728962778401.png

1728962815445.png

This is set for the letters:
S - Stochastic
H - HMA
E - EMA
M - Mommentum
VW - VWAP vs close
TTi - TTM in a squeeze or not, or exiting a squeeze.
D - Direction
Vol - Average Volume strength

I use this to quickly determine if the ticker is worth a deeper dive. I look at the results from several sources, including several of my own scanners. I needed a faster way to look at the technical indicators, so I flattened them to Red or Green to apply the KISS priciple.

This needs to be compacted to use less cpu time and get faster results. Any suggestions are welcome.

Code:
#hint:  Looking for Beta Testers to use this with Meta AI or another AI bot\n\n\n Version B \n\n\n The analysis in this program searches for several factors that when combined creates a strong buy signal.\n I Just added the reverse bias for a Bearish version.  I am making better trades with this and several the scans I have created with Data Analysis from the same functions.  Ask me about these someday when we have a cup of coffee together.  \n I am always looking for another way to analyze the market.  If you have an idea that will improve this program, let me know.  I'm still thinking about a name at the moment \n Today it's C_BullvsBearMeter\n Version beta


input VolumeLength = 90;
input VolumeDev = 0.118;#0.236;


input price = close;


input ShowBullishLabel = yes;                          # Current Values Possible
input ShowBearishLabel = yes;                          # Current Values Possible


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> EMA
input MA_Length1 = 9;
input MA_Length2 = 21;
input MA_Length3 = 50;
input MA_Length4 = 200;
#                                Moved ema2 and vwap crossovers to c_EMA Meter
#input showEMA_CrossOver_Signals = no;
#input showVWAP_CrossOver_Signals = no;


input AvgType = averageType.Simple;


input ShowNotBullishLabel = no;


input ShowNotBearishLabel = no;


def priceH = high();#(period  = aggregationPeriodS);# AggregationPeriod.DAY);
def priceL = low();#(period   = aggregationPeriodS);# AggregationPeriod.DAY);
def priceC = close();#(period = aggregationPeriodS);# AggregationPeriod.DAY);


def AVG1 = MovingAverage(AvgType, priceC, MA_Length1);
def AVG2 = MovingAverage(AvgType, priceC, MA_Length2);
def AVG3 = MovingAverage(AvgType, priceC, MA_Length3);
def AVG4 = MovingAverage(AvgType, priceC, MA_Length4);


def aPeriod = GetAggregationPeriod();


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> VWAP
def DailyVWAP   = vwap(period = AggregationPeriod.DAY);
def WeeklyVWAP  = vwap(period = AggregationPeriod.WEEK);
def MonthlyVWAP = vwap(period = AggregationPeriod.MONTH);


def VWAP1 = if aPeriod <  AggregationPeriod.DAY  then DailyVWAP
       else if aPeriod <  AggregationPeriod.WEEK then WeeklyVWAP
       else MonthlyVWAP ; #double.nan;


def DeltaVWAP = priceC - VWAP1;


#AddLabel( priceC crosses Above VWAP1 and showVWAP_CrossOver_Signals, "P Cx/\VWAP", CreateColor(100,255,128) );
#AddLabel( priceC crosses Below VWAP1 and showVWAP_CrossOver_Signals, "P Cx\/VWAP", CreateColor(255,100,128) );


#def VwapDirection = if aPeriod < AggregationPeriod.DAY then
#                    if close() > VWAP() then 2
#               else if close() > VWAP()[1] then 1
#               else if close() < VWAP() then -2
#               else if close() < VWAP()[1] then -1
#               else 0
#               else double.nan;


#def DeltaVWAP = if aPeriod <  AggregationPeriod.DAY then
#                    ROUND(100 * (priceC - VWAP("DAY")) ,1)
#              else if aPeriod <  AggregationPeriod.WEEK then
#                    ROUND(100 * (priceC - VWAP("WEEK")) ,1)
#              else double.nan;


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> EMA 1  50 and 200
def EMA_Buy = priceC > AVG3 or priceC > AVG4;
def EMA_Sel = priceC < AVG3 or priceC < AVG4;


def EMA_condition1 = if priceC > AVG3 and priceC > AVG2 then 2
                    else if priceC > AVG3 or priceC > AVG2 then 1
                    else if priceC < AVG3 and priceC < AVG2 then -2
                    else if priceC < AVG3 or priceC < AVG2 then -1
                    else 0;
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> EMA 2


def EMA_condition2 = if priceC > AVG1 and priceC > AVG2 then 2
                    else if priceC > AVG1 or priceC > AVG2 then 1
                    else if priceC < AVG1 and priceC < AVG2 then -2
                    else if priceC < AVG1 or priceC < AVG2 then -1
                    else 0;


#AddLabel( price crosses Above AVG2 and showEMA_CrossOver_Signals,
#    Concat("P Cx^Ema21:", round(Price-AVG2,0)), CreateColor(000,255,128) );
#AddLabel( price crosses Below AVG2 and showEMA_CrossOver_Signals,
#    Concat("Ema21 Cx^P:", round(AVG2-Price,0)), CreateColor(192,000,128) );
#AddLabel( price crosses Above AVG3 and showEMA_CrossOver_Signals,
#    Concat("P Cx^Ema50:", round(Price-AVG3,0)), CreateColor(000,255,128) );
#AddLabel( price crosses Below AVG3 and showEMA_CrossOver_Signals,
#    Concat("Ema50 Cx^P:", round(AVG3-Price,0)), CreateColor(192,000,128) );


#AddLabel( price crosses Above AVG4 and showEMA_CrossOver_Signals,
#    Concat("P Cx^Ema200:", round(Price-AVG4,0)), CreateColor(000,255,128) );
#AddLabel( price crosses Below AVG4 and showEMA_CrossOver_Signals,
#    Concat("Ema200 Cx^P:", round(AVG4-Price,0)), CreateColor(192,000,128) );


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> from Buythedip | Buy on Dip
input Period = aggregationPeriod.DAY;
input bubbles = no;
input ShowValue = yes;
# Plot indicator
def value = round(((high - Lowest(priceC[1], MA_Length2)) / Lowest(priceC[1], MA_Length2)) * 100,2);
def Zeroline = 0;
def Upsignal = value crosses above ZeroLine;####
def Dnsignal = value crosses below ZeroLine;


AddLabel(ShowValue
    and (Dnsignal or Dnsignal[1])
    and (EMA_Sel or EMA_Sel[1]),
    Concat(
    "BoD:", round(value,0)), CreateColor(255,164,128) );
AddLabel(ShowValue
    and (Upsignal or Upsignal[1])
    and (EMA_Buy or EMA_Buy[1]),
    Concat(
    "BoD:", round(value,0)), CreateColor(100,255,100) );


AddChartBubble(bubbles and Upsignal and EMA_Buy, low * 0.95,
    "BoDip", Color.light_green, no);


plot BoDBuy = if EMA_Buy and Upsignal then lowest(Low,21)*0.95 else double.nan ;
BoDBuy.setPaintingStrategy(PaintingStrategy.LINE_VS_TriANGLES);#LINE_VS_Squares);#booLEAN_WEDGE_Down);
BoDBuy.assignValueColor(CreateColor(63,255,225));
BoDBuy.setLineWeight(5);


AddChartBubble(bubbles and Dnsignal and EMA_Sel, low * 0.95,
    "BoDip", Color.light_green, no);


plot BoDSell = if EMA_Sel and Dnsignal then lowest(Low,21)*0.95 else double.nan ;
BoDSell.setPaintingStrategy(PaintingStrategy.LINE_VS_TriANGLES);#LINE_VS_Squares);#booLEAN_WEDGE_Down);
BoDSell.assignValueColor(CreateColor(255,100,100));
BoDSell.setLineWeight(5);
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Bollinger Bands


input displace = 0;
input BBlength = 20;
input Std_Dev = 2.0;
input showStdDev = no;
input averageType = AverageType.Simple;
def Mid = MovingAverage(averageType, data = price[-displace], length = BBlength);
def sDev = stdev(data = price[-displace], length = BBlength);
def LowerBand = Mid - Std_Dev * sDev;
def UpperBand = Mid + Std_Dev * sDev;
#def percentB = round((priceC - LowerBand) / (UpperBand - LowerBand),2);


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Keltner Channels


input Kdisplace = 0;
input factor = 1.5;
input Klength = 20;
input Kprice = close;
input KavgType = AverageType.SIMPLE;
input trueRangeAverageType = AverageType.SIMPLE;


def shift = factor * MovingAverage(trueRangeAverageType, TrueRange(priceH, priceC, priceL), Klength);
def average = MovingAverage(KavgType, Kprice, Klength);
def AvgKel = average[-Kdisplace];
def Upper_Kel = average[-Kdisplace] + shift[-Kdisplace];
def Lower_Kel = average[-Kdisplace] - shift[-Kdisplace];


def TTiSqueeze = if UpperBand crosses above Upper_Kel or LowerBand crosses below Lower_Kel then 2
                else if UpperBand > Upper_Kel or LowerBand < Lower_Kel then 1
                else if UpperBand < Upper_Kel or LowerBand > Lower_Kel then -1
                else 0;


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Stochastic


input averageTypeS = AverageType.SIMPLE;
input over_bought    = 80;
def over_sold        = 100 - over_bought;
input KPeriod        = 14;#               Slow                 8 3 3   Was 5 3 3
input DPeriod        = 3;
input slowingPeriod  = 3;


def lowest_k2 = Lowest(priceL, KPeriod );
def c3 = priceC - lowest_k2;
def c4 = Highest(priceH, KPeriod ) - lowest_k2;
def SlowK = if c4 != 0 then c3 / c4 * 100 else 0;
def FullK = MovingAverage(averageTypes, SlowK, slowingPeriod);
def FullD = MovingAverage(averageTypeS, FullK, DPeriod );
#
def Stochastic =  if FullK crosses above over_sold or FullK[1] crosses above over_sold then 2
             else if FullD crosses above over_sold or FullD[1] crosses above over_sold then 2
             else if FullK crosses Below over_bought or FullK[1] crosses Below over_bought then -2
             else if FullD crosses Below over_bought or FullD[1] crosses Below over_bought then -2
             else if FullK > FullD and FullK > over_sold and FullK < over_bought then 3
             else if FullK < FullD and FullK > over_sold and FullK < over_bought then -3
             else if FullK > over_bought or FullD > over_bought then 4
             else if FullK < over_sold   or FullD < over_sold   then -4
             else if FullK >= FullD then 1
             else if FullK <= FullD then -1
             else 0 ;
def StochasticBuy = FullK crosses above over_sold
                 or FullD crosses above over_sold
                 or FullK[1] crosses above over_sold
                 or FullD[1] crosses above over_sold
;
def StochasticSell = FullK crosses Below over_bought
                 or FullD crosses Below over_bought
                 or FullK[1] crosses Below over_bought
                 or FullD[1] crosses Below over_bought
;
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Momentum


input momentumLength = 9;
input momentumLength2 = 14;
def MomentumV  = price - price[momentumLength];
def MomentumV2 = price - price[momentumLength2];
Def Mom = if MomentumV  crosses above 0     and MomentumV > MomentumV[1]  then 3             # above 0
     else if MomentumV  crosses above -0.25 and MomentumV > MomentumV[1]  then 4            # above 0
     else if MomentumV  crosses below 0     and MomentumV < MomentumV[1]  then -3             # above 0
     else if MomentumV  crosses below 0.25  and MomentumV < MomentumV[1]  then -4            # above 0
     else if MomentumV  > 0 then 1             # above 0
     else if MomentumV2 > 0 then 2             # above 0
     else if MomentumV  < 0 then -1            # below 0
     else if MomentumV2 < 0 then -2            # below 0
     else 0 ;               


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> HMA


def hma = if HullMovingAvg(length = 14) > HullMovingAvg(length = 14)[1]
             then 1
     else if HullMovingAvg(length = 14) < HullMovingAvg(length = 14)[1]
             then -1
             else 0;
def HmaBuy  = hma ==  1 and hma[1] <= 0;
def HmaSell = hma == -1 and hma[1] >= 0;


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Direction


def direction = if close > close[1] then 1 else if close < close[1] then -1 else 0;


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Volume


def Vol = Volume();
def VolAvg = round( Average(Vol, VolumeLength) ,0);#VolumeLength 90
def VolStdDev =  StDev(Vol, VolumeLength) ;
def VolFib1 = round( VolAvg * 0.118  ,0);
def VolFib2 = round( VolAvg * 0.236  ,0);
#def Std100  = Volavg + ( VolumeNumDev1     * StDev(Vol, VolumeLength));
#plot Band1 = VolAvg + VolumeNumDev1 * stdev(VolDay, VolumeLength);


def VolSig =  if direction > 0 and (Vol > VolFib2 or Vol[1] > VolFib2 )
 then 2  else if direction > 0 and (Vol > VolFib1 or Vol[1] > VolFib1 )
 then 1  else if direction < 0 and (Vol > VolFib2 or Vol[1] > VolFib2 )
 then -2 else if direction < 0 and (Vol > VolFib1 or Vol[1] > VolFib1 )
 then -1 else 0;


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->  Linear Regression


input length = 52;
input width = 1.0;
input lineWeight2 = 2;
input showLabel = yes;


def H = if open > close then open else close;
def L = if open < close then open else close;


#def aPeriod = GetAggregationPeriod();### DEFINED ABOVE
def length2 = if aPeriod == AggregationPeriod.WEEK        then length
         else if aPeriod == AggregationPeriod.DAY         then length * 5
         else if aPeriod == AggregationPeriod.four_Hours  then length * 10
         else if aPeriod == AggregationPeriod.Hour        then length * 40
         else if aPeriod == AggregationPeriod.THIRTY_MIN  then length * 80
         else if aPeriod == AggregationPeriod.FIFTEEN_MIN then length * 160
         else length * 480 ;
      
def MiddleLR = InertiaAll(price,length2);
def dist = HighestAll(AbsValue(MiddleLR - price)) * width;
def distLineT = MiddleLR + dist;
def distLineB = MiddleLR - dist;


def percentLR = round((close - distLineB) / (distLineT - distLineB)*100,1);


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Sandwich Signal


input EMASignals = yes;
def BodyH = if open > close then open else close;
def BodyL = if open < close then close else open;


plot EmaBuy = BodyH crosses Above AVG2 and EMASignals;
EmaBuy.AssignValueColor( CreateColor(128,255,255) );
EmaBuy.setLineWeight(5);
EmaBuy.SetPaintingStrategy(PaintingStrategy.booLEAN_arrow_UP);


AddLabel(ShowBullishLabel and EmaBuy,
    "EmaBuy", Color.Green);


plot EmaDip = BodyL crosses below AVG2 and EMASignals;
EmaDip.AssignValueColor( CreateColor(255,128,255) );
EmaDip.setLineWeight(5);
EmaDip.SetPaintingStrategy(PaintingStrategy.booLEAN_Arrow_Down);


input BubbleTicks = 5;
input showBubble = yes;
def BubbleT1 = -1*BubbleTicks;
def BubbleT2 = BubbleT1+1;
def afterStart1 = GetTime() > RegularTradingStart(GetYYYYMMDD()[1]);
def beforeEOD1 = GetTime()[1] < RegularTradingEnd(GetYYYYMMDD());


#def VWBull = if aPeriod < AggregationPeriod.DAY then DeltaVWAP else 9;


#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=-> <-=->
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=-> <-=-> <-=-> Bullish Signal
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  <-=->
# TTiSqueeze == 2 is a crossover signals end of Squeeze
# TTiSqueeze == 1 signals no Squeeze
# TTiSqueeze == -1 signals in a Squeeze ...  UpperBand < Upper_Kel or LowerBand > Lower_Kel
def  bullishSignal = # if
               percentLR < 85
           and percentLR > 15
           and hma >= 0
           and direction > 0
           and VolSig > 0
         #  and percentB >= 0.15
         #  and percentB <= 0.85
         #  and percentB > percentB[1] 
           and TTiSqueeze >= 0
           and (Stochastic >= 0 or StochasticBuy)
           and Mom >= 0
           and (EMA_Buy >= 0 or EMA_condition2 >= 0)
           and DeltaVWAP >= 0;
         #  and  IsNaN(priceC[BubbleT1])       #-5])
         #  and !IsNAN(priceC[BubbleT2])       #+5])
;
AddLabel(ShowBullishLabel and bullishSignal,
    "Bullish ", CreateColor(100,255,100));#AddLabel(ShowBullishLabel and hma >
alert(bullishSignal and aPeriod >= AggregationPeriod.hour,
    "Bullish Signal", ALert.Once, Sound.Ring);
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=-> <-=->
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=-> <-=-> <-=-> Bearish Signal
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=-> <-=->
# TTiSqueeze == 2 is a crossover signals end of Squeeze
# TTiSqueeze == 1 signals no Squeeze
# TTiSqueeze == -1 signals in a Squeeze  ...  UpperBand < Upper_Kel or LowerBand > Lower_Kel
#def VWBear = if aPeriod < AggregationPeriod.DAY then DeltaVWAP else -9;
def  bearishSignal = # if
               percentLR < 85
           and percentLR > 15
           and hma <= 0
           and direction <= 0
           and VolSig <= 0
         #  and percentB >= 0.15 and percentB <= 0.85
         #  and percentB < percentB[1]                      #added 7/25/24
           and TTiSqueeze >= 0
           and (Stochastic <= 0 or StochasticSell)
           and Mom <= 0
           and (EMA_Buy <= 0 or EMA_condition2 <= 0)
           and DeltaVWAP <= 0;
         #  and  IsNaN(priceC[BubbleT1])       #-5])
         #  and !IsNAN(priceC[BubbleT2])       #+5]) 
;
AddLabel(ShowBearishLabel and bearishSignal ,
    "Bearish ", Color.Red);


alert(bearishSignal and aPeriod >= AggregationPeriod.hour,
    "bearish Signal", ALert.Once, Sound.Ring);


#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=-> <-=->
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Buy Bubble
AddChartBubble(bullishSignal and IsNaN(priceC[BubbleT1]) and !IsNAN(priceC[BubbleT2])
    , lowest(Low,21) * 0.97,
    "Buy~"+ round((PriceH+PriceL)/2,2), CreateColor(128, 255, 128), no);


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Sell Bubble
AddChartBubble(bearishSignal and IsNaN(priceC[BubbleT1]) and !IsNAN(priceC[BubbleT2])
    , lowest(Low,21) * 0.97,
    "Sel~"+ round((PriceH+PriceL)/2,2), CreateColor(255, 128, 128), no);




#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=-> <-=->
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=-> <-=-> <-=-> all Other Signals
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=-> <-=->
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=-> all other signals
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Bullish




#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Not BullishSignal


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Stochastic
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->
AddLabel(!bullishSignal and !bearishSignal and ShowNotBullishLabel and (Stochastic >= 0 or StochasticBuy),
    "S", CreateColor(100,255,100) );


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Hma
AddLabel(!bullishSignal and !bearishSignal and ShowNotBullishLabel and hma > 0,
    "H", CreateColor(100,255,100) );#255,164,128) );
AddLabel(!bullishSignal and !bearishSignal and ShowNotBullishLabel and HmaBuy,
    "HmaBuy", CreateColor(100,255,100) );
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> EMA_condition
AddLabel(!bullishSignal and !bearishSignal and ShowNotBullishLabel and EMA_Buy > 0 and EMA_condition2 > 0,
    "E", CreateColor(100,255,100) );#255,164,128) );
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Mom
#        !bullishSignal and
AddLabel(!bullishSignal and !bearishSignal and ShowNotBullishLabel and MOM > 0,
    "M", CreateColor(100,255,100) );#255,164,128) );
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> if UpperBand >= Upper_Kel
AddLabel(!bullishSignal and !bearishSignal and ShowNotBullishLabel and  direction > 0 ,
    "D", CreateColor(100,255,100) );#255,164,128) );
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->
AddLabel(!bullishSignal and !bearishSignal and ShowNotBullishLabel and  VolSig > 0,
    "Vol", CreateColor(100,255,100) );#255,164,128) ); #Color.Dark_orange);


#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->               
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Bullish Linear Regression
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->                 


addlabel(showLabel and percentLR > percentLR[1],
    round(percentLR,0)+
    "%LR", CreateColor(100,255,100));
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->               
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Bulish VWAP
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->               
#AddLabel( showLabel and ShowNotBullishLabel and priceC > VWAP1,
#Concat("C>VW:", round(DeltaVWAP,0)), CreateColor(100,255,128) );
AddLabel( showLabel and ShowNotBullishLabel and priceC > VWAP1,
    "C>VW", CreateColor(100,255,128) );


#addlabel(showLabel and ShowNotBullishLabel #and!bullishSignal and !bearishSignal
#                    and DeltaVWAP >= 0,
#"VW:"+DeltaVWAP, CreateColor(100, 255, 100));
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->               
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> TTiSqueezeEnds
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->               
#+TTiSqueezeEnds
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->
AddLabel(ShowNotBearishLabel or ShowNotBullishLabel,
    "'",CreateColor(100,00,255));#CreateColor(100,255,100));
# TTiSqueeze == 2 is a crossover signals end of Squeeze
# TTiSqueeze == 1 signals no Squeeze
# TTiSqueeze == -1 signals in a Squeeze ...  UpperBand < Upper_Kel or LowerBand > Lower_Kel
AddLabel(#!bullishSignal and !bearishSignal and
    (showLabel or ShowNotBearishLabel or ShowNotBullishLabel) and (TTiSqueeze >= 2 or TTiSqueeze[1] >= 2),
    "TTiSqzeEnds", CreateColor(181,255,181) );#Moccasin
AddLabel(#!bullishSignal and !bearishSignal and
    (showLabel or ShowNotBearishLabel or ShowNotBullishLabel) and TTiSqueeze == 1,
    "TTi:"+TTiSqueeze, CreateColor(200,255,222) );#Moccasin
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> TTiSqueeze'ng
AddLabel(#!bullishSignal and !bearishSignal and
    (showLabel or ShowNotBearishLabel or ShowNotBullishLabel) and TTiSqueeze < 0, #UpperBand < Upper_Kel,
    "TTiSqze", CreateColor(255,164,128) );# My Orange
#AddLabel(!bullishSignal and !bearishSignal and ShowNotBearishLabel  and TTiSqueeze < 0, #UpperBand < Upper_Kel,
#    "TTiSqze"+round(UpperBand,1) +"/"+ round(Upper_Kel,1), CreateColor(255,164,128) );
AddLabel(ShowNotBearishLabel or ShowNotBullishLabel,
    ",",CreateColor(100,00,255));#CreateColor(255,100,100));
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->  BB %B
#        !bearishSignal and ... and percentB >= 0.25 and percentB <= 0.9
#AddLabel(ShowNotBearishLabel and percentB < percentB[1],
#     percentB *100 +"%B", CreateColor(255,100,100) );#255,164,128) );


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->  Linear Regression
                  
#addlabel(showLabel and (percentLR < 20 or percentLR > 80),round(percentLR,0)+"%LR", CreateColor(255, 255, 0));
#addlabel(showLabel and percentLR < 20,round(percentLR,0)+"%LR,", CreateColor(255, 255, 0));
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->               
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Bearish VWAP
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->               
#AddLabel( showLabel and ShowNotBullishLabel and priceC < VWAP1,
# Concat("C<VW:", round(DeltaVWAP,0)), CreateColor(255,100,128) );
#AddLabel( showLabel and ShowNotBullishLabel and priceC < VWAP1,
#     "C<VW", CreateColor(255,100,128) );
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->               
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Bearish Linear Regression
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->               
addlabel(showLabel and percentLR < percentLR[1], #!bearishSignal 
    round(percentLR,0)+
    "%LR", Color.dark_orange);


#addlabel(showLabel and ShowNotBearishLabel #and!bullishSignal and !bearishSignal
#                   and DeltaVWAP <= 0,
#"VW:"+DeltaVWAP, CreateColor(255, 100, 100));
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->  Bearish
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->              Bearish
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->                Bearish
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->        Bearish
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->                Bearish
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->              Bearish
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->  Bearish
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Stochastic
AddLabel(!bullishSignal and !bearishSignal and ShowNotBearishLabel and Stochastic <= 0,
    "S", CreateColor(255,100,100) );


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Hma
AddLabel(!bullishSignal and !bearishSignal and ShowNotBearishLabel     and hma <= 0,
    "H", CreateColor(255,100,100) );#255,164,128) );
AddLabel(!bullishSignal and !bearishSignal and ShowNotBearishLabel     and hmaSell,
    "HmaSell", CreateColor(255,100,100) );#255,164,128) );
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> EMA_condition
AddLabel(!bullishSignal and !bearishSignal and ShowNotBearishLabel and EMA_Buy <= 0 and EMA_condition2 <= 0,
    "E", CreateColor(255,100,100) );#255,164,128) );
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Mom
#        !bearishSignal and
AddLabel(!bullishSignal and !bearishSignal and ShowNotBearishLabel and MOM <= 0,
    "M", CreateColor(255,100,100) );#255,164,128) );
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> if UpperBand >= Upper_Kel
AddLabel(!bullishSignal and !bearishSignal and  ShowNotBearishLabel and  direction <= 0 ,
    "D", CreateColor(255,100,100) );#255,164,128) );
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->
AddLabel(!bullishSignal and !bearishSignal and ShowNotBearishLabel and  VolSig <= 0,
    "Vol:", CreateColor(255,100,100) );#255,164,128) ); #Color.Dark_orange);


#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=-> /|\^;-;^/|\ 
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->


def score = EMA_condition1 + EMA_condition2 + Stochastic + Mom + hma + direction + VolSig;
def BullishScrore = if EMA_condition1 > 1 and EMA_condition2 > 1 then 1 else 0;
              
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->               
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->               Last Label is the score
#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->               
AddLabel(ShowNotBearishLabel or ShowNotBullishLabel,
    "\",CreateColor(100,00,255));#CreateColor(100,255,100));
AddLabel(1,#!bullishSignal and !bearishSignal and ShowNotBearishLabel ,
    "BvsB:" + score,
             if score > 9  then CreateColor(000,255,128)
        else if score > 5  then CreateColor(128,255,128)
        else if score > 3  then CreateColor(200,255,200)
        else if score >= 0  then CreateColor(220,255,220)
        else if score < -9 then CreateColor(255,000,000)
        else if score < -5 then CreateColor(255,64,64)
        else if score < -3 then CreateColor(255,150,150)
        else if score <  0 then CreateColor(255,220,220)
        else CreateColor(255,255,0)
 );#255,164,128) ); #Color.Dark_orange);
AddLabel(ShowNotBearishLabel or ShowNotBullishLabel,
    "/",CreateColor(100,00,255));#CreateColor(255,100,100));
#addOrder(OrderType.BUY_AUTO, no);
def PL = round(PriceL,2);
def PH = round(PriceH,2);


def ba = 1;#Concat(PL , PH);


AddOrder(OrderType.BUY_AUTO,
 bullishSignal
 and (
        stochasticBuy
  or    (TTiSqueeze == 2 and TTiSqueeze[1] < 2)
  or    HmaBuy
  or    (Upsignal and EMA_Buy)
  or    EmaBuy
),
    (round(PriceL,2)+round(PriceH,2))/2,              #close, 
     1,                                               # How many to buy
    Color.Lime, Color.Lime,
    " Buy~" + (round(PriceL,2)+round(PriceH,2))/2); # Looking at the high of the previous bar.


AddOrder(OrderType.SELL_AUTO, 
 bearishSignal
 and (
        stochasticSell
  or    (TTiSqueeze == 2 and TTiSqueeze[1] < 2)
  or    HmaSell
  or    (Dnsignal and EMA_Sel)
  or    EmaDip
),
    (round(PriceL,2)+round(PriceH,2))/2,              #close, 
     1,                                               # How many to buy
    Color.Pink, Color.Pink,
    " Sell~" + (round(PriceL,2)+round(PriceH,2))/2); # Looking at the high of the previous bar.


#<-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=->  /|\^;-;^/|\  <-=-> /|\^;-;^/|\ 
# Copyright  (c) 2023 2024 Carey Lynch and Calyco Software
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
335 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top