Changing the color of a vertical line on an indicator


Category:
0
0

How do I change the color of a vertical line on an indicator? I would like to be able to have the AddVerticalLine that I have below for the OverBought condition be green instead of red.

 

declare lower;
def movingAvgLength = 1;
input length1 = 14;
def over_Bought = 70;
def over_Sold = 30;

plot MoneyFlowIndex = Average(MoneyFlow(high, close, low, volume, length1), movingAvgLength);
plot OverBought = over_Bought;
OverBought.SetDefaultColor(Color.BLACK);
OverBought.HideTitle();
plot OverSold = over_Sold;
OverSold.SetDefaultColor(COlor.Black);
OverSold.HideTitle();
AddVerticalLine (MoneyFlowIndex > OverBought);
AddVerticalLine (MoneyFlowIndex < OverSold);

Marked as spam
Posted by (Questions: 15, Answers: 23)
Asked on September 11, 2018 8:14 pm
600 views
0
Private answer

Very simple solution.

Details are provided here: http://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Look—Feel/AddVerticalLine.html

AddVerticalLine (MoneyFlowIndex > OverBought, "", Color.GREEN);
AddVerticalLine (MoneyFlowIndex < OverSold, "", Color.GREEN);

 

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on September 12, 2018 8:07 am
0

There is an error code that comes up when I try that.

( at September 12, 2018 11:38 am)
0

Sorry, I left out the placeholder for the text parameter. I have corrected the code in my answer above.

( at September 12, 2018 11:43 am)
0

That worked, thanks Pete!

( at September 13, 2018 5:13 am)