thinkScript SetPaintingStrategy() with multiple conditions

Vision

New member
2019 Donor
I want to apply a conditional statement to the SetPaintingStrategy() in thinkscript so that the color plot will change when a specific condition is met.

Sample code with paintingstrategy:

Code:
plot Result = 10;
Result.setPaintingStrategy(if condition then paintingStrategy.ARROW_UP else paintingstrategy.ARROW_DOWN);
 
Last edited:
Solution
@Vision The SetPaintingStrategy construct only expects a single piece of constant, you're not going to be able to run that conditional test as stated. Why not you share with us what you're really trying to achieve, chances are you can achieve the same result but using a different path. Makes sense?

Here's an example of how to use the SetPaintingStrategy()

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

input price = close;
input length = 9;
input displace = 0;

plot SMA = Average(price[-displace], length);
plot UpSignal = price crosses above SMA;
plot DownSignal = price crosses below SMA;

SMA.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK)...

tomsk

Well-known member
VIP
@Vision The SetPaintingStrategy construct only expects a single piece of constant, you're not going to be able to run that conditional test as stated. Why not you share with us what you're really trying to achieve, chances are you can achieve the same result but using a different path. Makes sense?

Here's an example of how to use the SetPaintingStrategy()

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

input price = close;
input length = 9;
input displace = 0;

plot SMA = Average(price[-displace], length);
plot UpSignal = price crosses above SMA;
plot DownSignal = price crosses below SMA;

SMA.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

SetPaintingStrategy is used to plot up and down arrows for the price and moving average crossovers.
 
Solution

Similar threads

Top