Skip to content

Quick-tip 88 | Save a DateTime object into another DateTime object

QT88

Quick-tip 88 demonstrates a behavior of the TradeStation DateTime object. In particular it looks at how you could save the temporary value of a DateTime object into another DateTime object using the Value property.

{ Quick-tip 88 demonstrates a behavior of the TradeStation DateTime object. In particular it looks at how
you could save the temporary value of a DateTime object into another DateTime object using the Value property.

According to the EasyLanguage help files, Value 'gets and sets the current date and time as a string.  
Equivalent to ToString() when getting a date/time and Parse() when setting a date/time.'}

// *********************************************************************************************************
//  Namespaces where the class definitions can be found
// *********************************************************************************************************
Using elsystem;

Inputs: 	int FirstDate( 1230630 ), // The first date that a volume profile is created for
			int StartTime( 0100 );
			
Vars:		int Var1( 0 ),
			int Var2( 0 ),

			DateTime StartDT( Null ),
			DateTime HistStartDT( Null ),
			DateTime StartDT2( Null );
			
Once 
Begin
	ClearPrintLog;

	Var1 = 5000;
	Var2 = Var1;
	
	Print( " 1 ", " Var1 ", Var1, " Var2 ", Var2 );
	
	Var1 = 10000;
	
	Print( " 2 ", " Var1 ", Var1, " Var2 ", Var2 );
	
	StartDT = DateTime.FromELDateAndTime( FirstDate, StartTime );
	HistStartDT = New DateTime;
	
	Print( " 3 ", " StartDT ", StartDT.ToString( ), " HistStartDT ", HistStartDT.ToString( ) );
	
	HistStartDT = StartDT;
	
	Print( " 4 ", " StartDT ", StartDT.ToString( ), " HistStartDT ", HistStartDT.ToString( ) );
	
	StartDT.AddMinutes( 45 );

	Print( " 5 ", " StartDT ", StartDT.ToString( ), " HistStartDT ", HistStartDT.ToString( ) );
	
	HistStartDT.Value = StartDT.Value;
	StartDT.AddMinutes( 15 );
	
	Print( " 6 ", " StartDT ", StartDT.ToString( ), " HistStartDT ", HistStartDT.ToString( ) );
	
	StartDT2 = New DateTime;
	StartDT2.Value = StartDT.Value;
	StartDT.AddMinutes( 29 );
	
	Print( " 7 ", " StartDT ", StartDT.ToString( ), " StartDT2 ", StartDT2.ToString( ) );
	
End;

{ ** 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. ** }
QT88-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.