This is a re-write of the old Solar Winds indicator for MQ5. There has recently been some 'excitement' about using this with other indicators for entry signals, and after a request to develop an indicator using it, I found that it was a classic re-painter - so I am contributing this code with an easy switch to allow seeing the indicator in re-paint versus non-repaint mode.
This utility is not a trading information utility. It will only have value for those getting information on the Number of Bars that have terminal data. This utility uses the functions SeriesIntegerInfo and CopyRates to obtain and display information about the availability of bar information from the terminal.
This utility is not a trading or market information utility. This will likely only interest those writing (or debugging) indicators using multiple timeframes and collecting information using Bars (or iBars) and CopyRates.
The utility creates a list showing the number of Bars reported by the "Bars" function and shows the success of CopyRates for any selected bar by displaying that bar's time from the collected data (or, it shows the error).
The utility will display the high, low, open, close and time statistics for any user selected bar of any timeframe for the symbol of the chart the utility resides on.
User may enter up to 50 symbols from their market watch in either a long or short basket for viewing. The symbols for the chart can be changed to any symbol in the display with a click on the symbol. Statistics including ATR for the chart period, points gained or lost from a weeks start and position gains or losses and lots exposure are displayed. The statistics week may be changed with simple clicks on the display, and the display may be dragged and dropped to different locations. The load on quote processing is kept low by simply posting an event that starts the processing for a display update.
This is a working singleton code example. The sole purpose of this post is to provide a working code sample of a singleton object. A singleton object is created when there 'can be only one' of the object. This is accomplished by making an object's constructor private, and ensuring assignment and copy operations are also private.
I was working on an EA and identified that an object should never have more than one copy. I don't expect the EA to ever get large enough for it to actually matter that a singleton is used, but I like the clarity in the code for the object's type.
The code follows closely the tutorial at http://www.yolinux.com/TUTORIALS/C++Singleton.html.
This is a utility for beginning indicator programmers, or others, that want to have a look at values provided by OnCalculate and a few other functions.
The indicator shows:
1) The most recent value provided with the most recent OnCalculate call.
2) The previous value from the previous OnCalculate call.
3) The first value from the first time onCalculate executed.