Color column based on LBR_ThreeTenOscillator crossover


Category:
0
0

Okay. Try again. I am fond of the LBR3/10 Oscillator. I am trying to have a color column change when the fast line crosses above the slow line. I have attached the original Oscillator script and the script I worked on with another to make it a Study. This shows on the chart when they happen. Thank you if you can assist me. 

 

Attachments:
RESOLVED
Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on June 29, 2020 10:24 am
92 views
0
Private answer

I updated the title of the question to include the name of this study as it exists in Thinkorswim. This should help those searching for this to locate it quickly.

Rather than adapting your own code I simply copied the source code for the one included with Thinkorswim added crossover signals and then configured the value and colors for the custom column. Value of 1 and color green for cross above, value of -1 and color red for cross below. All other conditions will print zero and leave the color as is.

input price = close;
input calculationMode = {default Normal, Alternate};
def fastLine;
switch (calculationMode) {
case Normal:
fastLine = Average(price, 3) - Average(price, 10);
case Alternate:
fastLine = Average(price - Average(price[3], 3), 2);
}
def slowLine = Average(fastLine, 16);
def crossAbove = fastLine[1] < slowLine[1] and fastLine > slowLine;
def crossBelow = fastLine[1] > slowLine[1] and fastLine < slowLine;
plot data = if crossAbove then 1 else if crossBelow then -1 else 0;
data.AssignValueColor(if data <> 0 then Color.BLACK else Color.CURRENT);
AssignBackgroundColor(if data > 0 then Color.GREEN else if data < 0 then Color.RED else Color.CURRENT);

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on June 29, 2020 11:19 am
0
Thank you Pete! Appreciate it. Truly appreciate it! Can't wait to give it a whirl.
( at June 29, 2020 12:23 pm)