NexusFi: Find Your Edge


Home Menu

 





Adding minutes to an hour in easylanguage


Discussion in TradeStation

Updated
      Top Posters
    1. looks_one furytrader with 1 posts (1 thanks)
    2. looks_two garyfritz with 1 posts (0 thanks)
    3. looks_3 bnichols with 1 posts (0 thanks)
    4. looks_4 onava with 1 posts (0 thanks)
    1. trending_up 5,498 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
onava
London/England, Zurich/Switzerland
 
Posts: 20 since Apr 2012
Thanks Given: 2
Thanks Received: 1

HI All,

Im trying to join a minutes parm with an hour par, For example. i want to join 1600 with 43 minutes = 1643 and use it as a parm. does anyone know how to do this.( i dont have the calctime function by the way)

many thanks


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
I Have a Thing Called Iran -- Trump Stays in DC as Airsp …
Prediction Markets & Event Contracts
Penalties in Budapest, Peace Deadline in Tehran: Arsenal …
Prediction Markets & Event Contracts
May 26 Deadline Dies at 7.5% as US Strikes Iran During C …
Prediction Markets & Event Contracts
April CPI Preview: +3.7% YoY Expected at 8:30 AM ET -- C …
Traders Hideout
Hormuz Surges From 14% to 26.5% Intraday as Irans Answer …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
16 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #2 (permalink)
 
bnichols's Avatar
 bnichols 
Dartmouth NS
 
Experience: Intermediate
Platform: MC, MC.Net, NT, TWS
Broker: IB / IQFeed / Kids
Trading: Forex, stocks
Posts: 637 since Feb 2010
Thanks Given: 64
Thanks Received: 460

In PowerLanguage (knock off of EasyLanguage) I treat times as natural numbers (positive integers), so that if

Hours = 16

and

Minutes = 43

then

a time of 1643 becomes myTime = Hours*100 + Minutes.

Converting a time of 1643 to minutes, say,

value1 = intportion(myTime/100);
myMinutes = value1*60 +(myTime - value1*100);

Functions that use times (e.g. to place drawing objects) or convert to "ticks since some datum" don't seem to mind.


Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
 
furytrader's Avatar
 furytrader 
Lake Forest, IL USA
 
Experience: Intermediate
Platform: MultiCharts + CTS T4
Broker: Advantage Futures, IQFeed.net
Trading: YM, ES, EU, US, S
Posts: 153 since Jun 2011
Thanks Given: 109
Thanks Received: 151


A few years ago, I wrote the following EasyLanguage function called "addMinutes":

 
Code
Inputs: RefTime(numeric),RefMinutesToAdd(numeric);

Vars: vOriginalMinutes(0), vOriginalHours(0);
Vars: vTestMinutes(0);
Vars: vTempMinutes(0), vTempHours(0);
Vars: vNewMinutes(0), vNewHours(0);

vOriginalHours = IntPortion(RefTime/100);
vOriginalMinutes = Mod(RefTime,100);

vTestMinutes = vOriginalMinutes + RefMinutesToAdd;

If vTestMinutes <= 59 Then Begin 
   vNewMinutes = vTestMinutes;
   vNewHours = vOriginalHours;
End;

If vTestMinutes > 59 Then Begin 
   
   vTempMinutes = Mod(vTestMinutes,60);
   vTempHours = IntPortion(vTestMinutes/60);

   vNewMinutes = vTempMinutes;

   If vNewMinutes > 59 Then Begin 
      vNewMinutes = vNewMinutes - 60;
      vTempHours = vTempHours + 1;
   End;

   vNewHours = vOriginalHours + vTempHours;
   
   If vNewHours > 23 Then vNewHours = vNewHours - 24;

End;

AddMinutes = (vNewHours * 100) + vNewMinutes;
It takes as its inputs the original time (in standard EL military time format) and the number of minutes you want to add and returns the new time.

I think there are easier ways in EasyLanguage to do this ... but this works for me!


Reply With Quote
Thanked by:
  #4 (permalink)
garyfritz
Fort Collins, CO, United States
 
Posts: 2 since Oct 2012
Thanks Given: 0
Thanks Received: 1

TS has CalcTime(RefTime, MinuteChange) to do this.

And the code is trivially simple:

 
Code
CalcTime = MinutesToTime( TimeToMinutes( RefTime ) + MinuteChange ) ;


Reply With Quote




Last Updated on March 6, 2013


© 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