Tutorial 19 – A new volume indicator based on volume between two times

Welcome  to tutorial 19 in this series of tutorials that demonstrate and explain TradeStation EasyLanguage programming concepts. The idea behind the series is that if you learn the TradeStation EasyLanguage yourself, you will have a skill that will enable you to program and try out trading ideas without the want to use a professional programmer .
As always, the function of this tutorial is to demonstrate the program techniques rather than to create a tradable indicator. This tutorial was created using TradeStation adaptation 8.3 and works in belated versions including TradeStation 9.5 and 10 and MultiCharts .
I recently read an article in Stocks, Futures and Options cartridge holder about a technical trading methodology that utilized volume to try and understand when tops or bottoms of the grocery store may occur .
frequently traders will create a plot on a chart by applying a bulk Indicator and an average volume indicator.

In the trace chart I added the Vol Avg indicator ( click Insert – Indicator and scroll down until you find Vol – Avg ). The chart will look something like this :
Volume chart from Tradestation
The chart shows volume ( the crimson and bluish green erect bars below the graph ) and an average of the volume ( the yellow line ). by the way, the symbol settings allow two options for book ( see below ). They are Trade Vol and Tick Count. The meanings of these terms vary depending on the timescale of the chart you are using. For an ‘ intraday chart, ‘ i.e. a 1, 5 or 60 minute etc chart, if the ‘ For bulk consumption ’ is set to ‘ Trad Vol ’ then the volume shown is ‘ up bulk ’ ( or volume that occurs on an uptick ). If it is set to ‘ Tick Count ’ then volume is shown as ‘ up ticks. ’ You can find a good write up of all the different volume settings depending on chart type and what they mean at //tradestion.com/wiki. You will need to log in to your account to access the information .
Volume options
This gave me the theme that while the technique I read about may be utilitarian, it is calculating book based on parts of the day that you may not be interest in. For case, say you wanted to create a scheme or index that focused on the volumes that occurred between 11:00 and 12:00 and JUST between those times of day. so, for exercise, say you were using a 10 minute chart and you wanted to find the 30 barricade average JUST between 11:00 and 12:00. Imagine it is nowadays 1:00 post meridiem then the broadcast would need to average the volume for the bars between 11:00 and 12:00 nowadays ( 6 bars on a 10 infinitesimal chart ), 11:00 and 12:00 the former day ( 6 bars ), 11:00 and 12:00 the day before that ( 6 bars ) and sol on until we were calculating the median volume of 30 bars .
caution : For the proficiency described below you need to make indisputable that the MaxBarsBack mise en scene is high enough. More about this downstairs .

Step 1 – Create a new function

We will name the function we are creating _AVtweenTimes and we will pass four inputs to the function :

  • StartTime
  • EndTime
  • Value to be passed (I have spoken about using this function to calculate volume averages, but it could also be used to find the average of price series
  • Length

A call to the serve will look like :
_AVtweenTimes( 1154, 1210, V, 20 )
Where 1154 is the start time, 1210 is the end fourth dimension, V ( or volume ) is what thursday eprogram will calculate the modal of and 20 is the distance of the average .
Tradestation provides a distribute of useful functions and other Easylanguage programs and it is frequently instructive to open the programs and see how Tradestation programmed them. A good example is the average function. If you open it you will see that it calls another function which sums the value of a particular property of a number of former bars depending on the respect of the length input. Opening the Summation function reveals how this is achieved .
The function uses a ‘ for ’ construct to count backwards the last ‘ length ’ bars ( including the current bar ) and calculates their summarize .

For Value1 = 0 to Length - 1
Begin
Sum = Sum + Price[Value1] ;
End ;

Our function will behave similarly, but with several significant differences. therefore lashkar-e-taiba ’ s get started…..
Create a new officiate named _AVtweenTimes ( suction stop File – New- Window, select the EasyLanguage tab key and chatter Function. ) Make certain the return type is Double Numeric ) .
Enter the follow code ( if you are a Gold Pass member, the example index and routine are available as a free age in the Gold Pass area downstairs ) :

Read more: Forum Policy

New volume calculation function
Press F3 to verify the code and correct any misprint .
The program works as follows :

  1. It starts looking backwards, testing whether the time of each bar falls between the StartTime and the EndTime. If it does, it adds its value to the Sum variable and increments the Counter variable. If not, it keeps looking backwards until it finds a time within the time range.
  2. If a bar is not within the time constraints, the program increments the Counter2 variable.
  3. All the variables are set to zero after the result is passed back to the indicator.

I have added some comments to the program to help in its understand .

Step 2 – Create a test indicator to access the function

Create a raw indicator ( click File – New- Window, select the EasyLanguage check and chink Indicator ) and enter the comply code :

Plot1( _AVtweenTimes( 1154, 1210, V, 20 ), "test", cyan );
Plot2( V, "-v", blue );

Step 3 – Apply to Chart

Open and modern graph and apply the indicator ( Insert – Indicator, select the indicator that you precisely created and MAKE SURE that the Prompt for Format discipline box is selected .
You will then see the following screen :
Max bars back settings
I added the blue egg-shaped to highlight the Maximum Number of Bars Study will Reference or MaxBarsBack settings. As I mentioned above, for this routine to work correctly it is imperative that the MaxBarsBack is set correctly. To calculate what the setting should be, divide the Length set that you are using by the phone number of bars between the StartTime and the EndTime. Multiply the result by the number of bars per day. MaxBarsBack controls the total of bars that need to be on the chart before an indicator or strategy starts to calculate .
once applied the chart should look like this :
Volume indicator applied to chart
The cyan line shows the indicator merely created and the gloomy line is a plot of volume. Notice how the bluish green line changes during the time menstruation that we specified and then stays horizontal .

Gold Pass download area (make sure you are logged in)

TO THE BEST OF MARKPLEX CORPORATION ’ S KNOWLEDGE, ALL OF THE INFORMATION ON THIS PAGE IS CORRECT, AND IT IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION AND/OR PROGRAM ( S ) DESCRIBED, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. use OF THIS INFORMATION AND/OR PROGRAMS DESCRIBED IS AT YOUR OWN RISK.

ANY EASYLANGUAGE OR POWERLANGUAGE trade STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS ( AND PARTS THEREOF ) AND ASSOCIATED TECHNIQUES REFERRED TO, INCLUDED IN OR ATTACHED TO THIS TUTORIAL OR PROGRAM DESCRIPTION ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY such trade STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS ( OR ANY PARTS THEREOF ) OR TECHNIQUES. THE USE OF ANY SUCH trading STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS AND TECHNIQUES DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES .
If you see any errors in this tutorial – or I have not made something clear, I would be most grateful if you could please contact Markplex. besides, let me know if you have any ideas for new tutorials .

source : https://coinselected
Category : coin 4u

Leave a Reply

Your email address will not be published.