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 Bimi with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Jura with 1 posts (3 thanks)
    1. trending_up 2,225 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread
  #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?
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
ATFX Suspends Prop Trading Unit ATFunded -- Full Review …
Funded Trading Evaluation Firms
Election Sunday Resolves: Peru Heads to Runoff at 42pct, …
Prediction Markets & Event Contracts
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #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
  #4 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 691


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
Thanked by:
  #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


© 2026 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 - Downloads - Top
no new posts