Tutorial 163 is designed to calculate the exponential moving average (EMA) of a longer time frame minute chart and plot it on a lower time frame chart using a price series provider (PSP). In this tutorial the EMA is also calculated by using data 2 in a simple calculation (the same as the Tradestation XAverage function)
The standard Tradestion EMA (XAverage) function using regular data starts calculating on the first bar of the chart. The next bar uses the value of the previous bar (which in turn used the values of the previous bar) and so on up to the current bar. The XAverage function uses the following code:
XAverage = XAverage + SmoothingFactor * ( Price - XAverage );
Instead of accumulating the values as was done in Tutorial 86, for every bar tutorial 163 counts back a number of bars and then does the calculation using the following (where XAv3 is a variable used to store the EMA):
XAv3 = PSP.Close[BarsBack - 1]; // Set initial value For Value1 = BarsBack - 1 downto 0 Begin XAv3 = XAv3 + ( 2 / ( Length + 1 ) * ( PSP.Close[Value1] - XAv3 ) ); End;
PSP objects and the equivalent price data streams are not tightly synchronized however the PSP does make sure that it does not expose information that is newer than the bar being calculated. This enables the above calculation.
This tutorial program is designed to plot a longer time frame EMA on a shorter time frame using minute bars. If applied to RadarScreen use the _Tutorial163-wo-data2 version of the program. When using RadarScreen make sure that you enter an appropriate number of bars in the “Load Additional Bars” setting.
Video walk-through of the tutorial code
Download the tutorial 163 indicators (_Tutorial163 and _Tutorial163-wo-data2)
If you want to save yourself some typing the tutorial 163, the program are available for immediate download for $24.95 by clicking the following button. You can pay using PayPal or credit card. The program works with TradeStation 9.5, and TradeStation 10 but is not compatible with MultiCharts.
The indicators are unprotected, in other words, you will be able to see, modify and experiment with the tutorial’s code.
THE TRADING APPS, INDICATORS, SHOW ME STUDIES, STRATEGIES AND OTHER PROGRAMS HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES.
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 TRADING STRATEGIES, TRADING APPS, 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 TRADING 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.