Login Page - Create Account

Support Board


Date/Time: Tue, 13 Nov 2018 19:17:18 +0000



[User Discussion] - Offering To The Community: Custom Stock Index Creator

Support Request:
[2016-03-08 12:50:29]
bjohnson777 (Brett Johnson) - Posts: 243
This is the latest addition to my tool kit. I'll add it to my consolidation DLL probably sometime next week if no problems show up in the wild.

From the "Display Study Documentation" button:

Custom Stock Index Creator. This program takes a list of stocks and creates a custom index from them. (Note: Slow loading charts may not draw the index line correctly. Go into and exit settings to force a redraw, do a Chart >> Recalculate, or CTRL-INSERT.) I originally created this program for two reasons: (1) Existing sector indexes/ETF's contained far too many stocks and tended to all look like the S&P 500 index, which isn't very useful. (2) I wanted to create my own leading indicator index based on my own criteria explained below. This program is primarily intended to use daily bars, but intraday bar functionality has also been added.

The symbol list is a symbol separated by a space followed by a weight and a separating comma and then repeats. Example: sym1 1.0, sym2 1.0, sym3 0.7, sym4 0.3. A weight of 1.0 corresponds to 100%. A weight of 0.5 corresponds to 50%. If no weight is given, it will default to 100%. A malformed symbol list will have an undefined behavior. The symbol list was chosen to be a text string for ease of use, backup, and sharing. Once the graph loads, you can go back into settings and copy out a cleaned symbol list to a text editor to save as a backup or as a different version of an index you are working on. If you create an interesting index, you are encouraged to share it by copying and pasting the symbol list to a message board. If someone else posts an interesting symbol list, copy and paste it into the symbol list box in the settings window to see the new index.

Calculation. Normalization of each symbol is done by looking a number of bars back, finding the high and low, and converting that to a 0-100 range internally. The weight value is then multiplied against the calculated value. Each symbol is added up this way and then divided by the number of active symbols creating a kind of average. That number is then added to a large buffer number to help keep the index positive. If the symbol data does not go back as far as some of the others, it is taken out of the summation and active symbol count when its data runs out. The numbers graphed on the chart are somewhat relative and not that meaningful outside the chart. What is meaningful is the pattern the index creates. Since absolute weights are not used by internal normalization, the graph points may change slightly from day to day. This is noticeable on a 1 minute chart but less so on higher time frames.

The volume function is enabled by default but set to not draw. This is because a study is confined to a single Chart Region and volume bars would squash the index line. To copy the volume bars to another Chart Region, use the 'Overlay (Single Line)' study with the following settings: Based On: Custom Stock Index Creator, Chart Region 2, Scale: Independent, Chart Number: this one, Input Data: VolumeIdx, Multiplier: 1, Display Zero Values: Yes; Subgraphs Tab: Yellow, Bar, Solid, 2.

The volume function has 4 modes: 1) 'Price*Volume (Weighted)' (recommended setting) multiplies Typical Price times Volume times Weight to get a uniform unit of movement across all source data charts and sums it with the other source data charts. This will show total amounts spent per bar. 2) 'Price*Volume Avg' takes 'Price*Volume (Weighted)' and divides it by the total number of active stocks. 3) 'Volume (Weighted)' multiplies the Volume times Weight and sums it with the other source data charts. 4) 'Volume (Straight)' just sums all the Volumes of the source data charts. In general, use 'Price*Volume' when building an index of many different types of symbols. Use one of the 'Volume' options when comparing different versions of the same thing (like different expiration times for a futures commodity).

This program will open a chart window for each symbol in the list. Sierra Chart requires an open window to get the symbol data. With a long symbol list, the number of windows will quickly become difficult to manage. It is recommended that you open a new and separate chartbook for each index you create. In the empty chartbook, first open a base symbol that you wish to compare against (I prefer the SPY ETF for the S&P 500). Add this study as a custom study. Once it runs, it will open the required number of chart windows to create the index. The extra windows can be hidden or minimized (this is the default). This is recommended to reduce the CPU load for drawing graphics that won't be seen. To return to your first window, use the CW menu to find your original symbol. The new index will be on this chart and not any of the others. If a source chart window gets closed, the program will have an internal error for that symbol. To bring the window back, go back into the study settings, exit the window, and everything should be recreated. If the chart's time frame is changed, new data chart windows will be opened for each symbol in the new time frame. This can create an excessive number of windows if you're not paying attention.

General Sierra Chart Notes. For each chart, Sierra Chart will try to load as many days as in Chart Settings >> Use Number Of Days To Load. Do NOT load an excessive number of days for an intraday chart. It will create a very heavy processing load and slow down Sierra Chart. With the way the index is calculated, I could not use Sierra Chart's internal moving averages to smooth the line out. It is still easy to add one, though. Go into 'Study Settings', select this study and mark it hidden, add a moving average study after this one, change 'Based On' to 'Custom Stock Index Creator', change 'Input Data' to 'Index', and change 'Scale' to 'Independent'. The same steps can be used for my Moving Average Ribbon or Bollinger Band Ribbon. To get rid of the source graph, use the 'Display As Main Price Graph' settings option. Be sure to rename the graph tab to something meaningful. From there, studies like moving averages and Bollinger Bands (even MACD) will use the index as their data sources. SAR, trend, and Fibonacci lines can also be drawn. This offers some interesting index analysis options. Studies that depend on bars and volume will not work since the index is only a line. Note that this program cannot take into account stock splits. This usually will not be a problem since either the data source or Sierra Chart will recalculate the price numbers internally.

