- Topics: 5
- Replies: 421
- Posts: 426
There’s no way to do that with the Breadth Data tool, but you could achieve the result with some creative scripting using a mix of ISTICKER() and IF() functions to display a specific breadth code based on the chart selected via a Show View tool.
Here’s an example using 3 different codes setup from your workbook (but using my own breadth code references as I don’t have yours). I’ve included comments for each section of the script to show what its function is…
//Set Source Check Codes
T1 = ISTICKER(CODE=SP500-10:SPI) ;
T2 = ISTICKER(CODE=SP500-15:SPI) ;
T3 = ISTICKER(CODE=SP500-20:SPI) ;
//Set Paired Breadth Codes
B1 = IF(T1,GETDATA(CODE=BREATHCODE5:Market Breadth),0) ;
B2 = IF(T2,GETDATA(CODE=BREADTHCODE~2:Market Breadth),0) ;
B3 = IF(T3,GETDATA(CODE=BREADTH4:Market Breadth),0) ;
//Set Script to display specific breadth code based on selected chart
P1 = B1 + B2 + B3 ;
//Set MA for Selected Breadth Code
M1 = MA(P1, BARS=65, STYLE=Simple) ;
//Show selected Breadth Code and MA Line
plot1 = P1;
Plot2 = M1;
In the above example, if I select the code SP500-10 to display on the chart, BreadthCode5 is displayed. If I select SP500-15 Breadth code 2 is displayed and if I select SP500-20 Breadth Code 4 is displayed.
The 65SMA will calculate off the breadth code currently in view and will update as well.
You’d just need to update the script with all of the codes you’ve added in the Watchlist, and their corresponding Breadth codes for it to work. It will become quite complex the more codes you add to it, but it will achieve the result you’re after.