Welcome to tutorial 51 in this series of tutorials designed to help you learn TradeStation EasyLanguage. This tutorial was created using TradeStation 8.7 but also applies to later versions (version 9.5, 10 etc)
In this tutorial I create a simple strategy that uses data from two data streams (data1 – 5 minute e-mini and data2 – 60 minute e-mini).
The image to the right shows the chart with standard TradeStation stochastic indicators applied to it.
When creating a strategy such as this, the important thing is take make sure that references to a data stream higher than data 1 are properly aliased. I show this in the video.
In addition, the demonstration program is included below. Bear in mind that I have included this in order to demonstrate the programming technique, not because I am suggesting, in any way, that it is a viable trading strategy.
Please join our email mailing list if you have not already done so and we will let you know when we release new tutorials or programs.
Tutorial 51 Video - A strategy with multiple data streams
If you see any errors in this tutorial – or we have not made something clear, we would be most grateful if you could please let us know. E-mail us at: tutorials@markplex.com. Also, let us know if you have any ideas for new tutorials.
EasyLanguage is a programming language that is part of the TradeStation trading platform. It can be used to write programs to help in the technical analysis and trading of foreign exchange (forex or FX), commodities (e.g. the Dow e-mini, S&P e-mini etc), options, and stocks.
{THIS STRATEGY 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 NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION IS AT YOUR OWN RISK. THIS INDICATOR AND ASSOCIATED TECHNIQUES IS AN EXAMPLE ONLY, AND HAS BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF THIS INDICATOR DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.} Inputs: StochLength( 14 ), // User defined inputs to control Stochastics calls StochLength1( 3 ), // User defined inputs to control Stochastics calls StochLength2( 3 ); // User defined inputs to control Stochastics calls Variables: oData1FastK( 0 ), // Values returned by the Stochastic function oData1FastD( 0 ), // Values returned by the Stochastic function oData1SlowK( 0 ), // Values returned by the Stochastic function oData1SlowD( 0 ), // Values returned by the Stochastic function oData2FastK( 0, Data2 ), // Values returned by the Stochastic function - N.B. aliasing for the Data2 data stream oData2FastD( 0, Data2 ), // Values returned by the Stochastic function - N.B. aliasing for the Data2 data stream oData2SlowK( 0, Data2 ), // Values returned by the Stochastic function - N.B. aliasing for the Data2 data stream oData2SlowD( 0, Data2 ); // Values returned by the Stochastic function - N.B. aliasing for the Data2 data stream // ********************************************************************************************** // Call the Stochastic to calculate the oData1FastK through oData1SlowD values for the first data stream (5 minutes) Value1 = Stochastic( H, L, C, StochLength, StochLength1, StochLength2, 1, oData1FastK, oData1FastD, oData1SlowK, oData1SlowD ) ; // Call the Stochastic to calculate the oData2FastK through oData2SlowD values for the second data stream (60 minutes) // Note aliasing of the price variables, High, Low, Close to Data2, and of the entire function to Data2 (at the end of the call) Value1 = Stochastic( H of Data2, L of Data2, C of Data2, StochLength, StochLength1, StochLength2, 1, oData2FastK, oData2FastD, oData2SlowK, oData2SlowD ) of Data2 ; // ********************************************************************************************** If oData1SlowK Crosses Above oData1SlowD and oData2SlowK > oData2SlowD then Buy Next Bar at Market; If oData1SlowK Crosses Below oData1SlowD and oData2SlowK < oData2SlowD then Sell Short Next Bar at Market; { ** Copyright (c) 2010-2022 Markplex Corporation. All rights reserved. ** ** Markplex Corporation reserves the right to modify or overwrite this analysis technique on its https://markplex.com Web site. ** }
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, 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.