Methodology for creating your own index. First identify the type of index you want: full market, sector, sub-sector, peer, commodity, leading, lagging, and so on. Next choose the symbols you want. This is the hard part. If you sort of know what the graph you want should look like, choose symbols with similar graphs. Choosing symbols with vastly different graphs will just muddy the index and make it useless. Choose enough symbols so that if one spikes or dips that it will not trash the index. I normally try for 10-30 symbols depending on the index type. Note that adding too many symbols doesn't always improve the graph and will just load down Sierra Chart. Finally assign a weight value to each chosen symbol.

I typically break weights up into 5 easy to remember levels: excellent 2.0, good 1.0, average 0.7, OK 0.5, and tolerable 0.3. You don't have to exactly use my given numbers, but it makes for easy use when learning and sharing. Look at the graph for each chosen symbol and write down a weight according to how good it is. If you want to compare the symbol to an existing chart, load this program with only that symbol in the list. If the graph follows what would be your ideal index path, give it a weight of 2.0 (excellent, but rarely happens). If it is reasonably close, give it 1.0 (good, most of the better charts will be at this level). If it kind of follows what you want with some strays, give it 0.7 (average). If it kind of follows but has more strays than you like, give it 0.5 (OK). Anything else that barely follows gets 0.3 (tolerable). If it doesn't follow at all, dump it for another symbol. Generally, anything below OK shouldn't be added to the index as it will not help the graph line. If you find you have a lot more symbols than you thought you would, take the highest rated symbols and leave out the rest.

For my first application, I wanted a leading market index. This is the example that is included with the default settings. These symbols were picked in early 2016 when this study was first programmed. They may not be appropriate for the future based on the criteria listed above. The great thing about building your own index is that symbols can later be removed or swapped if one of them goes bad. The proper name for this index is: A leading market index in relation to the SPY (S&P 500) ETF for daily bars (template: INDEX_TYPE in relation to SYMBOL for TIME_FRAME). Naming proper relation and time period is important. An index may not work very well on a different time period.

I want symbols that generally follow SPY but move before it does in the new direction in a clean way. The leading market indicators most sites tout DO NOT do this and would perform poorly in an index. In my research, it turned out that luxury items and non-necessities dominated my list. This makes sense as when people do not have a lot of extra money to spend, these are the first items that get cut from the budget. When comparing charts to SPY, I gave preference to the following: (1) clear turn down before SPY in 2007. (2) Clean pivot up in March 2009. (3) Slow turn down in 2015 when the market went flat. (4) Failure to rise back up in the late 2015 partial recovery.

The following lists out the symbols I researched for my index. Anything below 0.3 is a symbol I do not like for this index. I left some in there as comparisons to the good symbols that can be looked up for what not to do. At the time, a few of those seemed like a good idea but later got pruned from the list. Do not be hesitant to chop if you need to.

General: xiv 1.0, wood 1.0, xlb 0.3, xle 0.7, xlu 0.3, erx 0.7, iyr 0.3, iyt 1.0, eem 0.2, pscm 1.0
Industrial Metals Related: aa 0.2, slx 0.2, jjc 0.2, cper 0.2
Shipping: fdx 0.5, ups 0.5, sea 0.3
Luxury or High Priced: lvmuy 0.1, tif 1.0, sig 0.5, pvh 1.0, vfc 1.0, lux 0.5, kors 1.0, har 0.7, pii 1.0, rl 0.5, hot 0.7, wynn 1.0, giii 1.0, cfi 0.3, mov 0.5
Vehicles: hog 1.0, cat 0.3, de 0.3
Apparel: burl 0.5, dds 1.0, jwn 1.0, kss 1.0, mw 0.3, smrt 0.7, tjx 0.2
Travel: htz 1.0, car 1.0, pcln 0.2, expe 0.2, cpa 1.0, mar 1.0
Food: bwld 0.3, cake 0.5, cbrl 0.5, cmg 0.5, dnkn 0.5, txrh 0.5 (Tend to recover early (like in 2009) but move too far. This is an interesting index on its own.)
Bonds: jnk 1.0, lqd 0.5

From my criteria above, I have too many symbols for a practical list. This is a good thing for diversification. This means I'll take the better ones and leave out the rest:
xiv 1.0, wood 1.0, iyt 1.0, pscm 1.0, tif 1.0, pvh 1.0, vfc 1.0, kors 1.0, pii 1.0, wynn 1.0, giii 1.0, hog 1.0, dds 1.0, jwn 1.0, kss 1.0, htz 1.0, car 1.0, cpa 1.0, mar 1.0, jnk 1.0, xle 0.7, erx 0.7, har 0.7, hot 0.7, smrt 0.7

When you build a list of leading indicators, do NOT try to use it to trade other leading indicators. Trade following or lagging indicators. In this example, SPY, SPXL, or SPXU could potentially be medium to long term traded from this index.

Another index option is to put together a list of the better movers for a sector or sub-sector to compare your stock against (a peer index). If the stock starts falling off early compared to the index (with or without market news), that would give a warning signal. Conspiracy theorists (who are usually right about this subject) will often note that (illegal) market insiders will start dumping a stock before there is news of a problem. A divergence from the peer index might show that problem before the news gets out.

Reading The Index. Periodically choose short, medium, and long term time frames to see how well the index is tracking on your main chart. A long term view will show overall movement. Medium to short term views will realign the index and main chart and possibly show movements that are harder to see if the index line has move too far in relation to the main chart.

