Today, I am going to show you how to create a basic real-time RSI table. The table/grid we will implement today will look like this.
A video showing the different steps can be found below.
The grid editor is a powerful tool that allows you to create excel-like tables. This is a unique feature of QS trading software.
The main advantage over Excel is obviously the fact that you can reference QS data very easily (End-of-day, Intraday and Real-time).
Besides that, there are some unique features in this tool. We can cite for example, conditional cell formatting, ability to reference data from multiple data providers, ability to combine EOD and Intraday data, ability to use QS language and C# scripts, ability to sort portion of cells, ability to add real-time charts, ability to add buttons and other controls...
Let us create a new grid now.
- In your QuantShare Trading Software, Select "Tools -> Grid -> Grid Editor"
- Create a new grid by selecting "File -> New"
- Select "5" as number of rows and "3" as number of columns then click on "OK"
- Type "Symbol" in cell A1, "Close" in cell A2 and "RSI" in cell A3.
- Select all cells in the first row, click on "Font Color" at the top then select "White" color
- Select all cells in the first row again, click on "Cell Back Color" at the top then select "Black" color
- Click on "Bold" button
- Select all cells
- Right click then select "Data Feed" and choose a real-time data provider (must be already connected - Example: Interactive Brokers)
- Each cell is now associated with that data provider
- Select the four cells under "Symbol" cell
- Right click then select "Editable Cell -> Yes"
- These cells will be editable once displayed in the output/live mode
- Type a symbol name for each cell under the "A" column
- Click on the cell under "Close" cell
- Click on "Fx" button at the top (This where we select our formula for that cell)
- Select "Intraday" category then "GetClose" as function
- Click on the button next to "Symbol Name" then select cell A2
- Click on "OK". Alternatively, we could just type "A2" in the input box next to "Symbol Name"
- Type "0" next to "time frame"
Note that "GetClose" function will always return the last price value no matter the time frame used. The time frame is useful when using the "GetClose" function that accepts three parameters (The last parameter being the "Lag" - Close price of the current bar minus Lag)
- Click on "Add"
If your data provider is working and you have specified a symbol name then the new cell will be updated automatically with the last price of that defined symbol.
- Select the same cell
- Click on its right/bottom corner then move your mouse down to the last cell. This will create a copy of that cell. Formulas will be updated automatically. This means the formula for cell "B3" will be "=GetClose(A3,0)" instead of "=GetClose(A2,0)"
- Click on "Formulas" button in the above toolbar
- Click on "Add Formula"
- Type "rsi" next to "Name" (This is the formula name)
- Select "Realtime" next to "Data Used"
- In the script editor, type:
cell = rsi(2);
- Click on "Compile" then on "Close" at the top
- Double click on the cell under "RSI" cell then type the following formula:
This is the formula we just created. By default QS formula accepts two arguments (Symbol and Period in seconds or days)
- Right click on that cell again then select "Cell Format -> Number" then "OK".
- Click on the cell's right/bottom corner then move your mouse down to the last cell
Since all cells in this table will update in real-time, let us add some conditional formatting and change the background color of each cell (for few milliseconds) each time a cell receives real-time data.
It is very easy to do that using the QuantShare's grid tool.
- Select all cells then right click and select "Conditions"
- Right click on the new control then click on "Add Condition"
- Choose "Always" under "Operator". This instructs QS to apply that condition each time the cell value changes
- Keep "Formula" empty
- Select "BackColor" under "Type"
- Select any color under "Result"
- Type "5" under "Value For". This tells QS that these changes must be applied for 0.5 second only.
- Click "Submit" and watch your beautiful table
How to Sort Rows
Manual and automatic sorting is also one of the great features of this tool.
You can sort all cells or just part of them. In this example we will sort all cells so select them, right click then select "Create a list". If the header name changes, select it and type "Symbol / Close / RSI" again.
- Click on any column header
- Select "Sort" then "Ascendant" or "Descendant"
- Click on any column header
- Select "Auto Sort" then "Ascendant" or "Descendant"
Your table is now automatically sorted in real-time. This means that in case you sort by "RSI / Descendant" then the first row will always contain the stock that has the highest RSI value.
Display Real time Grid in QuantShare Trading Software
Now that we are done creating our table, let us display it in QuantShare.
- Select "File -> Save As", enter a new name for your table then click on "Save"
- In QuantShare, select "Tools -> Grid -> Open Grid"
- Select the grid we just created then click on "Load Selected Item"
- You can dock that grid by pressing on ALT then moving it
You can update any symbol by double clicking on the cell then typing a new symbol name.
You can also add new symbols by right clicking on the grid then selecting "Add Row". This will automatically create a new row by copying all settings from the previous row.
To enable this, select "View -> Show/Update Output" in the grid editor then check "Allow adding/removing rows".
If you do not have any real time data provider yet, you can test this using the "Random Quotes" or "Yahoo Provider" feeds.
Note that when cells are sorted, any new added row will not be included in the sorted listed. That default behavior will be changed in the next release.
In a next post, we will show you how to create:
- Real-time charts within a table (Line, bar, pie…)
- C# scripts and how to create amazing things. For example, we can add another cell that counts the number of stocks that are advancing in our list. Or a button that automatically gets symbols from a watchlist and add them to our table.
Any ideas or comments, please hit the "Add a comment" button below.