Adding minutes to an hour in easylanguage - TradeStation | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation

Adding minutes to an hour in easylanguage
Started:February 18th, 2013 (03:37 PM) by onava Views / Replies:1,131 / 3
Last Reply:March 6th, 2013 (05:15 PM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Adding minutes to an hour in easylanguage

Old February 18th, 2013, 03:37 PM   #1 (permalink)
Trading Apprentice
London/England, Zurich/Switzerland
Futures Experience: None
Platform: all
Favorite Futures: Tambourine
Posts: 20 since Apr 2012
Thanks: 2 given, 1 received

Adding minutes to an hour in easylanguage

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

Old February 19th, 2013, 10:54 AM   #2 (permalink)
Elite Member
Dartmouth NS
Futures Experience: Intermediate
Platform: MC, MC.Net, NT, TWS
Broker/Data: IB / IQFeed / Kids
Favorite Futures: Forex, stocks
bnichols's Avatar
Posts: 638 since Feb 2010
Thanks: 64 given, 457 received

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

Hours = 16


Minutes = 43


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.

Last edited by bnichols; February 19th, 2013 at 10:59 AM.
Reply With Quote

Old February 21st, 2013, 01:39 PM   #3 (permalink)
Elite Member
Chicago, IL USA
Futures Experience: Intermediate
Platform: MultiCharts + CTS T4
Broker/Data: Advantage Futures,
Favorite Futures: YM, ES, EU, US, S
furytrader's Avatar
Posts: 153 since Jun 2011
Thanks: 109 given, 142 received

This post has been selected as an answer to the original posters question Answer

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

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;

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;

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


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

Old March 6th, 2013, 05:15 PM   #4 (permalink)
Trading Apprentice
Fort Collins, CO, United States
Futures Experience: Advanced
Platform: Tradestation, MT4
Favorite Futures: forex
Posts: 2 since Oct 2012
Thanks: 0 given, 1 received

This post has been selected as an answer to the original posters question Answer

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

And the code is trivially simple:

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

Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation > Adding minutes to an hour in easylanguage

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
draw rectangle for first hour of market indicator ceramictilepro NinjaTrader Programming 3 August 10th, 2012 02:26 PM
4 Hour Charts Market Sniper 88 Index Futures Trading 2 June 18th, 2012 10:34 AM
Previous Hour High and Low times in easylanguage onava TradeStation 3 April 26th, 2012 01:02 PM
Hour Bars JustWondering Traders Hideout 3 December 10th, 2010 06:36 PM
Same condition every hour rajafx1 NinjaTrader Programming 5 August 13th, 2010 05:43 AM

All times are GMT -4. The time now is 02:18 AM.

Copyright © 2016 by 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

Page generated 2016-10-23 in 0.09 seconds with 27 queries on phoenix via your IP