Tutorial 123 | Analyzing support and resistance using the dictionary class

Support and resistance analysis of pivots using a dictionary

_Tutorial123 Adavanced applied to a 5 minute e-mini chart

There are several programs and tutorials at markplex.com that seek to store pivot levels and keep a tally of how many times a level has fallen at or near to a new pivot (I have included links to several programs in the box below). The basic idea is that if price turning points continue to happen near a particular level, then, perhaps, there is a support and resistance zone at or near that level.

This implementation of a similar idea uses the dictionary class to try and increase the efficiency of the program and also provide some more tutorial resources in terms of how to program using the dictionary class.

Tutorial 123 applied to a 3 minute EURUSD chart

The Dictionary Class defines the structure of an object as a collection of key/value (index/value) pairs that let you save values for use by a single EasyLanguage analysis techniques (indicator, paintbar study, showme study etc) or strategy. The structure is similar to a real dictionary where the word that we are searching for is the key or index and the definition of the word is the value.

In tutorial 123 we convert the level where a pivot occurs to a string and use it as the ‘key’ and the number of times that a pivot has occurred at that pivot level as the value. This means that while the levels are added to the dictionary in no particular order, we can quickly get the number of times that a pivot has occurred at a particular level by querying the dictionary with the pivot level value.

There are two versions of the program that will be discussed:

  1. _Tutorial123 Simple has been designed to be as simple as possible to demonstrate how the dictionary is being used. The program is limited in that it runs once when first applied to the chart and then, if you wish it to recalculate, you have to refresh the chart. _Tutorial123 Simple is available for download and is available for free to Gold Pass members.
  2. _Tutorial123 Advanced is a more complex program that updates the lines when new pivots are found, can distinguish different weights by coloring the lines differently, and it used methods and vectors more extensively. This program is also available for download.

Both versions include the Markplex vector sort function: _VectorQuickSort (value $19.95) which is included in the downloads below.

How _Tutorial123 Simple works

_Tutorial 123 Simple

The program goes through the chart looking for high and low pivot using the standard Pivot function. Once a pivot is found the dictionary is queried to see if one or more pivots have occurred at this level before. If so the value is incremented by one, if not, a new key / value pair is added to the dictionary with a value of 1. The pivot is also plotted on the chart.

On the first tick of the last bar the dictionary is analyzed. Firstly the values are copied into a vector and this is sorted using the recursive Markplex vector-sort-function. We then loop through the dictionary and for levels where the value is greater than the value in the 9th element of the sorted vector we create a horizontal line and add it to the chart. This occurs once.

The program analyzes all the bars on the chart and so the user can adjust how far back he wants to look in terms of his analysis.

Programming lessons in _Tutorial123 Simple

The tutorial demonstrates how to:

  • Create a dictionary and vector
  • Add a key/value pair to the dictionary
  • Use a for loop to go through the dictionary
  • Copy the values into a values vector
  • Count the number of elements in the dictionary
  • Avoid ‘Vector is empty or invalid index’ errors
  • Sort the vector using the recursive Markplex _VectorQuickSort function by passing a vector to a function
  • How to recognize the first tick of a bar
  • Adding horizontal line drawing objects to the chart

How _Tutorial123 Advanced works

Like _Tutorial123 Simple, the advanced version of the program also goes through the chart looking for high and low pivots using the standard TradeStation Pivot function. Once a pivot is found the dictionary is queried to see if one or more pivots have previously occurred at this level. If so, the value is incremented by one, if not, a new key / value pair is added to the dictionary with a value of 1. The pivot is also plotted on the chart.

On the first tick of the last bar the dictionary is analyzed. Firstly the values are copied into a vector and this is sorted using the recursive Markplex vector-sort-function. We then loop through the dictionary and for levels where the value is greater than the value in the 9th element of the sorted vector we create a horizontal line and add it to the chart.

The program then continues to check for new pivots on real time bars and adds them to the dictionary. Every time a new pivot is found the program re-analyzes the dictionarya and a horizontal line if the value or strength of the level is greater than  the value in the 9th element of the sorted vector.

In addition the program analyzes the levels and assigns a color depending on the user inputs and the strength of the level. Fore example, if the sorted levels show strengths (i.e. the number of times they have occurred) of 35, 32, 32, 32, 30, 25, 25,25, 19, 19, 17,,10,10….these will be analyzed on the levels vector populated with 35, 32, 30, 25, 19, 17, 10. A colors dictionary is created and lines with strength 35 will be colored Color1, lines with strength 32 will be colored Color2, lines with strength 30 will be colored Color3 etc.

Programming lessons in _Tutorial123 Advanced

In addition to the programming lessons listed under _Tutorial123 Simple, the advanced program also contains the following lessons:

  • Creating and calling a simple method as a way of avoiding repeating code
  • Using two dictionaries
  • Adding all the drawing objects of a certain type to a vector
  • Deleting drawing objects from a chart
  • Changing the color of a horizontal line drawing object