Be sure to read "Input Descriptions" on the doc button for the specific settings options.

-----
Update: 2018-01-31. This version includes volume support.
Regular compiles moved to "Brett Johnson's Standard Tool Kit" DLL.
https://www.sierrachart.com/SupportBoard.php?ThreadID=18945
Quick compile instructions:
https://www.sierrachart.com/SupportBoard.php?PostID=114621#P114621
Date Time Of Last Edit: 2018-01-31 07:08:21
attachmentCustomStockIndexCreator.cpp - Attached On 2018-01-31 07:06:34 UTC - Size: 42.5 KB - 94 views
attachmentCustomStockIndexCreator.dll - Attached On 2018-01-31 07:06:43 UTC - Size: 826.5 KB - 61 views
[2016-04-25 09:30:52]
bjohnson777 (Brett Johnson) - Posts: 243
Update.

I ran into a bar time alignment problem while working on my Forex Currency Decorrelation program. In theory, this program could have that, too. I ported that code over and did a little clean up.

Also note: If the index line doesn't draw correctly on the initial load, it's probably waiting for other charts to finish loading. Once done, go into settings and exit to force a redraw.
[2016-07-20 08:51:45]
bjohnson777 (Brett Johnson) - Posts: 243
Update:

I got tired of 2 stocks hanging the intraday list, so I removed them from the examples.

No other functionality changes.

Since this program can take so long to load from so many charts, remember to use Chart >> Recalculate, CTRL-INSERT, or INSERT to redraw it once everything is loaded.
[2016-10-15 06:38:37]
bjohnson777 (Brett Johnson) - Posts: 243
Today's DLL was compiled with the M$VC++ change over.
You may need to update your SC version.
Keep your previous DLL version until you've tested the new compile.
Most changes were made to shut up useless M$VC++ warnings when compiling.
There are a few compile warnings left about "argument" that can be ignored.
No real functionality changes have been made.
[2016-11-12 20:20:21]
bjohnson777 (Brett Johnson) - Posts: 243
Minor update now using the "Get Highest Chart Number In Chart Book" function simplifying the "Close All Other Charts" options in the Settings window. I also added a forced recalculate to reopen the needed data windows. Previously the other windows would not reopen like they should have.

Double check your settings window to make sure the options didn't get scrambled.
[2016-12-07 05:40:18]
bjohnson777 (Brett Johnson) - Posts: 243
Update:

Added new Minimize window function from ACSIL.
[2016-12-08 13:33:55]
User345334 - Posts: 23
hi,

i was looking for a tool to make my own index for a long time , thanks for this tool , unfortunately i'm not able to use it for some reason can you please tell me what i'm doing wrong?

i go to add custom study
then use the default setting.
and don't see nothing on the chart.

thanks.
avi.

http://www.sierrachart.com/image.php?Image=1481203760419.png
[2016-12-09 06:39:59]
bjohnson777 (Brett Johnson) - Posts: 243
Few things to check for:

Are you on the most current version of Sierra Chart? The latest update makes use of a new function in there.

Did you set to YES: "Are you ready for MANY open windows?" This study opens MANY other windows for a data source. It should be run in its own chartbook so it doesn't trash an existing one.

With all the new windows open, you might need to select your first window again from the CW menu at the top.

I normally open the daily SPY ETF as the background and then run this study with the defaults. It may take a few minutes for all the data to download for each extra chart. Once it does, you may need to hit the INS key or select Chart >> Recalculate if the white line barfs.

If you come up with an interesting custom index, please share. :-)
Date Time Of Last Edit: 2016-12-09 06:41:35
[2016-12-09 07:53:04]
User345334 - Posts: 23
thank you so much after follow your instruction it's work.
i'm sorry i'm not a coder so i don't have custom index to share.

i have some ideas about your index and i will like to ask if i can hire you to do some modification?
regards.

:-)
[2016-12-09 09:10:13]
bjohnson777 (Brett Johnson) - Posts: 243
Depends on what the modifications are. My health is really bad, and I'm behind schedule on everything. If they're simple changes, I can probably do them. If they're complicated, I may not be able. What are your ideas?
[2016-12-09 11:11:40]
User345334 - Posts: 23
first i hope your health will be good again.
this job is not urgent if you got more important things i can wait.
i can offer you 100$ (i hope this is ok) for this indicator if it possible to do.

i will try to explain what i need , i hope this will be clear.

