Optuma Forums › Optuma General Discussion › Sector wise breadth Data in a watch list
Tagged: script, Watchlist, breadth, Custom, Above, Moving Average, Greater Than
- This topic has 11 replies, 4 voices, and was last updated 1 year ago by Matthew.
June 11, 2021 at 3:27 pm #64905
I have breadth module and i have created several sector based breadth data. Is it possible to use the data in watch list. Because if i put breadth data of one sector whole column gives the same value so i need to add other column for other index, Is there a way around to it.
DeepakJune 11, 2021 at 6:39 pm #64909Darren
- Topics: 74
- Replies: 967
- Posts: 1,041
You can add the symbols you created in the breadth module to the watchlist so the value appears as a row and not a column.September 1, 2021 at 1:11 pm #65815
I’d like to build on this thread. I have a breadth data tool that looks at the percent of stocks in the XLE that are above their 200 day simple moving average. On this tool I have added a 65 day simple moving average. Please see the attached workbook with the tool.
In a watchlist I would like to script two questions:
1) Is the current close of the tool above the moving average?
2) Is the moving average up?
I don’t know how to reference the breadth data/tool, or if it is even possible, when scripting for the watchlist. Thank you for your help on this.September 2, 2021 at 7:53 am #65837
You can reference the Breadth code using the Getdata() function.
The Moving Average is then wrapped around the GetData item (so it’s calculated from that data rather than the charts). Once that’s done you can add your specific criteria.
Here’s a simple example but you will need to update it to use your custom breadth code data:12345678//Set Breadth CodeV1 = GETDATA(CODE=BREADTHCODE~1:Market Breadth) ;//Find MA Values applied to Breadth CodeV2 = MA(V1, BARS=65, STYLE=Simple) ;//Is Breadth Code higher than 65SMAV1 > V2September 2, 2021 at 12:53 pm #65847
Hi Matthew. Thank you for your response. I always say it, and again please know I really appreciate how responsive and helpful you, and Darren, are. I was able to create both of my scripts with your instructions.
I have one more question regarding this workbook. The workbook now has a watchlist of 11 symbols with all 6 scripts of my model. Underneath the watchlist I have a chart. The chart has:
1) Daily candlesticks with an SMA.
2) A 12/26/9 MACD-C tool.
3) A breadth data tool with a custom script and an SMA.
When I click through the symbols on the watchlist the chart changes. Numbers 1) and 2) update as I click through the symbols, but 3) does not. Is there a way to program Optuma so this workbook is fully automated, meaning the script in the breadth tool changes as I go through the symbols? Please see the workbook attached. Thank you.September 2, 2021 at 1:12 pm #65853
Item 3 is a static item that won’t change when the primary chart code is adjusted (ie there’s no call back to the charts code). It’s a breadth code and a MA based off of that breadth code, so the values are unaffected by the primary charts data.
What change were you expecting to see when the code is adjusted?September 2, 2021 at 1:45 pm #65855
The watchlist is the 11 S&P 500 sectors. The breadth script is to find the percentage of stocks above their 200 day SMAs. I was hoping to click through the watchlist and have the breadth data update to match the chart as I click through the sectors.September 2, 2021 at 2:40 pm #65857
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…1234567891011121314151617//Set Source Check CodesT1 = ISTICKER(CODE=SP500-10:SPI) ;T2 = ISTICKER(CODE=SP500-15:SPI) ;T3 = ISTICKER(CODE=SP500-20:SPI) ;//Set Paired Breadth CodesB1 = 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 chartP1 = B1 + B2 + B3 ;//Set MA for Selected Breadth CodeM1 = MA(P1, BARS=65, STYLE=Simple) ;//Show selected Breadth Code and MA Lineplot1 = 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.September 2, 2021 at 9:09 pm #65863
Can i apply is ticker to manual lists.
deepakSeptember 2, 2021 at 9:37 pm #65865
I mean to say can we call values of B1 B2 & B3 in manual list in same column.
DeepakSeptember 2, 2021 at 10:13 pm #65867
This is what I wanted ThnksSeptember 3, 2021 at 8:21 am #65870
Yes, the ISTICKER() should work for that Watchlist as well.
- You must be logged in to reply to this topic.