NexusFi: Find Your Edge


Home Menu

 





Stuck with a simple function: Return true if time between 8pm and 1 am


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one arjfca with 2 posts (0 thanks)
    2. looks_two Quick Summary with 1 posts (0 thanks)
    3. looks_3 Jura with 1 posts (3 thanks)
    4. looks_4 Bimi with 1 posts (0 thanks)
    1. trending_up 1,666 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

Stuck with a simple function: Return true if time between 8pm and 1 am

(login for full post details)
  #1 (permalink)
 arjfca 
Montreal, Canada
 
Experience: Intermediate
Platform: Multicharts
Broker: Interactive Broker
Trading: Forex
Posts: 263 since Sep 2010
Thanks Given: 440
Thanks Received: 91

Hello

I'm stuck with a simple function to return true a function ( Asia) if time is between 8 pm and 1 am ( Asia session).

Any help appreciated

MT

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Futures Close-Out Policy
Commodities
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Looking for an MQL4 MetaTrader programmer/coder
The Elite Circle
ZombieSqueeze
Platforms and Indicators
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Daytrading ES & NQ
32 thanks
Battlestations: Show us your trading desks!
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Retail Trading As An Industry
25 thanks

(login for full post details)
  #3 (permalink)
Bimi
London
 
Posts: 118 since Mar 2010
Thanks Given: 42
Thanks Received: 58



arjfca View Post
Hello

I'm stuck with a simple function to return true a function ( Asia) if time is between 8 pm and 1 am ( Asia session).

Any help appreciated

MT

Why stuck?

Reply With Quote
(login for full post details)
  #4 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


arjfca View Post
I'm stuck with a simple function to return true a function ( Asia) if time is between 8 pm and 1 am ( Asia session).

Try rephrasing your problem: returning false when the time is after 1 am but before 8 pm. Then it's relatively easy to see the answer:
 
Code
if (Time_s > 1000) and (Time_s < 20000) then 
	false
else
	true;
Or a more complex solution (untested):

 
Code
Variables:
	eightPM(ELTimeToDateTime(2000)),
	oneAM(ELTimeToDateTime(100)),
	timeNow(0);
	
timeNow = ELTimeToDateTime_s(Time_s); 	// or CurrentTime_s with RecalcLastBarAfter if instrument is slow

if (timeNow >= eightPM) and (timeNow <= oneAM) then
	true
else
	false;
Or did I misunderstand you?

Reply With Quote
The following 3 users say Thank You to Jura for this post:
(login for full post details)
  #5 (permalink)
 arjfca 
Montreal, Canada
 
Experience: Intermediate
Platform: Multicharts
Broker: Interactive Broker
Trading: Forex
Posts: 263 since Sep 2010
Thanks Given: 440
Thanks Received: 91


Jura View Post
Try rephrasing your problem: returning false when the time is after 1 am but before 8 pm. Then it's relatively easy to see the answer:
 
Code
if (Time_s > 1000) and (Time_s < 20000) then 
	false
else
	true;
Or a more complex solution (untested):

 
Code
Variables:
	eightPM(ELTimeToDateTime(2000)),
	oneAM(ELTimeToDateTime(100)),
	timeNow(0);
	
timeNow = ELTimeToDateTime_s(Time_s); 	// or CurrentTime_s with RecalcLastBarAfter if instrument is slow

if (timeNow >= eightPM) and (timeNow <= oneAM) then
	true
else
	false;
Or did I misunderstand you?

Thanks

Solution was so simple that I'm shy

 
Code
// Return true if asia session is on

If time_S >= 200000 or time_S <= 10000 then 
Asia = True
else
Asia = False;
I was looking for a solution that include two date since the laps time was having both legs on two day. User TJ on MC forum provided me the solution. I have Thousands of codes line written and I was stuck with this one

Martin

Started this thread Reply With Quote





Last Updated on July 19, 2012


© 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