Premium Only Content
 
			Tutorial 210 | Make a horizontal line 'snap' to pivots
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.
See https://markplex.com/free-tutorials/tutorial-210-make-a-horizontal-line-snap-to-pivots/
- 	
				 LIVE LIVEThe Bubba Army22 hours agoIs Killing The New Trend??! - Bubba the Love Sponge® Show | 10/31/251,494 watching
- 	
				 2:25:16 2:25:16Demons Row13 hours ago $4.31 earnedEx Hells Angels MC President: Charles “Peewee”Goldsmith (Full Interview)15.6K3
- 	
				 3:35 3:35Gamazda12 hours ago $5.23 earnedThe Darkest Piano Theme?22.2K37
- 	
				 13:42 13:42Nate The Lawyer20 hours ago $4.11 earnedINSANE Judge REMOVED For Lying Under Oath, Insurance Fraud & Stolen Valor18.9K15
- 	
				 38:32 38:32Code Blue Cam1 day agoHow Police Stopped a Potential Church Massacre...50.3K12
- 	
				 24:26 24:26Actual Justice Warrior1 day agoWelfare Queens RAGE OUT Over Food Stamp Cuts21K61
- 	
				 3:05:11 3:05:11Inverted World Live12 hours agoThe Halloween Special with Drea De Matteo and Sam Tripoli | Ep. 133369K16
- 	
				 2:57:52 2:57:52Laura Loomer15 hours agoEP154: Naturalized US Navy Medic From GAZA Exposed For Ties To Hamas53K32
- 	
				 35:45 35:45Stephen Gardner17 hours ago🔴BREAKING: Election Auditor EXPOSES Democrat Election Fraud Evidence!60.4K78
- 	
				 15:48 15:48Sponsored By Jesus Podcast22 hours agoHow to Stop Being JEALOUS | When Comparison Steals Your Joy26.6K13