1. the work that i need is based on the cumulative delta bar -volume study and yours index creator(but maybe there is no need for the index creator i'm not sure)
the cumulative delta bar -volume study work on 1 symbol let say a stock, i want instead of one stock to put a list of stocks like in your index creator for example:
AAPL+MSFT+FB+GOOG+INTC+CSCO+V+IBM and much more(this index is very simple just adding the values together) let call it index1 .
and then i want to subtract index1 with index2 ( index2 will be another list of stock symbols)

so i will able to see cumulative delta bar -volume study of input index1 minus index2.

2. the second modification is to change cumulative delta bar -volume study calculation , right now is tacking just the volume (number of contracts) of each trade and add to cumulative vol if the trade was on the ask or subtract if this trade
was on the bid.

i want to change it so it will tack the price of the symbol and multiply by the vol (instead of just the vol number for example aapl trade in 52.05$ and last trade was on the ask 1000 shares so i want to calculate 52.05*1000 = 52050 to add to the cumulative delta) and of course sum all symbols

that all , i can imagine that you probably have question so please ask i will do my best to answer them.

regards.

avi
[2016-12-09 11:57:36]
bjohnson777 (Brett Johnson) - Posts: 243
I'm only half following your description. I've never used the Delta Bar stuff, so I don't know what it looks like.

"Cumulative Delta Bars - Volume" is calculated by ACSIL sc.CumulativeDeltaVolume(), description here:
https://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Functions.html#scCumulativeDeltaVolume

This doesn't show much on how it's done.

Can you give a general description of why you want to calculate "index1 - index2" ? That might help me understand more.

I've done a bunch of volume experiments in my main DLL. Have you had a look at it?
https://www.sierrachart.com/SupportBoard.php?ThreadID=18945

With my rotating sleep schedule, it's past my bed time. I'll have another look at the study late tonight.

Are you up all night like me? Or are you over seas (relative to Texas)?
[2016-12-09 12:17:17]
User345334 - Posts: 23
hi, your night are my morning i'm from Israel.

ACSIL sc and DLL. are like chinese for me i'm not a coder,

what i'm basically want is to sum some symbols of call option let say for AAPL and call this group of calls option index 1
and then subtract with index 2 that will be put options (this way i can see if i got more call option buyers or put buyers)

this is the main idea right now i do that EOD in excel and wanted to see this in real time if possible.

thanks.

avi.
[2016-12-10 12:29:31]
bjohnson777 (Brett Johnson) - Posts: 243
I almost got to visit Israel back in 1999, but the local CheckPoint Software office stopped the tours of the home office when it became my turn. Maybe someday I can go on my own if my health gets better.

I was overloaded by another project and ran out of time today. I've also had a couple other ideas for enhancements using volume.

Adding a second list would be a lot of work right now. The alternative is to use 2 charts: one for calls, the other for puts. Sierra Chart has an overlay study to copy the values from one chart to another. I think using "Study Subgraph Multiply" by -1.0 and "Study Subgraphs Difference" will then get you a nice graph of the call/put difference.

I've got a couple other ideas to also mess with. I'll try to interleave this project with my others this week. If the world doesn't collapse on me, it will probably be closer to the end of the week before I have anything to post. If you're following this forum thread, you'll get an email notification when you do.
[2016-12-11 01:24:00]
Neo - Posts: 194
Thanks for your contributions Brett, your work is much appreciated. Some of the offerings in your toolkit have been useful to me.

I am wondering if it is possible to adapt your custom stock index so that it calculates the % of stocks in a chartbook currently trading ABOVE/BELOW their daily VWAPs. So this could be setup over a custom universal of stocks, or on a common universe eg Nasdaq100

% of stocks currently trading above VWAP is a popular metric amongst equities prop shops.

I am currently calculating this using a spreadsheet study, where a TRUE value is given to each stock if the last trade price was greater than it's daily VWAP, and then the SUM of all TRUE values is used to calculate the %. The spreadsheet study is restricted by the number of columns, so it's only really useful for looking at real-time values, and not historical values( at least not over 100 stocks)

The premise is that looking back over historical % values you could determine if there was a correlation between your signals that outputted winning/losing trades, and your custom index relative to its % ABOVE/BELOW VWAP. So % of stocks ABOVE/ BELOW VWAP could act as an alpha factor, helping to separate noise from a true signal.

If this is something you could adapt I would be willing to pay you for it.
[2016-12-12 11:28:34]
bjohnson777 (Brett Johnson) - Posts: 243
I spent a few hours today and got the volume layout in place. It's responding, but it's not behaving quite as I would have expected. I'll have to look into it further later when I get more time.

For VWAP, ACSIL in Sierra Chart can open multiple chart windows as data sources, but it cannot load studies into the newly opened charts. If the VWAP study is manually added to each newly opened chart, ACSIL can access the data, but it has to be in an EXACT location. This makes it extremely tedious and problematic to get reliable results. As odd as this may sound, your spreadsheet way is currently easier.

Sierra Chart currently doesn't know what is in index funds like the NASDAQ 100. If it supported it, Sierra Chart would have to open 100 separate data windows. That's doable, but it would be extremely heavy. Keeping the bar data on disk for all those windows would also take up a lot of space.

Eventually Sierra Chart will support some kind of multi-stock scanning ability like some of the other platforms, but it is very low on the developer's priority list. I doubt they'll even look at it within the next year. Something like that should really be done on the server side instead of the chart side. I only skim this support forum, but there have been a couple request posts about it within the past month or so.
[2016-12-12 21:48:42]
Neo - Posts: 194
Are you sure it would be difficult to accurately reference each charts price in relation to VWAP? To me it seems that the ASCIL interface would make this relatively easy, however, I've got no real experience using ASCIL, so I can't really comment!

-On each chart setup a VWAP study, add a color bar alert study using OHLC>ID1.SG1, so values (1,0) are outputted.
-Create an ASCIL study using or Referencing Study/Indicator Data in an ACSIL Function http://www.sierrachart.com/index.php?page=doc/ACSILProgrammingConcepts.html#UsingStudyData
-create input values for each potential chart( eg 100)
-Calculate the Sum of all (1,0) to get % above VWAP


FYI I have 100s of charts loaded during the day :) For a real-time calculation, you would only require the current day to be loaded on each chart, so if this works using a spreadsheet study then ASCIL should definitely handle the load ( based on 100 charts). A server side scanning feature would be awesome, however, you can currently create a decent real-time scanner using a Spreadsheet study as the frontend( the biggest limitation is the lack of conditional formatting/ column sorting)
Date Time Of Last Edit: 2016-12-13 02:58:48
[2016-12-13 08:36:41]
bjohnson777 (Brett Johnson) - Posts: 243
I'll start by apologizing... I missed an ACSIL function that's been added since I last read the doc page. This is the first thing I would need:

