Skip to content

Quick-tip 90 | Add a drawing object to data2

QT90

Quick-tip 90 demonstrates how to add a drawing object (in this case, a horizontal line) to Data2 (or Data1) depending on a user input: DataSet.

The program uses the HorizontalLine.Create(double, int) method that initializes a new instance of the HorizontalLine class for a given Price and Data source. 

{ THIS SHOW ME STUDY 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 SHOW ME STUDY 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 SHOW ME STUDY DOES NOT GUARANTEE THAT YOU WILL 
MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.}

// Append namespaces
// The using reserved word allows you to reference all the names in a namespace (such as classes, 
// methods, properties, and events) without the namespace.name as an explicit qualifier
using elsystem.drawing; // For Color
using elsystem.drawingobjects; // Horizontal line etc

inputs:		int DataSet( 1 );

Vars:		HorizontalLine HLClose( Null ),
			HorizontalLine HLClose2( Null );

Once( LastBarOnChart )
Begin
	// Using Create(double, int) Initializes a new instance of the HorizontalLine class for a given Price and Data source
	// Note that the data source is 0 for Data1 and 1 for Data2 etc
    HLClose = HorizontalLine.Create( C Data( DataSet ), DataSet - 1 );
    
    HLClose.Persist = true;
    HLClose.Weight = 5;
    If DataSet = 1 then HLClose.Color = Color.Orange
    else HLClose.Color = Color.HotPink;
    DrawingObjects.Add( HLClose );
    
    HLClose2 = HorizontalLine.Create( C Data1, 0 );
    HLClose2.Persist = true;
    DrawingObjects.Add( HLClose2 );
    
    
    Print( D, T, " C of DataSet ",C Data( DataSet ):4:4 );
End;

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

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.