Skip to content

Tutorial 210 | Make a horizontal line ‘snap’ to pivots

T210-gif

Tutorial 210 demonstrates some techniques that enable a horizontal line to be moved up and down on the chart and to ‘snap’ to the nearest high pivot. 

The pivots have been calculated and displayed on the visible window by this program. To achieve this the program ascertains the start date and time and end date and time of the visible window. It looks for pivots on this part of the chart and stores them in a vector. It then sorts the vector. 

In addition the initial position of the horizontal line is set to the center price. 

The horizontal line moving event updates a variable with the current price of the line. When the user releases his mouse the chart element click event of the charting host fires. The price of the line is then compared with the values in the vector of pivots to ascertain which is the closest. The price of the line is then set to this value. 

N.B As the chart develops and new pivots are added, the vector is updated, however pivots that were to the left of the chart and are now no longer visible are left in the vector. This can result in the line being adjusted to a pivot level that is no longer visible. If the window is changed the user will need to turn off and on the program so that it recalculates the pivots for the current window.

Explanation of tutorial 210

Tutorial 210 inputs
Tutorial 210 inputs

Download the tutorial 210 program

If you wish to save yourself some typing, the tutorial programs are available for immediate download by clicking the ‘add to cart’ button below. You may pay using PayPal or a credit card. The price is $29.95
The download includes the function to sort the vector.

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.