I have combined the three indicators with each other but there are a few points of attention in the indicators such as variables that are not used, the STC indicator only goes “Long” (I have adjusted) and some other things…
You can set the number of bars that the signal is valid for all three indicators…
I have now made a certain combination of the conditions, but other combinations can also be set…
Once MACDBars=3
Once MABandBars=3
Once STCBars=3
//MACD on Price
Once FastLength1=12
Once SlowLength1=26
Once Signal=9
Once MovingAverageType=0
FL=Average[FastLength1,MovingAverageType](close)
SL=Average[SlowLength1,MovingAverageType](close)
BRSMACD=FL-SL
Si=Average[Signal,MovingAverageType](BRSMACD)
//Zeroline=0
//D=BRSMACD-Si
If BRSMACD Crosses Over Si Then
//DrawArrowUp(barindex,low-0.5*pipsize)coloured(0,255,0) //Signal=buy
BuyMACD=1
else
BuyMACD=0
EndIf
If BRSMACD Crosses Under Si Then
//DrawArrowDown(barindex,high)coloured(255,0,0) //Signal=sell
SellMACD=1
else
SellMACD=0
Endif
//Return BRSMACD as "MACD", Si as "Signal", Zeroline as "Zeroline", D as "Histogram"
//SP on Price:
//—————————————//
//PRC_SP Indicator
//version = 1
//11.02.2025
//Iván González @ http://www.prorealcode.com
//Sharing ProRealTime knowledge
//—————————————//
// inputs
//—————————————//
//src=close
//len=60
//—————————————//
// Moving Average and Bands
//—————————————//
//bbmc=average[max(1,round(sqrt(len))),2](average[max(1,round(len/2)),2](src)*2-average[len,2](src))
//rangema=average[len,1](tr)
//upperk=bbmc+rangema*0.2
//lowerk=bbmc-rangema*0.2
//—————————————//
// Colors Definition
//—————————————//
//if close>upperk then
//r=33
//g=150
//b=243
//elsif close<lowerk then
//r=225
//g=64
//b=251
//else
//r=120
//g=123
//b=134
//endif
//drawcandle(open,high,low,close)coloured(r,g,b)
//—————————————//
// Signals
//—————————————//
srcH=high
lenH=15
ExitHigh=average[max(1,round(sqrt(lenH))),2](average[max(1,round(lenH/2)),2](srcH)*2-average[lenH,2](srcH))
srcL=low
lenL=15
ExitLow=average[max(1,round(sqrt(lenL))),2](average[max(1,round(lenL/2)),2](srcL)*2-average[lenL,2](srcL))
if close>ExitHigh then
Hlv3=1
elsif close<ExitLow then
Hlv3=-1
endif
if Hlv3<0 then
sslExit=ExitHigh
else
sslExit=ExitLow
endif
baseCrossLong=close crosses over sslExit
baseCrossShort=close crosses under sslExit
if baseCrossLong then
//codiff=1
//drawarrowup(barindex,low-pipsize*1.5)coloured(33,150,243)
BuyMABand=1
Else
BuyMABand=0
EndIf
if baseCrossShort then
//codiff=-1
//drawarrowdown(barindex,high+rangema*0.5)coloured(225,64,251)
SellMABand=1
else
SellMABand=0
//codiff=1=undefined
endif
//—————————————//
//return bbmc coloured(r,g,b)style(line,2)
//Entry signal on Price
//———————————————————//
//PRC_Trend Cycle STC
//version = 0
//20.02.2025
//Iván González @ http://www.prorealcode.com
//Sharing ProRealTime knowledge
//———————————————————//
// Inputs
//———————————————————//
fastLength = 23 // Fast moving average length (MACD)
slowLength = 50 // Slow moving average length (MACD)
KPeriod = 10 // %K period for stochastic
DPeriod = 3 // %D period for stochastic smoothing
overBought = 75 // Overbought level
overSold = 25 // Oversold level
averageType = 1 // Type of moving average used in calculations
//———————————————————//
// MACD Calculation
//———————————————————//
mymacd= average[fastLength,averageType](close)-average[slowLength,averageType](close)
// First Stochastic Stage on MACD
LowestMACD = LOWEST[ KPeriod ](mymacd)
HighestMACD = HIGHEST[ KPeriod ](mymacd)
IF HighestMACD - LowestMACD <> 0 THEN
FastK1 = ((mymacd - LowestMACD) / (HighestMACD - LowestMACD)) * 100
ELSE
FastK1 = 0
ENDIF
FastD1 = AVERAGE[DPeriod,averageType](FastK1) // Smoothed FastK1
// Second Stochastic Stage on FastD1
LowestFastD1 = LOWEST[KPeriod](FastD1)
HighestFastD1 = HIGHEST[KPeriod](FastD1)
IF HighestFastD1 - LowestFastD1 <> 0 THEN
FastK2 = ((FastD1 - LowestFastD1) / (HighestFastD1 - LowestFastD1)) * 100
ELSE
FastK2 = 0
ENDIF
// Final STC Calculation
STC = AVERAGE[DPeriod,averageType](FastK2)
//———————————————————//
// Plot
//———————————————————//
// Detection of Crossovers from the Oversold Zone
STCCrossAboveOversold = STC crosses over Oversold
if STCCrossAboveOversold then
//drawarrowup(barindex,low-1.5*pipsize)coloured("white")
//drawpoint(barindex,STC,5)coloured("green",40)
//drawpoint(barindex,STC,2)coloured("green",200)
BuySTC=1
else
BuySTC=0
endif
STCCrossUnderOverBought = STC crosses under OverBought
if STCCrossUnderOverBought then
//drawarrowup(barindex,low-1.5*pipsize)coloured("white")
//drawpoint(barindex,STC,5)coloured("green",40)
//drawpoint(barindex,STC,2)coloured("green",200)
SellSTC=1
else
SellSTC=0
endif
//// Color Assignment
//IF STC > OverBought THEN
//r = 255
//g = 0
//b = 0 // Red for overbought
//ELSIF STC < OverSold THEN
//r = 0
//g = 255
//b = 0 // Green for oversold
//ELSE
//r = 128
//g = 128
//b = 128 // Grey for neutral zone
//ENDIF
//———————————————————//
// Return Oscillator below price
//———————————————————//
//RETURN //STC AS "STC Oscilador" COLOURED(r,g,b) STYLE(LINE,2), OverBought AS "Sobrecompra" COLOURED("red") STYLE(dottedline), OverSold AS "Sobreventa" COLOURED("green") STYLE(dottedline)
c1=Summation[MACDBars](BuyMACD)=1
c2=Summation[MACDBars](SellMACD)=1
c3=Summation[MABandBars](BuyMABand)=1
c4=Summation[MABandBars](SellMABand)=1
c5=Summation[STCBars](BuySTC)=1
c6=Summation[STCBars](SellSTC)=1
Screener[(c1 and (c2 or c3)) or (c4 and (c5 or c6))]