sc.GetStudyNameFromChart()
http://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Functions.html#scGetStudyNameFromChart

There's another missing piece I'll explain in a moment.

The reason for needing sc.GetStudyNameFromChart() is that internally all studies are referenced by an ID number or index number. Any minor changes to the chart can change the ID number to something else (mentioning "EXACT location" in my previous post). That would mean that ACSIL would be accessing the wrong study and getting bad data. By getting the study name, it doesn't matter if the ID number changes. A test can be run against the name to first verify that it is correct. If not, the program can search the name list to see if it was moved or deleted from the chart. This provides a margin of safety.

The other missing piece is being able to automatically load a study (VWAP in this case) to a newly opened chart by ACSIL. I don't see any way of doing this in the documentation. To be honest, to have ACSIL try and figure out what a new study needs is insanely complicated to program... but I had an idea around that yesterday. The workaround is to have the human create a Study Collection and get all the studies tweaked to desired values. After that, ACSIL would (in theory) just apply the Study Collection to the newly opened chart. This works well for automation and guarantees that a chart doesn't get missed (like the 100 charts out of the NASDAQ 100). For someone to individually add a study to 100 charts would probably take between 2 and 4 hours. For ACSIL to do it automatically would probably take about 5 minutes.

I think I'm going to open a support request for this feature in a few minutes. This should be easy for the SC dev's to implement since most of the work has already been done in the deeper internals of SC. I don't know how long it will take them to implement this feature, though.

Once this gets implemented, it shouldn't be too hard to create a full length chart (even on multiple time scales) for the number of stocks above/below VWAP. There might be some interesting chart patterns from this.

The biggest thing slowing me down right now is my health issues. I have some vicious variant of Central Sleep Apnea where my brain forgets to breathe when I'm unconscious. I spend around 12 hours in bed hooked up to an artificial ventilator. If I'm lucky, I'm unconscious for most of that time, but my equivalent sleep compared to a normal person will be 3-4 hours per night. It's really tearing me up, and for the past several months it has been getting worse. For my next medical project/wetware hack, I'm going to use the OpenEEG project and create a brainwave interface to the computer. I'm hoping to use electrical signals to try and force my brain into deeper levels of sleep and stop the insomnia that's been plaguing me for the past several months. I've already done simpler forms of this and know it works, but I need something that is much stronger.

