Click here to Login

                                                   Monthly/weekly summation for a custom database field


2013-10-21 13:25:22

In the monthly chart, the volume field (of a quotes database) sums the entire months volumes and plots it. How can we do something similar for the fields
from a custom database? I mean, instead of picking only the last value of the month, it sums every day's value and plots that monthly sum in the monthly chart.
Similarly, for the weekly chart also. Doing a "volume-like" summing for the entire week and plotting it on the weekly chart for a custom database field.

2013-10-21 15:08:08


Best Answer
Use this function: Sum of a Custom Database's Field

Sum of a Custom Database's Field (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

2013-10-21 16:00:04


You made my day! No wonder QS has evolved so brilliantly...

2013-10-21 16:17:40


Another possible enhancement on this can be to give the parameter control to choose what calculation to be applied. While in this case, it is made for sum, parameter can be added where the following modes of calculation can be chosen to be applied:
1. avg (averaging the values for the time-frame)
2. start (opening value of the time-frame)
3. max (max value during the time-frame)
4. min (min value during the time-frame)
5. last (last value during the time-frame)
The beauty of this is that we can have a weekly/monthly candlestick display of a non-price custom database field.

2013-10-22 07:42:13


Another interesting twist for this sort of a function. The thought process goes back something like this. In a monthly chart, the indicators are computed based on the month-end closing prices. I always used to think why there should be some sanctity for the last price of the month and how logical it is to let that single value represent the whole month in an indicator construction. I do agree that it is logical on the weekly time-frame as the Friday close before the week-end break has sanctity. Wouldnt it be great in order to compute a monthly indicator, instead of taking only the last price of the month, if we can take an entire month's average price? I mean the entire months average (taking all the daily closing prices for the month).
This would then mean making this function more global. Currently, it is for getdata which is for calling fields from a custom database. In order to accomplish the above, it would mean making it available for getseries also which calls the quotes database with the calculation method as "average" apart from "sum". Another use of a "getseriessum" kind of function is that some of the composites which are based on the sum-calculation can be plotted on the weekly and monthly charts without the need to re-create seperate composites for these time-frames. I mean, once the composite on the daily time-frame is created (which is based on the sum-calculation method), same can then be used for higher time-frame too.
Just shared some thoughts in case you find it worth looking at.
With gratitude.

2013-11-07 15:21:40


Please check this function: Advanced Quotes and Custom Databases Function

Advanced Quotes and Custom Databases Function (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

2013-11-08 23:24:15


Really great stuff. When we create a monthly indicator based the daily close average for the entire month, it does make differences for certain indicators like RSI. While an MACD, etc may not show much difference. But the function gives food for thought for further insights.

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Lagged Data From a Custom Database
Sum of a Custom Database's Field
Splits Calendar - Historical data for U.S. Stocks
Earnings database
CAPS Stock Rating - Active Picks for US Stocks

How-to Lessons
How to quickly select stocks based on the last value of a databas...
How to get fundamental data for U.S. Stocks
How to download earnings calendar data for various stocks
How to create a custom trendline
How to add custom position-based metrics to your trading system

Related Forum Threads
Compress bar for custom database
custom field value is function beta sma
Composite tickers under custom database
Updates to a custom database
Export Custom Database data - all symbols - including text fields

Blog Posts
Speed Up Optimizations by Saving Ranking Data into a Custom Datab...
Create custom metrics for the statistical data analysis tool
How to Create Custom Metrics for Your Trading Positions
How to create custom databases in your trading software
Creating and managing notes for your stocks

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2022
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.