Dear Thinkscript community,
I have developped this script for ticks (based on same indicator developped by simpler trading):
I would like to modify this code to have the same thing with the MAG7 stocks: AAPL, AMZN, GOOGL, META, MSFT, NVDA, TSLA. Could you please help me ? I am a newbie with Thinkscript !
Many thanks in advance for your help
I have developped this script for ticks (based on same indicator developped by simpler trading):
I would like to modify this code to have the same thing with the MAG7 stocks: AAPL, AMZN, GOOGL, META, MSFT, NVDA, TSLA. Could you please help me ? I am a newbie with Thinkscript !
Many thanks in advance for your help
Code:
declare lower;
input TICK_Symbol = {default "$TICK", "$TICKC", "$TIKSP", "$TIKSPC", "$TIKND", "$TICKC/Q", "$TIKNDC", "$TICK/Q", "$TIKRL", "$TIKI", "$TIKA", "$TICKAC", "$TICKAR", "$TICKARC", "$TIKIC", "$TIKRLC", "$TIKUS", "$TIKUSC"};
input SMA_High_extreme = 300; #Limit High for SMA Ticks - Overbought
input SMA_Low_extreme = -300; #Limit Low for SMA Ticks - Oversold
input TICK_High_extreme = 800; #Limit High for Ticks - Overbought
input TICK_Low_extreme = -800; #Limit Low for Ticks - Oversold.
input Moving_Average_Length = 5; #Moving Average Length
input Moving_Average_Type = AverageType.SIMPLE;
input Average_Price = {default hlc3, close};
input TICK_Histogram_Size = 1;
input TICK_Points_Size = 4;
input Show_TICK_close = {default "NO", "YES"};
#Ticks Colors
DefineGlobalColor("QuietTicks", Color.LIGHT_GRAY);
DefineGlobalColor("TickAverage", Color.CYAN);
DefineGlobalColor("TickHighBars", Color.DARK_GREEN);
DefineGlobalColor("TickTurbo", Color.Magenta);
DefineGlobalColor("TickLowBars", Color.DARK_RED);
DefineGlobalColor("TickAverageHighExtreme", Color.RED);
DefineGlobalColor("TickAverageLowExtreme", Color.YELLOW);
DefineGlobalColor("TickClose", Color.WHITE);
def tickdata;
switch (Average_Price) {
case hlc3:
tickdata = hlc3(TICK_Symbol);
case close:
tickdata = close(TICK_Symbol);
}
def Moving_Average = MovingAverage(Moving_Average_Type, tickdata, Moving_Average_Length);
#Plots 0 line (style = line)
plot ZeroLine = 0;
ZeroLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ZeroLine.SetLineWeight(1);
ZeroLine.SetDefaultColor(Color.WHITE);
ZeroLine.SetStyle(Curve.FIRM);
#Plots Up limit for $TICK (+600) (style = line)
plot TICKLimitUP = 600;
TICKLimitUP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TICKLimitUP.SetLineWeight(1);
TICKLimitUP.SetDefaultColor(Color.GREEN);
TICKLimitUP.SetStyle(Curve.FIRM);
#Plots Down limit for $TICK (-600) (style = line)
plot TICKLimitDN = -600;
TICKLimitDN.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TICKLimitDN.SetLineWeight(1);
TICKLimitDN.SetDefaultColor(Color.RED);
TICKLimitDN.SetStyle(Curve.FIRM);
#Plots Medium limit Up for $TICK (+800) (style = line)
plot TICKLimitMediumUP = 800;
TICKLimitMediumUP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TICKLimitMediumUP.SetLineWeight(1);
TICKLimitMediumUP.SetDefaultColor(Color.RED);
TICKLimitMediumUP.SetStyle(Curve.FIRM);
#Plots Medium limit Down for $TICK (-800) (style = line)
plot TICKLimitMediumDN = -800;
TICKLimitMediumDN.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TICKLimitMediumDN.SetLineWeight(1);
TICKLimitMediumDN.SetDefaultColor(Color.GREEN);
TICKLimitMediumDN.SetStyle(Curve.FIRM);
#Plots Moving Average (style = line)
#plot MovingAverage = if !IsNaN(Moving_Average) then Moving_Average else Double.NaN;
plot TickAverage = if !IsNaN(Moving_Average) then Moving_Average else Double.NaN;
TickAverage.SetPaintingStrategy(PaintingStrategy.LINE);
TickAverage.SetLineWeight(2);
TickAverage.SetDefaultColor(Color.CYAN);
TickAverage.SetStyle(Curve.FIRM);
#Plots High of $TICK (style = histogram)
plot TickHigh = if high(TICK_Symbol) >= 0 then high(TICK_Symbol) else 0;
TickHigh.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
TickHigh.AssignValueColor(if high(TICK_Symbol) >= SMA_High_extreme then GlobalColor("TickHighBars") else GlobalColor("QuietTicks"));
TickHigh.SetLineWeight(TICK_Histogram_Size);
#Plots Low of $TICK (style = histogram)
plot TickLow = if low(TICK_Symbol) <= 0 then low(TICK_Symbol) else 0;
TickLow.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
TickLow.AssignValueColor(if low(TICK_Symbol) <= SMA_Low_extreme then GlobalColor("TickLowBars") else GlobalColor("QuietTicks"));
TickLow.SetLineWeight(TICK_Histogram_Size);
#Plots High Max of $TICK (style = point) if High Max >= TICK_High_extreme
plot TickHighExtreme = if high(TICK_Symbol) >= TICK_High_extreme then high(TICK_Symbol) else Double.NaN;
TickHighExtreme.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
TickHighExtreme.SetLineWeight(TICK_Points_Size);
TickHighExtreme.SetDefaultColor(GlobalColor("TickTurbo"));
#Plots Low Max of $TICK (style = point) if Low Min <= TICK_Low_extreme
plot TickLowExtreme = if low(TICK_Symbol) <= TICK_Low_extreme then low(TICK_Symbol) else Double.NaN;
TickLowExtreme.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
TickLowExtreme.SetLineWeight(TICK_Points_Size);
TickLowExtreme.SetDefaultColor(GlobalColor("TickTurbo"));
#Plots High Max of SMA (style = point) if Moving_Average >= SMA_High_extreme
plot MovingAveragehigh_extreme = if Moving_Average >= SMA_High_extreme then Moving_Average else Double.NaN;
MovingAveragehigh_extreme.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
MovingAveragehigh_extreme.SetLineWeight(TICK_Points_Size);
MovingAveragehigh_extreme.SetDefaultColor(GlobalColor("TickAverageHighExtreme"));
#Plots Low Min of $TICK (style = point) if Moving_Average <= SMA_Low_extreme
plot MovingAveragelow_extreme = if Moving_Average <= SMA_Low_extreme then Moving_Average else Double.NaN;
MovingAveragelow_extreme.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
MovingAveragelow_extreme.SetLineWeight(TICK_Points_Size);
MovingAveragelow_extreme.SetDefaultColor(GlobalColor("TickAverageLowExtreme"));
#Plots $TICK close
plot TICKclose = if Show_TICK_close and !IsNaN(close(TICK_Symbol)) then close(TICK_Symbol) else Double.NaN;
TICKclose.SetPaintingStrategy(PaintingStrategy.POINTS);
TICKclose.SetLineWeight(1);
TICKclose.SetDefaultColor(GlobalColor("TickClose"));
#END
Attachments
Last edited by a moderator: