ThinkorSwim "Exactly one plot expected" Error

Parker427

New member
VIP
Hi, for the "scanner" i copied and pasted where you can create a new scanner and an error says "exactly one plot expected" and it wont let me press the "ok" button to start scanning. Can someone tell me step by step on what to do?
 
Solution
You can only have one plot in scan code... You can either comment out plots you don't need or replace all but one plot with def... Another option for some study scripts is to reference them from the Conditional Wizard as that method can bypass limitations at times...

rad14733

Well-known member
VIP
You can only have one plot in scan code... You can either comment out plots you don't need or replace all but one plot with def... Another option for some study scripts is to reference them from the Conditional Wizard as that method can bypass limitations at times...
 
Solution

Parker427

New member
VIP
You can only have one plot in scan code... You can either comment out plots you don't need or replace all but one plot with def... Another option for some study scripts is to reference them from the Conditional Wizard as that method can bypass limitations at times...
Again, I don’t know what any of that means, all I know how to do is copy and paste. I was hoping someone could repost the correct coding and I’ll just use that
 

BenTen

Administrative
Staff member
Staff
VIP
Here is an example. Below is the RSI indicator.

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2020
#

declare lower;

input length = 14;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;

def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot UpSignal = if RSI crosses above OverSold then OverSold else Double.NaN;
plot DownSignal = if RSI crosses below OverBought then OverBought else Double.NaN;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

RSI.DefineColor("OverBought", GetColor(5));
RSI.DefineColor("Normal", GetColor(7));
RSI.DefineColor("OverSold", GetColor(1));
RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

If I paste that entire script into my scanner, ThinkorSwim will return the "Exactly one plot expected" error.

eo8twLw.png


You need to use the Conditional Wizard to build a scanner for each plot. One for "UpSignal" and the other for "DownSignal"

JeSgC3J.png
 

Similar threads

Top