The past 2 nights have been bad, and I'm pretty much useless today. If the SC dev's can get the missing function programmed, it will probably be 2 months before I can sit down and program this (that might be how long the SC dev's take to get their part implemented, anyways). I'd like to expand the code so my new program's framework can be used more generically as a stock scanner (kinda what I mentioned above). In a study format, it will still be a bit clumsy to use, but it should be far easier than the spreadsheet.

And speaking of spreadsheets, I read somewhere in the docs that an external spreadsheet program could be used. Since I know C++, I've never bothered learning spreadsheets, but do you think an external spreadsheet could get around some of your current limitiations? It might be worth digging forther in the docs for.
[2016-12-13 12:42:49]
bjohnson777 (Brett Johnson) - Posts: 243
I got the quirk figured out and have uploaded a beta version for you to test. Give these instructions a try:

Open a new chartbook. Add the following studies with the following settings:

Custom Stock Index Creator: Short Name: Call Index, Chart Region: 2, Scale: Automatic, Symbol List: enter the call symbols, Volume (Straight). Subgraphs Tab: Index: Ignore. VolumeIdx: Green, Bar, Solid, 2.

Overlay (Single Line): Short Name: Call Index Line, Based On: Call Index, Chart Region 1, Scale: Independent, Chart Number: this one, Input Data: Index, Multiplier: 1, Display Zero Values: Yes. Subgraphs Tab: Green, Line, Solid, 2.

Custom Stock Index Creator: Short Name: Put Index, Chart Region: 1, Scale: Automatic, Symbol List: enter the put symbols, Volume (Straight). Subgraphs Tab: Index: Red, Line, Solid, 2. VolumeIdx: Ignore.

Study Subgraph Multiply: (singular version, not plural) Based On: Put Index, Short Name: Put Volume, Chart Region: 2, Scale Automatic, Input Data: Volume, Multiplier -1, Draw Zeros: Yes. Subgraphs Tab: Red, Bar, Solid, 2.

Study Subgraphs Add: (plural version, not singular) Short Name: Volume Difference, Chart Region 3, Scale: Automatic, Input Study 1: Call Index: Volume, Input Study 2: Put Volume: Result, Offset: 0, Draw Zeros: Yes, Perform Add With Zero Value: Yes. Subgraphs Tab: Purple, Bar, Solid, 2.

Sometimes a graph will disappear. Do Chart >> Recalculate or CTRL-INSERT. Full recalculate doesn't always restore the graph but partial will.

Results:
Main Price Graph should have green and red lines for call and put price index lines.
Second graph should have a stacked bar graph for green/call and red/put. Red lines should be negative and proportionally scaled to the green ones.
Third graph should have the difference between the green and red of the second graph.

To save all this: Analysis >> Studies >> Save Studies As Study Collection.
Enter a name like: Call-Put Index
Hit the "Save All" button.
Open a new chartbook for a different set of option symbols, select Analysis >> Call-Put Index, go into the Custom Stock Index Creator settings and enter new Symbol Lists for the new call/put symbol.

(Note that the beta version will be deleted once finished. The completed and stable version will always be attached to post 1 of this thread.)

edit: clarified instructions a little
Date Time Of Last Edit: 2018-01-31 07:09:25
[2016-12-13 18:40:51]
User345334 - Posts: 23
thanks for the new file i'm exciting to check it out , it will tack me some time to create the list of the options name, thanks again.
[2016-12-14 10:26:55]
User345334 - Posts: 23
hi, it's look like the platform can't handle so much symbols , if i use a few symbol it look like working but when i upload all the options symbol it's not show any data i'm attaching a file with call symbol for you to see.
attachmentcalls symbols.txt - Attached On 2016-12-14 10:26:38 UTC - Size: 3.2 KB - 81 views
[2016-12-15 06:28:55]
bjohnson777 (Brett Johnson) - Posts: 243
@CTZ16C10000,@CTZ16C10100,@CTZ16C10200,@CTZ16C10300,@CTZ16C10400 ...

You're going to have to help me understand what those symbols translate to. I know there's a date component to them, but that's about it.

There's a limit to the Symbol List of 2k (just over 2000 characters). If you look at your attachment, it's listed at 3.2k.

It looks like you have 271 symbols in the list. Double that for the matching Put List and you've got 542. Can your computer handle that many open symbols at one time?

You'll also need to change "Limit Number Of Open Charts" to something above 600. Make sure you're starting with a fresh chartbook so the Index Creator is on chart #1.

If you change time frames, another 542 windows will try to be opened.
[2016-12-15 07:23:00]
Neo - Posts: 194
No need to apologize, Brett, thanks for looking into this further and explaining in more detail.

The idea of automatically loading a study onto a newly open chart sounds great, however, it's over my head in terms of programming skills.

Sorry to hear about your health issues, I had some minor issues with sleep Apnea and ended up resolving them by losing a whole lot of weight. Has your doctor ever suggested Modafinil to combat daytime sleepiness? The Biofeedback stuff looks really interesting, good luck with it.

Re % of stocks in a chart book above VWAP- What do you think about this? It won't give historical values but will give values based on the last price.

#include "sierrachart.h"
#include <string>

#define MAX_ITERATIONS 10000

//This is a tentative solution to the problem of determining
//the proportion of charts in a chartbook trading above their
//respective VWAPs.

using namespace std;
SCDLLName("Proportion Trading Above/Below VWAP DLL")

SCSFExport scsf_ProportionTradingAboveVWAP(SCStudyGraphRef sc){
  SCInputRef ChartStudy = sc.Input[0];
  if (sc.SetDefaults){
    sc.GraphName = "Proportion Trading Above VWAP";    
    sc.AutoLoop = 1;     
    sc.FreeDLL = 1;
    sc.Subgraph[0].Name = "Proportion Trading Above VWAP";
    sc.Subgraph[0].PrimaryColor = RGB(255,0,0);
    return;
  }
  int num_of_charts;
  int num_trading_above_vwap = 0;
  for(num_of_charts = 1; num_of_charts < MAX_ITERATIONS; ++num_of_charts){
    SCGraphData BaseGraphData;
    ChartStudy.SetChartStudyValues(num_of_charts, 1);
    sc.GetChartBaseData(ChartStudy.GetChartNumber(), BaseGraphData);
    if(BaseGraphData[SC_HIGH].GetArraySize() == 0){
      //No more charts.
      break;
    }
    //Get the most recent trading price.
    int last_bar = BaseGraphData[SC_LAST].GetArraySize() - 1;
    float last_price = BaseGraphData[SC_LAST][last_bar];
    
    //Get the VWAP for the specified period of time.
    float cumulative_price_volume = 0.0;
    float cumulative_volume = 0.0;
    int num_of_trades = last_bar + 1;
    for(int j = 0; j < num_of_trades; ++j){
      cumulative_price_volume +=
        BaseGraphData[SC_HLC][j] * BaseGraphData[SC_VOLUME][j];
      cumulative_volume += BaseGraphData[SC_VOLUME][j];
    }
    float VWAP = cumulative_price_volume / cumulative_volume;
    if(last_price > VWAP){
      ++num_trading_above_vwap;
    }
  }
  --num_of_charts;
  float proportion_above_vwap =
    (float)num_trading_above_vwap / (float)num_of_charts;
  sc.Subgraph[0][sc.Index] = proportion_above_vwap;
}

[2016-12-15 07:27:49]
User345334 - Posts: 23
hi. the symbol name contain which futures contact his representing CT- cotton,Z- the expiry month, 16- the expiry year , C -call option, 10000 - the strike price 100.00

yes i allowed 600 symbol to open but still this don't show nothing it look like a big task to ask the platform or my computer to calculate.
[2016-12-15 07:47:08]
Neo - Posts: 194
Are you trying to load 500+ symbols at once? That is far too many.

You need to try breaking them up, eg add 50 each time

Also,

-What is the minimum amount of days you require for each chart? and how many days are you currently trying to load onto each chart?
-In data/ trade services, what is your intraday data storage time unit? If you are trying to load that many charts then make sure this is set to seconds, not ticks.
-In data/ trade services, what is your Max Historical intraday days to download? For testing purposes Set this to the minimum number of days you need to load on each chart.
[2016-12-15 08:44:04]
bjohnson777 (Brett Johnson) - Posts: 243
First: Can y'all hit the "Control Panel" link at the top and enter something for "Publicly Shown Name"? Being sleepless, I'm losing track of "34" and "19". Thanks.

@19: I've got a ticket open for applying Study Collections to a chart in ACSIL. Doing it by Study Collection would be easy since the user would have to create it and set all the values first (as in, not trying to figure that out in ACSIL). There is a way of applying a Study Collection to ANY new chart, but that makes a mess of the non-ACSIL charts, too. The setting is in Global Settings. This has potential for an ugly workaround, but it would be far better than doing it all by hand. The SC dev's usually get around to implementing my simpler requests. It just takes them time to get to it.

Your code sorta has the right idea, but I don't think it will compile and run. You'd really want 2 graphs: one for above VWAP, one for below VWAP. In my program, I'm also planning on returning a flag string back to the settings window for each of the symbols. I'm probably going to fork Index Creator into Stock Screener (or something similarly named). I've got some ideas to do far more than VWAP.

If you want to blindly walk through all chart numbers, you'll go from 1 to sc.GetHighestChartNumberUsedInChartBook(). I've got this in my IndexCreator code. You'll also want to look at my code for checking for chart errors... and probably implement more since this is blind access. Code like this isn't very efficient, but it's still faster than doing it by hand.

As far as health goes, I've been scrawney all my life. I have been gaining weight the past year, but I haven't gotten over 150 pounds. I've dropped the last sugar in my diet, so I should be going back down. Doctors have had me on dozens of pills, most useless. Sleepers make me more tired in the day. Stims give me worse insomnia at night. In reality, a pill cannot reverse brain damage (what CSA boils down to). Doctors are TERRIFIED of the words "brain damage" for some reason. I've been wanting a phrenic nerve pace maker, but they're even more terrified of that. In the mean time, I'm slowly rotting away into nothing. I've been doing a lot of ACSIL programming working my way towards automation just because I can't keep up anymore. There's no reason for me to do what the computer could do, anyways.

@34: 19 brings up some good points to check. Index Creator should have at least tried to open those windows, though. It will error out at the last symbol that got chopped in the Symbol List. Also double check to make sure it's enabled. Any load to a new chart will default to disable to prevent it from trashing a chartbook.

If you exit and go back into settings, you can copy and paste out the Symbol List to a text editor and see where it got chopped. Internally in Index Creator, I clean the Symbol List and copy it back into settings for this purpose. You can also have a look at "FLAG: Number Of Symbols Found", which is the internal count of what the program thinks it can use. If a symbol got chopped, this will be one less than the reported number.
[2016-12-16 10:59:27]
bjohnson777 (Brett Johnson) - Posts: 243
I updated the beta version DLL in post #19. I changed the priority settings, and I think I've fixed some of the chart redraw problems that were annoying me. There are still some issues with Overlay and Multiply, but those are outside of my control. CTRL-INSERT is working to redraw.

I also bumped up the Symbol List size to 10k. It should be able to hold far more than the charts you want to open.
[2016-12-16 13:48:40]
User345334 - Posts: 23
thanks for the update, i think i have a problem in installing the indicator , when you said

"Study Subgraphs Add: Short Name: Added Volumes, Chart Region 3, Scale: Automatic, Input Study 1: Call Index: Volume, Input Study 2: Put Volume: Result, Offset: 0, Draw Zeros: Yes, Perform Add With Zero Value: Yes. Subgraphs Tab: Purple, Bar, Solid, 2."

i didn't find how to do that , Input Study 1: Call Index: Volume, Input Study 2: Put Volume: Result, Offset: 0,
there is no input study only input data or based on.
imageUntitled.png / V - Attached On 2016-12-16 13:48:17 UTC - Size: 243.32 KB - 151 views
imageUntitled1.png / V - Attached On 2016-12-16 13:48:27 UTC - Size: 230.1 KB - 108 views
[2016-12-17 07:26:56]
bjohnson777 (Brett Johnson) - Posts: 243
"Studies Available" column on the left side, scroll down to "Study Subgraphs Add". You will also need "Overlay (Single Line)" and "Study Subgraph Multiply".

In the "Studies To Graph" column, you'll have 5 studies total when everything is set up.

edit: fixed copy and paste
Date Time Of Last Edit: 2016-12-17 09:41:45
[2016-12-17 07:49:02]
User345334 - Posts: 23
yes, please see image 1 i got all 5 studies as you said
but the instruction on "Study Subgraphs Add: Short Name: Added Volumes, Chart Region 3, Scale: Automatic, Input Study 1: Call Index: Volume, Input Study 2: Put Volume: Result, Offset: 0, Draw Zeros: Yes, Perform Add With Zero Value: Yes. Subgraphs Tab: Purple, Bar, Solid, 2."

i didn't find how to do that , Input Study 1: Call Index: Volume, Input Study 2: Put Volume: Result, Offset: 0,

are not clear so i don't know if this is right , please see image 2

and in image 3 you can see my chart with out any data.
and i'm sending the calls symbols and the puts symbols.
image1.png / V - Attached On 2016-12-17 07:47:54 UTC - Size: 228.96 KB - 112 views
image2.png / V - Attached On 2016-12-17 07:48:06 UTC - Size: 228.73 KB - 101 views
image3.png / V - Attached On 2016-12-17 07:48:19 UTC - Size: 213.67 KB - 118 views
attachmentcalls symbols.txt - Attached On 2016-12-17 07:48:28 UTC - Size: 3.2 KB - 80 views
attachmentput symbols.txt - Attached On 2016-12-17 07:48:49 UTC - Size: 3.21 KB - 72 views
[2016-12-17 09:54:32]
bjohnson777 (Brett Johnson) - Posts: 243
I clarified the instructions in post #19 a little more. Make sure you add the studies in that order. You need the plural version of the "Add" study. Give the instructions one more try. You've almost got it.

When you're done, it will look like the attached screenshot... or probably better. I don't have access to call and put futures, so this one is just a test.
imageScreenshot_CallPutIndex.png / V - Attached On 2016-12-17 09:54:24 UTC - Size: 143.89 KB - 159 views
[2016-12-17 13:01:53]
User345334 - Posts: 23
i start over and did it again please see the image is getting there but still not look like your image.
do you like me to send you image of all the studies and how i set them i probably still doing something wrong.
image1.png / V - Attached On 2016-12-17 13:00:22 UTC - Size: 239.68 KB - 148 views
[2016-12-18 04:10:56]
bjohnson777 (Brett Johnson) - Posts: 243
Go ahead and attach the images. For testing, let's simplify and only use the 10 most recent symbols from the call and put lists.
[2016-12-18 13:28:26]
User345334 - Posts: 23
i reduce dramatically the number of symbols, and please see the images i'm sending maybe you can figure out what i'm doing wrong?
i see in your image that you look on daily chart and my is intraday chart.
imagestudy1.png / V - Attached On 2016-12-18 13:27:04 UTC - Size: 224.88 KB - 137 views
imagestudy2.png / V - Attached On 2016-12-18 13:27:16 UTC - Size: 217.28 KB - 125 views
imagestudy3.png / V - Attached On 2016-12-18 13:27:25 UTC - Size: 223.92 KB - 104 views
imagestudy4.png / V - Attached On 2016-12-18 13:27:34 UTC - Size: 214.37 KB - 104 views
imagestudy5.png / V - Attached On 2016-12-18 13:27:43 UTC - Size: 216.82 KB - 133 views
[2016-12-19 09:24:37]
bjohnson777 (Brett Johnson) - Posts: 243
For "Call Index Line" / "Chart Study Number To Overlay", change that to #1. You're on chart #1 and you want to overlay another line from #1 back to itself.

For "Put Index", change scaling to Independent.

Have a look at "Call Index" and "Put Index", "FLAG Number Of Symbols Found". One says "37" and the other says "33". If I understand your setup correctly, both numbers should be identical. For every call symbol, there should be a matching put symbol.

For "Volume Difference", you'll have to double check the settings. I don't know what the numbers translate to. "Input Study 1" should be "Call Index / VolumeIdx". "Input Study 2" should be "Put Volume / Result".

Make sure all your studies listed under "Studies To Graph" are in the same order as the instructions in post #19.

I think that will get you working. Be sure to hit "Save All" for the Study Collection so you don't have to set all this up again for each major symbol.
[2016-12-21 12:09:39]
User345334 - Posts: 23
thanks, i fix it all and it look like this can take very few symbols not a lot , i will try to test it with other instrument like gold and oil and see if the situation is better.
[2017-12-12 22:53:20]
wsdkii - Posts: 1
Hi Brett, I'm interested in creating my own index(s) - is this still a viable option?

Thank you.
[2017-12-13 06:36:55]
bjohnson777 (Brett Johnson) - Posts: 243
@wsdkii: Yep. Grab the source code and/or DLL from here (first post):

https://www.sierrachart.com/SupportBoard.php?ThreadID=18945

Recompile instructions are in post #11 if you want to.

I keep all my stuff in a single DLL for consolidation and ease of management. I just did a recompile of the main DLL, so everything should work on the current SC version.

I've been hit by a number of life events this year and haven't been trading. My developer's account is currently expired. I was planning on fixing that within the next few weeks. If there is a problem with the setup from the above instructions, flag me down again and I'll get things reactivated sooner.
[2018-01-31 07:10:47]
bjohnson777 (Brett Johnson) - Posts: 243
This version deploys the volume function and cleanly compiles with SC v1689.
[2018-04-30 06:27:09]
Rudy Selman - Posts: 1
Brett you're the man!


I am also staying up all night in Texas. Cheers :)
p.s. have you thought about MMJ to help you sleep? not currently offered in TX but that's never stopped anyone.
[2018-04-30 10:25:40]
bjohnson777 (Brett Johnson) - Posts: 243
Thanks and enjoy.

I've had others mention it to me, but it won't reverse brain damage and could make things a lot worse for me. What others tend to ignore is that it will cause its own long term brain damage. Nobody would hire Tommy Chong as their accountant. I also used to work with a recovered heavy user suffering from reduced IQ. He ended his story with, "It was fun at the time, but it ain't worth it. Just don't."

I do support the various cannabanoids going through the FDA, but I've only heard of one movement that tried and failed. Let the government leave THC as illegal, isolate any other brain damaging chemicals, then fast track the rest. There are plenty of suffering people who could greatly benefit from properly purified and metered doses. Under those conditions, it would also make a great bio-stock buy in.

To post a message in this thread, you need to login with your Sierra Chart account:

Login


Login Page - Create Account