# Tutorial 203 | Calculate Volume Ratio in RadarScreen

A Gold Pass member asked how it would be possible to display the Volume Ratio on RadarScreen. As you may know the standard indicator (Volume Ratio) is not available for RadarScreen because it uses the following code:

```TotalTicks = UpTicks + DownTicks;
If TotalTicks > 0 then VolRatio = 100 * ( UpTicks - DownTicks ) / TotalTicks
else VolRatio = 0;
VolRatioAvg = XAverage( VolRatio, AvgLength );
```

and UpTicks and DownTicks return zero in RadarScreen.

Tutorial 203 demonstrates a couple of ways that volume ratio can be displayed in RadarScreen.

The first way uses a program applied to a chart which calculates the Volume Ratio and then uses the Global Dictionary to share the data with a receiving program applied to RadarScreen.

The second way uses a Price Series Provider to calculate Volume Ratio within RadarScreen.

The tutorial 203 workspace. Note that with the sender/receiver model, obviously the sender program must be applied to a symbol chart for the data to appear on Radarscreen. This limitation does not apply to the PSP version.

The programs are explained in the video following.

_Tutorial203Sender works by creating a global dictionary (VolRatioGDict) and a vector (RatioVector). The VolRatio is calculated using the normal algorithm and the exponential average of the VolRatio is calculated using the standard XAverage function. Both values are then added to the RatioVector vector which is in turn added to the GlobalDictionary using the name of the symbol as the key. The calculated values are also plotted.

In _Tutorial203Receiver a Global Dictionary is created (VolRatioGDict) and a vector (ReceivedRatioVect). Item added and item changed events are also set up for VolRatioGDict. When either of these events is triggered a method (UpdatePlot) is called. This method checks to see if there are any elements in the global dictionary with a key of the current sysmbol. If so, the value stored for the key is stored in the ReceivedRatioVect vector. The values in the vector (i.e. VolRatio and the exponential average of volratio) are plotted.

In this video the PSP version is displayed with the orange background. The receiver version is shown with a purple background and the standard TradeStation is displayed with a blue background.

### _Tutorial203PSP

_Tutorial203PSP is designed to display the volume ratio on RadarScreen. The standard indicator cannot be used on RadarScreen because it uses UpTicks and Downticks, both of which return zero. Instead it uses a Price Series Provider with the same interval as the RadarScreen row.

The program includes two different ways to calculate the exponential moving average.

The program can also be used on charts but due to RadArscreen and chart data not being tightly synchronized there are occasional bad calculations. This is explained in the video at the tutorial page.

Make sure that ‘Load additional data for accumulative calculations’ is checked. Start with a value of 100 and add more if the calculated value does not match the value calculated on a chart for the same interval using the standard TradeStation VolRatio indicator.

_Tutorial203PSP This program assumes that a minute interval is being used.

### Explanation of tutorial 203

Make sure that you tick the ‘Load additional data for accumulative calculations’ box.