Skip to content

Quick-tip 87 | Plot the 1600 price

QT87

Quick-tip 87 answers the question: “How to draw a line at the close of the 1600 bar.”

This quick-tip actually plots the value rather than drawing it.

 
{THIS INDICATOR 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. }

// 		Version 1.0 		July 7, 2023			Initial version

{ A simple indicator }

Vars: 		double YestPrice( 0 );

Once ClearPrintLog;

If T = 1600 and BarStatus( 1 ) = 2 then 
Begin
	YestPrice = C;
	Print( D, T, " YestPrice ", YestPrice," ", Plot1 );
	
End;

// Plot
If YestPrice <> 0 then Plot1( YestPrice, "YestPrice", Green );

{ ** Copyright (c) 2023 Markplex Corporation. All rights reserved. ** 
  ** Markplex Corporation reserves the right to modify or overwrite this analysis technique 
     on its https://markplex.com Web site. ** }

The above program checks each bar, starting at the oldest bar and working forward. When the 1600 bar is found, on the last tick of that bar, the close is stored in a variable (YestPrice).

Provided YestPrice is not zero the program plots it (giving the green lines in the screen shot.)

This works fine for our purposes, EXCEPT in the case where a 1600 bar is missing (for example, a thinly traded stock).

Once way of dealing with this is to change the program so that it finds the first bar of the new day and then takes and plots the closing value of the previous day.

This is illustrated in the slightly modified version:

Vars: 		double YestPrice( 0 );

Once ClearPrintLog;

If D <> D[1] then 
Begin
	YestPrice = C[1];
	Print( D, T, " YestPrice ", YestPrice," ", Plot1 );
	
End;

// Plot
If YestPrice <> 0 then Plot1( YestPrice, "YestPrice", Green );

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.