Join useThinkScript to post your question to a community of 21,000+ developers and traders.
input StartDate = 20191003;
def hh = if GetYYYYMMDD() == StartDate then high else if high > hh[1] then high else hh[1];
plot higherHigh = if GetYYYYMMDD() < StartDate then Double.NaN else hh;
higherHigh.SetPaintingStrategy(12);
plot my_line = 1; #change 1 to whatever static value or variable you want it to plot
def mostRecentBar = !IsNaN(close) and IsNaN(close[-1]);
def mostRecentBarNumExtract = If mostRecentBar Then BarNumber() else Double.NaN;
def mostRecentBarNum = HighestAll(mostRecentBarNumExtract);
plot someStuff = If BarNumber() > (mostRecentBarNum - 5) Then high + 2 else Double.NaN;
# 1hr UT
# 2hr UT
# 4hr UT
# Swing Pivot High
#Resistance
plot data1 = 1995.6; data1.SetDefaultColor(Color.Red);
plot data2 = 1995.6; data1.SetDefaultColor(Color.Red);
plot data3 = 1995.6; data1.SetDefaultColor(Color.Red);
plot data4 = 1995.6; data1.SetDefaultColor(Color.Red);
#Support
plot data5 = 1995.6; data1.SetDefaultColor(Color.Green);
plot data6 = 1995.6; data1.SetDefaultColor(Color.Green);
plot data7 = 1995.6; data1.SetDefaultColor(Color.Green);
plot data8 = 1995.6; data1.SetDefaultColor(Color.Green);
#
input price = close;
input length1 = 15;
input length2 = 30;
input averageType1 = AverageType.SIMPLE;
input averageType2 = AverageType.SIMPLE;
input crossingType = {default above, below};
def avg1 = MovingAverage(averageType1, price, length1);
def avg2 = MovingAverage(averageType2, price, length2);
plot signal = Crosses(avg1, avg2, crossingType == crossingType.above);
signal.DefineColor("Above", GetColor(6));
signal.DefineColor("Below", GetColor(7));
signal.AssignValueColor(if crossingType == crossingType.above then signal.Color("Above") else signal.Color("Below"));
signal.SetPaintingStrategy(if crossingType == crossingType.above
then PaintingStrategy.DASHES
else PaintingStrategy.DASHES);
signal.SetPaintingStrategy(PaintingStrategy.DASHES);
#-------------------------------------
#
input price = close;
input length1 = 15;
input length2 = 30;
input averageType1 = AverageType.SIMPLE;
input averageType2 = AverageType.SIMPLE;
input crossingType = {default above, below};
plot avg1 = MovingAverage(averageType1, price, length1);
plot avg2 = MovingAverage(averageType2, price, length2);
def sigtest;
switch(crossingType){
case above:
sigtest = avg1 crosses above avg2;
case below:
sigtest = avg1 crosses below avg2;
}
def sigline = if sigtest then (avg1+avg2)/2 else if sigtest[1] and !sigtest then (avg1[1]+avg2[1])/2 else sigline[1];
plot signal = sigline;
signal.DefineColor("Above", GetColor(6));
signal.DefineColor("Below", GetColor(7));
signal.AssignValueColor(if crossingType == crossingType.above then signal.Color("Above") else signal.Color("Below"));
signal.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#-------------------------------------
AddLabel(yes, GetSymbol());
switch((GetSymbol()){
case "ZM" :
{ plot p_100 = 100;
plot P_207 = 207;
plot P_319 = 319;
plot P_429 = 429; }
case "AAPL":
{ Plot P_100 = 100;
Plot P_250 = 250;
Plot P_275 =275; }
}
Start a new thread and receive assistance from our community.
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.
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.