Skip to content

Tutorial 181 | Three Line Break on candlestick chart using a vector object

Tutorial181-1

This tutorial talks through the creation of an indicator to ‘mimic’ the behavior of a three line break chart. The functionality is very similar to tutorial 23 however, whereas tutorial 23 uses an array, this tutorial uses the Vector class.

Line break charts

Line breaks charts ignore time. New ‘up’ lines are only added when a bar closes higher than the high of the previous up line. Once up lines are being drawn price has to go below the low of a specified number of up lines in order to create a new down line. New ‘down’ lines are only added when a bar closes below than the low of the previous down line. Once down lines are being drawn price has to go above the high of a specified number of down lines in order to create a new ‘up’ line.

This tutorial program is designed to be applied to a minute (e.g. 5 minute, 15 minute, 60 minute) bar chart. Because these charts do have a linear time element multiple ‘lines’ would be drawn whereas on an actual line break chart the same move would be represented by one line.

Technical lessons covered in this tutorial include:

  • Converting an EasyLanguage program to use a Vector rather than an array
  • Drawing rectangles using the legacy EasyLanguage syntax (e.g. TL_New) and also using the Rectangle object and formatting options
  • Converting legacy date and time to a DateTime object
  • Converting color objects for use in the plot statement
  • Using methods to create and update drawing objects
  • Ensuring that there are only a maximum number of drawing objects drawn on the chart

Also see Tutorial 23 and Quick-Tip 33. Quick-tip 33 demonstrates a method to allow the use of colors from the color class in the Plot statement which is used in this tutorial.

This tutorial does not work with MultiCharts.

Link
Tutorial 181 with the equivalent 3LB chart and tutorial 23
Tutorial 181 with the equivalent 3LB chart and tutorial 23

Inputs

NumBarsBreak( 3 ), // Number of line break
string UpCol( “Green” ), // Up color for 3LB bars and the plot
string DnCol( “Red” ), // Down color for 3LB bars and the plot
bool DrawBars( True ); // Whether to draw the 3LB bars

Link
Inputs for tutorial 180
Inputs for tutorial 180

Video comparing the tutorial 181 program and tutorial 23

Hopefully you can understand this tutorial and replicate it for your own use and education. If you want to save some time typing in the code then the Tutorial 181 program is available for  IMMEDIATE download for $34.95  by clicking the following ‘add to cart’ button.  The download includes the tutorial 23 download.

Available colors

AliceBlueDarkSlateGrayLightSalmonPaleVioletRed
AntiqueWhiteDarkTurquoiseLightSeaGreenPapayaWhip
AquaDarkVioletLightSkyBluePeachPuff
AquamarineDeepPinkLightSlateGrayPeru
AzureDeepSkyBlueLightSteelBluePink
BeigeDimGrayLightYellowPlum
BisqueDodgerBlueLimePowderBlue
BlackFirebrickLimeGreenPurple
BlanchedAlmondFloralWhiteLinenRed
BlueForestGreenMagentaRosyBrown
BlueVioletFuschiaMaroonRoyalBlue
BrownGainsboroMediumAquamarineSaddleBrown
BurlywoodGhostWhiteMediumBlueSalmon
CadetBlueGoldMediumOrchidSandyBrown
ChartreuseGoldenrodMediumPurpleSeaGreen
ChocolateGrayMediumSeaGreenSeashell
CoralGreenMediumSlateBlueSienna
CornflowerBlueGreenYellowMediumSpringGreenSilver
CornsilkHoneydewMediumTurquoiseSkyBlue
CyanHotPinkMediumVioletRedSlateBlue
DarkBlueIndianRedMidnightBlueSlateGray
DarkBrownIndigoMintCreamSnow
DarkCyanIvoryMistyRoseSpringGreen
DarkGoldenrodKhakiMoccasinSteelBlue
DarkGrayLavenderNavajoWhiteTan
DarkGreenLavenderBlushNavyTeal
DarkKhakiLawnGreenOldLaceThistle
Dark MagentaLemonChiffonOliveTomato
DarkOliveGreenLightBlueOliveDrabTurquoise
DarkOrangeLightCoralOrangeViolet
DarkOrchidLightCyanOrangeRedWheat
DarkRedLightGoldenrodYellowOrchidWhite
DarkSalmonLightGrayPaleGoldenrodWhiteSmoke
DarkSeaGreenLightGreenPaleGreenYellow
DarkSlateBlueLightPinkPaleTurquoiseYellowGreen

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.