Adding minutes to an hour in easylanguage - futures io
futures io



Adding minutes to an hour in easylanguage


Discussion in TradeStation

Updated
      Top Posters
    1. looks_one bnichols with 1 posts (0 thanks)
    2. looks_two onava with 1 posts (0 thanks)
    3. looks_3 furytrader with 1 posts (1 thanks)
    4. looks_4 garyfritz with 1 posts (0 thanks)
    1. trending_up 2,684 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 3 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
 

Adding minutes to an hour in easylanguage

(login for full post details)
  #1 (permalink)
onava
London/England, Zurich/Switzerland
 
 
Posts: 20 since Apr 2012
Thanks: 2 given, 1 received

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

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(302 thanks from 30 posts)
looks_twoSalao's Journalby Salao
(81 thanks from 13 posts)
looks_3Deetees DAX Trading Journal (time based)by Deetee
(50 thanks from 21 posts)
looks_4Learning to Profit - A journey in algorithms and optionsby Syntax
(38 thanks from 16 posts)
looks_5Maybe a little bit different journalby Malykubo
(17 thanks from 18 posts)
 
Best Threads (Most Thanked)
in the last 7 days on futures io
The Crude Dude Oil Trading System
122 thanks
Big Mike in Ecuador
60 thanks
Help improve the FIO community
38 thanks
Next New Poll Ideas/Suggestions
20 thanks
futures io site changelog and issues/problem reporting
16 thanks
 
(login for full post details)
  #2 (permalink)
 bnichols 
Dartmouth NS
 
Experience: Intermediate
Platform: MC, MC.Net, NT, TWS
Broker: IB / IQFeed / Kids
Trading: Forex, stocks
 
bnichols's Avatar
 
Posts: 638 since Feb 2010
Thanks: 64 given, 460 received

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 futures io Trade Journal Reply With Quote
 
(login for full post details)
  #3 (permalink)
 furytrader 
Chicago, IL USA
 
Experience: Intermediate
Platform: MultiCharts + CTS T4
Broker: Advantage Futures, IQFeed.net
Trading: YM, ES, EU, US, S
 
furytrader's Avatar
 
Posts: 153 since Jun 2011
Thanks: 109 given, 146 received


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
The following user says Thank You to furytrader for this post:
 
(login for full post details)
  #4 (permalink)
garyfritz
Fort Collins, CO, United States
 
 
Posts: 2 since Oct 2012
Thanks: 0 given, 1 received

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

And the code is trivially simple:

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

Reply With Quote


futures io Trading Community Platforms and Indicators TradeStation > Adding minutes to an hour in easylanguage


Last Updated on March 6, 2013


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1,800 in prizes!

April

An Introduction to CME Group Micro Bitcoin Futures w/David Lerman

Elite only
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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