i could use some help with date print options and formats. - futures io
futures io futures trading



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


Discussion in TradeStation

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

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

(login for full post details)
  #1 (permalink)
quintana roo, méxico
 
 
Posts: 79 since Mar 2013
Thanks: 222 given, 38 received

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
The following user says Thank You to maggtrading for this post:

Can you help answer these questions
from other members on futures io?
ZigZag with Depth and Backstep
EasyLanguage Programming
COTbase for quant trading?
Elite Algorithmic NinjaTrader Trading
Help Needed: TOS Options Chain IV & IMPL MOVE Calcul …
ThinkOrSwim
NT8 indicator to simulate a Funding Evaluation where to …
NinjaTrader
What blockvolume is visible? - order processing
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Battlestations: Show us your trading desks!
135 thanks
Want your NinjaTrader indicator created, free?
32 thanks
Big Mike in Ecuador
30 thanks
Saturday Morning Market Replay!
20 thanks
Selling Options on Futures?
19 thanks
 
(login for full post details)
  #2 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received

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


futures io Trading Community Platforms and Indicators TradeStation > i could use some help with date print options and formats.


Last Updated on May 21, 2019


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts