In my watchlists I would like to add a column where I can see the values of the TTM Wave for each stock. Can someone assist with the code part? I know how to add columns to my watchlists, etc. Essentially I want to run a pre-market scan to see for example TTM Waves that are greater than +2 or less than -2 for example. I know how to build the scan but also want to add the TTM Wave values to my watchlist for easier sorting. Thanks!
Im trying to make a script that uses the ttm_wave but i cant find the source code or a replaca. I have my own ttm_wave version, but its not exatcly like the original and well, im stuck. Would appreciate any advice or help, thanks.
Here is the exact TTM_Wave code from thinkorswim. It’s a combo of all the fib macds. Took me a month to figure this out because of all the misleading and incorrect information about how the TTM_wave works.
Thanks Ben. I literally checked before writing this post and it wasn't there which was weird. Anyway I restarted my TOS and viola! it was there. Thanks.
I thought I had it figured out but still need help. The values I would like to extract are the high wave values and low wave values. In the screen show below, when I add the TTM Wave column it gives me the 0.2188 value however I would like to obtain the 8.38275 value. On the flip side, when that value is negative I would like to extract that negative value when it drops below zero. Hopefully this makes sense. Thanks!
plot value = TTM_Wave()."Wave1" is greater than TTM_Wave()."Wave1" from 1 bars ago;
AssignBackgroundColor(if value == 1 then color.yellow else color.Dark_Red);
value. Assignvaluecolor(if value == 1then color. Black else color.Current);
Found this code for adding vertical lines on a MACD cross.
Can anyone adapt this script, if it's even possible, to draw vertical lines on the upper chart, when the ttm_wave A B C histogram crosses the zero line?
Maybe have inputs to select which waves to toggle on or off. Thanks!
A-wave (Wave1)
C-wave (Wave2High)
B-wave - (Wave2Low)
Code:
def condM1CrossUndr0 = reference macd().Value < 0 and reference macd().Value > reference
macd().Avg;
Addlabel(condM1CrossUndr0, "M1”, Color.Green);
addverticalLine(condM1CrossUndr0[1]==0 and condm1CrossUndr0,"",color.green);
I cobbled this together, and believe it works. When all waves are above the zero line you'll see a vertical dark green line on your upper chart. If one one the waves is equal-to, or below I changed the line to black to make it disappear. Is there a better way to do do that?
Code:
# Draw Vertical Signal when All Histogram Waves are above the Zero Line
AddVerticalLine(close, ”” , (if TTM_Wave()."Wave1" >0 and TTM_Wave()."Wave2high" >0 and TTM_Wave()."Wave2low" >0 then Color.DARK_GREEN else Color.BLACK));
I cobbled this together, and believe it works. When all waves are above the zero line you'll see a vertical dark green line on your upper chart. If one one the waves is equal-to, or below I changed the line to black to make it disappear. Is there a better way to do do that?
Code:
# Draw Vertical Signal when All Histogram Waves are above the Zero Line
AddVerticalLine(close, ”” , (if TTM_Wave()."Wave1" >0 and TTM_Wave()."Wave2high" >0 and TTM_Wave()."Wave2low" >0 then Color.DARK_GREEN else Color.BLACK));
post1
i doubt more than one signal will cross on the same bar. Usually you pick 1 signal to look for a cross and the others to see if they are greater than something.
but here is something to try.
-------------
post2
the 1st parameter of a addverticalline is yes no, to show it or not show. You could add conditions here that would cause the line to be visible or not.
by putting close in there, something that always has a number above 0, it is interpreted as true, and always shows.
If I am pulling external data, I always set it equal to a variable. Then I can reference that variable in multiple places, And not have to read the same external data again.
I try to set up long formulas equal to a variable and then reference the variable in plot formulas.
Separating things out ahead of time makes it a lot easier for understanding the code. it also helps if it needs debugging, plotting values in a bubble, to make sure it has the right value.
Here is my conversion for ThinkorSwim. You need to choose Histograms of Waves A, B and C instead of lines in indicator properties and select colors that you would like to show trend changes.
Here is my conversion for ThinkorSwim. You need to choose Histograms of Waves A, B and C instead of lines in indicator properties and select colors that you would like to show trend changes.
In order to show Waves A only , you can use following code to replace last six lines of the code above
#plot WaveC1 = macd6;
#plot WaveC2 = hist5;
#plot WeveB1 = hist4;
#plot WaveB2 = hist3;
plot WaveA1 = hist2;
plot WaveA2 = hist1;
In order to show Waves B only, you can use following code to replace last six lines of the code above
#plot WaveC1 = macd6;
#plot WaveC2 = hist5;
plot WeveB1 = hist4;
plot WaveB2 = hist3;
#plot WaveA1 = hist2;
#plot WaveA2 = hist1;
In order to show Waves C only, you can use following code to replace last six lines of the code above
In order to show Waves A only , you can use following code to replace last six lines of the code above
#plot WaveC1 = macd6;
#plot WaveC2 = hist5;
#plot WeveB1 = hist4;
#plot WaveB2 = hist3;
plot WaveA1 = hist2;
plot WaveA2 = hist1;
In order to show Waves B only, you can use following code to replace last six lines of the code above
#plot WaveC1 = macd6;
#plot WaveC2 = hist5;
plot WeveB1 = hist4;
plot WaveB2 = hist3;
#plot WaveA1 = hist2;
#plot WaveA2 = hist1;
In order to show Waves C only, you can use following code to replace last six lines of the code above
Another option to show three waves at the same time is to load the Indicator three times, turn off the other two Waves. For example, check Wave A, and uncheck Waves B and C in order to show Wave A only.
Here is my conversion for ThinkorSwim. You need to choose Histograms of Waves A, B and C instead of lines in indicator properties and select colors that you would like to show trend changes.
Here is my conversion for ThinkorSwim. You need to choose Histograms of Waves A, B and C instead of lines in indicator properties and select colors that you would like to show trend changes.
You need to choose Histograms of Waves A, B and C instead of lines in indicator properties and select colors that you would like to show trend changes.
You need to choose Histograms of Waves A, B and C instead of lines in indicator properties and select colors that you would like to show trend changes.
Here is my conversion for ThinkorSwim. You need to choose Histograms of Waves A, B and C instead of lines in indicator properties and select colors that you would like to show trend changes.
I see you had trouble making a fully functional conversion, so i made one.
I used an input to pick a wave, A , B, or C.
you can't shift histograms vertically, so you can't show several of them stacked, on 1 chart. maybe that is why you didn't program the plots as histograms.
you can use an input, to select 1 of them to be displayed. that is how the original was programmed.
used an input and switch-case to pick 1 of the waves to show.
(an alternative could be to use addchart() to draw all the bars and shift the waves vertically, to show all 3 on 1 chart)
the original code had na and was intended to set a double.nan value, if an input was false, so a value wouldn't be plotted. there was no need to make a sub script to evaluate 0.
added inputs for all of the function lengths.
added labels to show which wave is picked.
looked at the pine study and copied the colors used in the waves.
orig colors
wave A - green / yellow
wave B - pink / blue
wave C - red / orange
https://www.tradingview.com/pine-script-reference/#var_na
na
Double.NaN value (Not a Number).
TYPE
na
EXAMPLE
n < 10 ? na : close // CORRECT close == na ? close[1] : close // INCORRECT! na(close) ? close[1] : close // CORRECT
REMARKS
Use it for return values ONLY. DON'T TRY TO COMPARE WITH IT! If you need to check if some value is NaN, use built-in function na.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
How do I get started?
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.