Plot vertical lines when TTM Wave C is contracting


Category:
0
0

I am trying to create a thinkscript that shows vertical lines on the chart when the ttm wave (wave2high) has Dark blue bars/contraction And Zero or no lines when the ttm wave (wave2high) has cyan bars/expansion.

so I basically want vertical lines on the chart when the wave2high is above or below zero and has dark blue bars. if there’s dark blue bars on the ttm wave2high then there should have vertical lines on the chart. please help

Attachments:
Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on August 28, 2022 2:24 pm
81 views
0
Private answer

For this solution I am going to barrow some code from a previous solution found in the Stock Scanners topic:

https://www.hahn-tech.com/ans/scan-for-identifying-stocks-with-ttm_wave-c-in-cyan-color-indicating-expansion/

In that solution the request was to scan for stocks which show TTM Wave C expansion. I reversed that signal to create the opposite condition, then added one line of code to plot the vertical lines at each bar where the TTM Wave C is blue.

def cWaveUpper = TTM_Wave().Wave2High;
def cWaveLower = TTM_Wave().Wave2Low;
def cWaveDiff = cWaveUpper - cWaveLower;
def contraction = cWaveDiff < cWaveDiff[1];
AddVerticalLine(contraction, "Contraction", Color.GRAY);

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on August 28, 2022 2:39 pm
0
works Perfect thank you so much!!
( at August 28, 2022 2:49 pm)
0
what else can be used besides vertical line? looking for something thicker like a bar??
( at August 28, 2022 2:54 pm)
0
You can view the available properties fo the AddVertcialLine() function here: https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Look---Feel/AddVerticalLine On that page you will find the width of the line can be controlled by the last parameter, which was excluded in my solution. You can modify the last line of code in my solution as follows: AddVerticalLine(contraction, "Contraction", Color.GRAY, 2); which will increase the line width to a value of 2. You can experiment with different values until you find one that fits your preferences.
( at August 28, 2022 3:00 pm)
0
thank You!!
( at August 28, 2022 3:08 pm)