NexusFi: Find Your Edge


Home Menu

 





i could use some help with date print options and formats.


Discussion in TradeStation

Updated
    1. trending_up 1,168 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread

i could use some help with date print options and formats.

  #1 (permalink)
maggtrading
quintana roo, méxico
 
Posts: 84 since Mar 2013
Thanks Given: 222
Thanks Received: 40

regards to everyone,



i am still working to get ts to write lines of text to files instead of generating the typical alerts every time my charts determine that a significant event has taken place.


this code below will correctly return the date of the next friday (that's the typical expiration day for options), but it uses the ts date format that is useless when i need a yyyymmdd date. ¿does anyone know how could i modify this code so that dates could be returned in the desired format? adding 19000000 to the date could help but i think these variables are being treated as strings and i'm not sure where could this step be added if that was even possible.


and also, this code prints the data to some obscure output window, if i wanted to print several dates similar to this but to have them inserted as text in a chart window for a symbol, ¿is there any command that i could use? for one month i evaluated a ts add-on called optionsx that displayed a lot of information like if the add-on was enabled or not and whether any instruments for that same symbol were owned by the user's account, all of this to the chart window where it had been applied. that is the kind of print i have in mind. ¿does anyone know if that could be possible using easylanguage?


 
Code
using elsystem; 



inputs: 
dowed(5), 
edwa(0);


// returns a string in the format yymmdd from a datetime object	 
method string getnextexpdat(datetime dt)  
variables: 
	int dow, 
	datetime nextexpdat; 
begin 
 
	nextexpdat = dt; 
	 
	dow = dayofweek( nextexpdat.eldate ); 
	
	
	if dow = 5 then
	nextexpdat.adddays( 7 * edwa )
	else  
	nextexpdat.adddays( 5 - dow );
	
		 
	return nextexpdat.format( "%y%m%d" ); 
	 
end; 
 
print( getnextexpdat(bardatetime) );


on a related matter, one notable expert who has been assisting me in creating an automated options trading system has some visual basic tools that could process text and convert it to the appropriate orders but a very specific format is necessary, something like this:


STAGEORDERS NO

CONTRACT /Symbol:TWTR /SecType:OPT /Exchange:CBOE /STRIKE:35 /RIGHT:C /EXPIRY:20190517

BRACKET BUY 1

ENTRY BID /OFFSET:-1T

ENDBRACKET

ENDORDERS


i would need to use this same format in multiple different cases so i don't think that the recordevent(" uptrend has started "); command would be very useful in this case. i would have to include multiple variables, spaces, line breaks and troublesome characters like / inside every instance recordevent. ¿maybe it could be possible to define a number of different string variables for example - case1a - that would include all the text and variables i pasted above and when an event occurred i would use a simple command like recordevent( case1a ); ¿is that possible, would that be of any help?


very well, thanks, regards.

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
Are there any eval firms that allow you to sink to your …
Traders Hideout
Deepmoney LLM
Elite Quantitative GenAI/LLM
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
The Program
18 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

maggtrading,

take a look at the various format codes for the datetime class. The built-in help file covers that and gives good examples. If you the format you desire is not possible you can always modify your method and change the string that is returned (for example by getting the EasyLanguage date for nextexpdat and converting this to YYYYMMDD format and return this as a string).

Regards,

ABCTG

Follow me on Twitter Reply With Quote




Last Updated on May 21, 2019


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts