samiranadhikari
Member
This script is a thinkScript code for a custom scan on the Thinkorswim platform. The scan looks for bullish and bearish signals based on a combination of several technical indicators, including simple moving averages, the Stochastic oscillator, and the MACD histogram. I need help to create a scan for this.
def SMA10 = SimpleMovingAvg(close,10);
def SMA30 = SimpleMovingAvg(close,30);
def SMA100 = SimpleMovingAvg(close,100);
def StoSloK = StochasticSlow(80,20,21,3).SlowK;
def StoSloD = StochasticSlow(80,20,21,3).SlowD;
def StoSloOB = StochasticSlow(80,20,21,3).Overbought;
def StoSloOS = StochasticSlow(80,20,21,3).Oversold;
def MH = MACDHistogram();
plot bullish = if (close > SMA10 and close[1] <= SMA10[1]) and (close > SMA100) and StoSloK < StoSloOB and StoSloD < StoSloOB and MH > 0 then 1 else 0;
plot bearish = if (close < SMA10 and close[1] >= SMA10[1]) and (close < SMA100) and StoSloK > StoSloOS and StoSloD > StoSloOS and MH < 0 then 1 else 0;
bullish.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Up);
bearish.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Down);
bullish.SetLineWeight(5);
bearish.SetLineWeight(5);
Correction. That was an indicator...requesting code for scan!
def SMA10 = SimpleMovingAvg(close,10);
def SMA30 = SimpleMovingAvg(close,30);
def SMA100 = SimpleMovingAvg(close,100);
def StoSloK = StochasticSlow(80,20,21,3).SlowK;
def StoSloD = StochasticSlow(80,20,21,3).SlowD;
def StoSloOB = StochasticSlow(80,20,21,3).Overbought;
def StoSloOS = StochasticSlow(80,20,21,3).Oversold;
def MH = MACDHistogram();
plot bullish = if (close > SMA10 and close[1] <= SMA10[1]) and (close > SMA100) and StoSloK < StoSloOB and StoSloD < StoSloOB and MH > 0 then 1 else 0;
plot bearish = if (close < SMA10 and close[1] >= SMA10[1]) and (close < SMA100) and StoSloK > StoSloOS and StoSloD > StoSloOS and MH < 0 then 1 else 0;
bullish.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Up);
bearish.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Down);
bullish.SetLineWeight(5);
bearish.SetLineWeight(5);
Correction. That was an indicator...requesting code for scan!
Last edited by a moderator: