Skip to player
Skip to main content
Skip to footer
Search
Connect
Watch fullscreen
Like
Comments
Bookmark
Share
Add to Playlist
Report
Tutorial 203 | Calculate Volume Ratio in RadarScreen
Markplex
Follow
7/31/2024
The standard Volume Ratio indicator does not work in RadarScreen because the EasyLanguage keywords: UpTicks and DownTicks return different values.
Tutorial 203 demonstrates a couple of different approaches to providing Volume Ratios in RadarScreen.
See https://markplex.com/free-tutorials/tutorial-203-calculate-volume-ratio-in-radarscreen/
#tradestation #easylanguage #markplex
Category
📚
Learning
Transcript
Display full video transcript
00:00
Hello and welcome to tutorial 203 and a Gold Pass member asked me the question how would you go about
00:09
showing the volume ratio on RadarScreen. So first of all let's just have a quick look at
00:16
the volume ratio indicator the standard trade station volume ratio indicator and you can see
00:22
it here and you and the guts of the calculation occur here. Now the problem with this is that
00:29
upticks and downticks work for charts but not for RadarScreen in fact we just right click on that
00:37
you'll see that we can go to the all the relevant volume words for trade station and you'll see
00:45
for RadarScreen that for example for stock symbols the upticks give you total volume
00:53
and the downticks return zero whereas for example on a chart you'll see upticks returns
01:02
the shares traded on upticks and downticks the shares traded on downticks. So he wondered the
01:10
Gold Pass member how you would go about showing volume ratio on in RadarScreen. So I've got a
01:17
couple of ideas of things that you can do here you can see we've got a RadarScreen here I've
01:25
created an indicator not dissimilar from the standard indicator and you can see that clearly
01:31
those ratios don't work we're just getting hundred hundred hundred but what I've also done
01:37
is created a program that is applied to a chart and then the chart sends the value to
01:44
RadarScreen. Now obviously this is that has the disadvantage that you need to have a chart open
01:50
the same time as the values for RadarScreen if you've got several hundred values in RadarScreen
01:56
this is probably a little bit onerous but you'll just see if we look at for example the e-mini and
02:04
the sender is applied to this chart and then those values are being returned or sent over here so
02:13
that we've got the values on RadarScreen. So let me first of all just run through how the programs
02:21
do that so we've got as I say two programs we've got the sender and we've got the receiver so let's
02:26
have a look at the sender and essentially what we're doing is creating a global dictionary
02:33
and a vector and we create the global dictionary using this syntax because we want the global
02:40
dictionary to be shared between the chart and RadarScreen we're setting up a vector and then
02:46
we're saying if this is a minute chart minute or tick in fact but this program is designed for
02:52
minute charts then we can calculate the values using the standard formula which is total ticks
02:58
up ticks plus down ticks bear in mind this is being applied to a chart not to RadarScreen and then
03:05
having calculated the values we store them in the vector so if the vector is empty we can store them
03:11
using pushback once the vector has got values in it we're going to put them in the position zero
03:16
and one having done that we then store the vector in the global dictionary and we do that with the
03:24
key being set to get symbol name so the key for this value is going to be the symbol name and
03:31
we're going to put it store in that as the value the ratio vector now bear in mind there's nothing
03:36
here to make sure that the receiving and the sending charts have the same interval so that's
03:43
something that you could potentially add to the program to make it more useful and then we plot
03:48
the values so that's the sending indicator what we've also got is a receiving indicator and what
03:55
that does again being just down into the one statement we create or initialize the global
04:01
dictionary then we have a couple of item changed events first one being item added and another one
04:09
being item changed and then we create a new vector which we've called received ratio vector
04:17
so what happens if either of these events are fired in other words item added or item changed
04:23
then we are we call this update plot method in both cases and in the update plot method what we
04:30
do is we say we're looking this for each row applied to radar screen we say if args key is
04:38
get symbol name in other words there is some something in the dictionary that has just fired
04:44
the events just occurred for the symbol that we're actually plotting in our radar screen then we say
04:51
if it contains the symbol name is not false then we're going to say received ratio vector equals
04:58
the global dictionary items the name of the symbol as type vector so we we're now getting
05:05
the vector that we've just sent from the sending chart into receiving chart and then we're plotting
05:11
the two values in the vector and i've just added some extra checks just to make sure there is
05:16
actually values in those there are enough values to be able to plot so that essentially is the
05:23
program that makes sense to you so that's one way of doing this as i say the big disadvantage is you
05:30
have to have a sending chart which is a little bit of a fiddle now the other way is the using
05:37
price series provider now if you look at these values carefully you'll notice that they're not
05:43
totally synced with each other because the the changes some in the data do not occur exactly
05:51
at the same time as the psp that's one of the the disadvantages but this program is most is mainly
05:57
designed for radar screen but if you do apply it to chart what you'll find sometimes is there's
06:04
because the chart data and the psp are not synchronized together you will see that you'll
06:09
get some little errors where for example the the psp finished a millisecond before the end of
06:17
chart or vice versa and that could cause discrepancies when comparing values calculated using
06:23
the standard train station indicator with this indicator but let's just look at it in terms of
06:29
the radar screen and i'll just run through the program a little bit more complicated than the
06:34
other program namespaces i put here your system your system dot collections and tts data dot
06:40
market data see the inputs there so let's go first of all to the one statement and this is where
06:47
we're creating the price series provider if you're not familiar with creating price series provider
06:53
the easiest easiest thing is to go into the toolbox double click on price series provider
07:00
put in the data that you think is appropriate and having done that go to the designer generator
07:07
code copy the code from there into your program but we've i've already created it you'll see
07:13
some things here we're looking at data chart type bars so it's a bar chart rather than volume chart
07:20
we're using a minute chart the uh the value of the bar interval that is going to be taken from
07:26
the radar screen rain data range type bars put in the range bars five times average length because
07:33
we need to have a sufficient quantity to be able to calculate accurate values particularly when
07:39
we're creating the exponential moving average we're including volume not including ticks yes
07:46
we're using real time and then not strictly necessary here but i just like to keep this
07:52
code that we can essentially use the time zone of the chart when this is applied to chart the name
08:00
psp load true and then we've got an update event standard psp update event so that is what we set
08:08
up in the one statement we now can look at the updated event so when the event is updated if it
08:17
is a chart then we're going to do something slightly different from if it is radar screen
08:23
and the reason that i've done this is simply to try and remove one of the problems that can be
08:29
caused by the synchronization unfortunately this creates another problem but the way i did it is
08:35
just to check that the the volume was greater than the volume previous time the program worked
08:41
otherwise it implies that the either the bar has ended normally or it's the psp has ended just a
08:50
little bit before the end of the bar and so this this will smooth out some problems or at least
08:56
it's my attempt to do so but if it is radar screen in other words application type equals two then we
09:04
set these two variables here psp vol up and psp vol down to be psp.volume up zero square brackets
09:15
psp.volume down and if you look in the inputs you'll see that i have made these both intrabar
09:21
variables put in a little bit of debugging type print statements which are not necessary for for
09:27
the running of the program and then what i do having done that check above i just set the psp
09:33
vol up last update equals psp.volume up as type double and similarly for the psp vol down last
09:43
update equals psp.volume down so that is where the updates occur now we need to calculate the values
09:51
now for a chart what we could do is just use the up ticks and down ticks like we did before and
09:57
we're doing that here just by way of example and we're plotting those values in plot one plot two
10:03
you'll see though if we go back to radar screen that we don't get anything plotted there again
10:08
that's because of the problem i've just described but what we're going to do now is calculate the
10:14
values using the psp so as you will have just seen up here in the psp updated event we're setting
10:26
the psp vol up and psp vol down to be equal to the psp volume up values so in our calculation
10:36
we again do the standard calculation but just using these values rather than using the up ticks
10:42
or down ticks we're doing that if this is a chart if it is radar screen we're just going to use psp
10:49
volume up and psp volume volume down as you might expect in a more simple simplified program
10:56
then to find out the exponential moving average we can use x average what i've also done though
11:03
is just a another way of doing this is to just go backwards each time and recalculate
11:11
recalculate the moving average so the the x average that's sort of going backwards it's
11:17
using previous values this way of doing it is actually going back and redoing the calculation
11:24
again i don't think this is necessarily any advantage or one of the other but i just wanted
11:29
to to include that code because it might be useful for you and then we plot the bars and what i've
11:34
done is make the color slightly different if they're historic bars using the get app info
11:40
a real-time calc i'm doing them as white otherwise i'm doing them as yellow and we're
11:46
also plotting plot six and that is the exponential moving average calculated using the other way that
11:53
i just spoke about and then again we've got some print statement debugging information which we
12:00
could just comment out if we if we don't want to and this here bar is that last tick was just
12:09
something i was using when i was debugging so hopefully you might find this useful you could
12:15
probably if you wanted to type this program in again which is probably quite a good learning
12:21
experience if however you'd rather download the programs i will make them available and
12:28
if you like this sort of stuff please subscribe to the markplex youtube channel and also the email
12:35
list and visit markplex m-a-r-k-p-l-e-x dot com so thank you very much
Recommended
6:04
|
Up next
Program 90 | Finding extreme oscillator 'hooks'
Markplex
5/26/2025
7:57
Tutorial216
Markplex
5/1/2025
9:17
Tutorial217
Markplex
5/1/2025
8:33
Tutorial 215 | Alert when MACD crosses a line drawn on chart
Markplex
4/3/2025
9:21
Tutorial 214 | Draw a rectangle between the high and low of the week
Markplex
3/29/2025
9:43
Tutorial 212 | Draw a rectangle on a chart each day between the high and low of the PREVIOUS day
Markplex
2/12/2025
10:15
Tutorial 213 | Drawing horizontal lines from the wick of the latest pivots
Markplex
2/12/2025
5:37
Program 89 | MACD using a Price Series Provider
Markplex
1/18/2025
9:23
Tutorial 211 | Create a rectangle between 2 times and the highest/lowest price between those times
Markplex
12/30/2024
9:08
Tutorial 210 | Make a horizontal line 'snap' to pivots
Markplex
12/17/2024
6:48
Program 87 | Recurring volume profile (with end-of-bar real time update)
Markplex
12/6/2024
5:42
Program 88 | Markplex Relative Volume
Markplex
12/6/2024
5:42
Program 48 | Trade planner and fib tool UPDATE
Markplex
12/6/2024
8:53
Tutorial 209 | Control bar transparency using slider object
Markplex
10/29/2024
12:26
Tutorial 208 | Why use Methods?
Markplex
9/3/2024
8:00
Quick-tip 99 | Moving trendlines using the SHIFT/PgUp PgDn keys
Markplex
8/10/2024
4:41
Tutorial 204 | looking for conditions to occur within specified numbers of bars for each other
Markplex
7/31/2024
3:58
Tutorial 205 Part 2 | Converting tutorial 173 to a function
Markplex
7/31/2024
4:46
Tutorial 205 | How to convert tutorial 23 (line break) and tutorial 173 (supertrend) into functions
Markplex
7/31/2024
12:56
Tutorial 206 | Using the OpenFileDialog class to access a text file for use with the optimization class
Markplex
7/31/2024
10:05
Tutorial 201 | Annotated trend line drawing tool
Markplex
12/20/2023
4:39
Tutorial 202 | Calculate price to reach a user input RSI value
Markplex
12/20/2023
6:10
Tutorial 190-2 | Plotting when price crosses the upper or lower lines in a centered moving average
Markplex
11/28/2023
10:46
Tutorial 200 | Saving drawing object information in CSV files
Markplex
11/28/2023
6:02
Quick-tip 89 | Importing a text file into ELCollections
Markplex
10/31/2023