If you wish to save yourself some time typing in the code for _Tutorial123 Simple, the UNPROTECTED TradeStation showme study ( _Tutorial123 Simple) containing tutorial program (i.e. the TradeStation EasyLanguage is fully functional and you can see the source code) is available for IMMEDIATE download for $24.95- by clicking the ‘add to cart’ button. The program works with TradeStation but not with Multicharts.

The code is available free to Gold Pass members (see below).

After download the programs can be opened, you will be able to see the program code and modify it if you wish.

After purchase you will be redirected to a download page, so don’t close the browser.

_Tutorial123 Advanced is also available for IMMEDIATE download for $34.95- by clicking the ‘add to cart’ button. The program works with TradeStation but not with Multicharts.

After purchase you will be redirected to a download page, so don’t close the browser.

_Tutorial123 Simple and _Tutorial123 Advanced are available together as a bundle for a reduced fee of $44.95- by clicking the ‘add to cart’ button. The programs works with TradeStation but not with Multicharts.

After purchase you will be redirected to a download page, so don’t close the browser.

 Video explanation of tutorial 123 Part 1

 Video explanation of tutorial 123 Part 2 | Introduction to the advanced program

Note that a chart with a great many line of the same color might indicate that there are no clear support and resistance levels or that the user has too much history loaded for an instrument that is is a cycle period.

Gold Pass area

Make sure that you are logged in then click the following button to download _Tutorial123 Simple at no cost.

This content is for Gold Pass members only.

THESE 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, 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.

Disclaimer The information, materials, products and services on this Web site are made available subject to the following terms and conditions. Markplex Corporation reserves the right to change these terms and conditions at its sole discretion. This Web site and any downloads, videos, tutorials, programs and information contained herein is presented solely for educational, informational, and/or entertainment use and under no circumstances should be used for actual trading. We at Markplex Corporation are not Broker/Dealers, Financial Advisers or Registered Analysts. No offer or solicitation to buy or sell securities, securities derivatives, futures products or off-exchange foreign currency (forex) transactions of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given or in any manner endorsed by Markplex Corporation. You are fully responsible for any investment or trading decisions you make. Futures and options trading has a large potential risk. You must be aware of the risks and be willing to accept them in order to invest in the futures and options markets. This Web site is neither a solicitation nor an offer to buy and/or sell futures or options. No representation is being made that any account will or is likely to achieve profits or losses similar to those discussed on this Web site. Past performance, whether actual or indicated by historical tests of strategies, is no guarantee of future performance or success. No warranties of profitability are being made or given. There is a possibility that you may sustain a loss equal to or greater than your entire investment regardless of which asset class you trade (equities, options futures or forex); therefore, you should not invest or risk money that you cannot afford to lose. CFTC RULE 4.41 - Hypothetical or simulated performance results have certain inherent limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not actually been executed, the results may have under- or over-compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown. Screen shots on this site are examples and are not meant to imply that any of the programs or tutorials available on this Web site will generate profitable trades. 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, informational, and entertainment use. 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. 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 Web site including the information, tutorials and/or programs included on it is at your own risk. You shall indemnify and hold Markplex Corporation harmless from any and all liability, loss, trading losses, costs, damage, or expense, including attorneys' fees you or third party may suffer (other than damage to your tangible property or injuries to employees occurring during the course of work) as a result of claims, demands, costs, or judgments arising out of third party and any other claims based on Markplex Corporation's performance, including, but not limited to losses resulting from the use of Markplex Corporation developed software, programs, web sites, tutorials, or the TradeStation charting and/or trading platform. Any testimonials on this Web site may not be representative of the experience of other clients and are not indicative of future results or success.
This Web site contains or may contain references and links to other companies and/or their Web sites, none of which is under the control of Markplex Corporation. Markplex Corporation makes no representations, warranties or endorsements whatsoever about any other Web sites to which you may have access through the Markplex Corporation Web site, or any products or services of those other companies, even if the products or services of those other companies or their Web sites are described or offered on the Markplex Corporation Web site or integrated with Markplex Corporation's products or services. TradeStation®, EasyLanguage® and PowerEditor® are registered trademarks of TradeStation Technologies, Inc. Other brand and product names which appear on this site are the trademarks or service marks of their respective owners, including: Microsoft® is a registered trademark in the United States Microsoft®Excel® is a registered trademark of Microsoft® Neither TradeStation Technologies nor any of its affiliates has reviewed, certified, endorsed, approved, disapproved or recommended, and neither does or will review, certify, endorse, approve, disapprove or recommend, any product or service that offers training, education or consulting regarding the use of EasyLanguage.

By continuing to use and navigate our sites, services, applications, tools or messaging, you are agreeing to our Terms and Conditions and the use of cookies, web beacons and similar technologies as described in our Privacy Policy and Privacy Policy on the use of cookies.