NexusFi: Find Your Edge


Home Menu

 





Code to increment every two hours.


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one onava with 3 posts (0 thanks)
    2. looks_two phantomtrader with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 SPMC with 1 posts (0 thanks)
    1. trending_up 3,305 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 6 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.

I was wondering how to i increment time to do something every 2 hours as easylanguage on has the function hour. I tried

if hour(t) > hour(t[2]) then
..

but that doesnt work. any ideas anyone ?


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
April Jobs Beat Flips Fed Hike Odds Past 52% for First T …
Traders Hideout
Post-Summit Scorecard: $36M in May 15 Bets Settle Near-Z …
Prediction Markets & Event Contracts
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
CME Group CEO Calls CFTC-Approved Crypto Perps Dangerous …
Traders Hideout
UCL Final Kicks Off at Noon ET: PSG at 56.5% as Iran May …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #3 (permalink)
 
phantomtrader's Avatar
 phantomtrader 
New York City, New York
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: NinjaTrader
Trading: ES, NQ
Frequency: Daily
Duration: Minutes
Posts: 613 since May 2011
Thanks Given: 231
Thanks Received: 1,029


I have time limitations in my strategies although not as often as 2 hours. This is what I use:

Inputs: time1(630), time2 (930);

If time >= time1 and time <= time 2 then begin

Put conditions for trade here;

end;

Depending how many 2 hour periods you want segregated, you could repeat this process assigning new times i.e. time3, time4. It's almost like writing the same strategy multiple times unfortunately. There may be an easier way and you might also ask on the TS forum for help.


Reply With Quote
  #4 (permalink)
onava
London/England, Zurich/Switzerland
 
Posts: 20 since Apr 2012
Thanks Given: 2
Thanks Received: 1

i definitely dont want to repeat for every 2 hours the code below.. I think i need some kind of loop or something like below. can anyone help on this. thanks

for counter =0 to hour(t) = 24 then begin

( do stuff)

counter = counter +2;






phantomtrader View Post
I have time limitations in my strategies although not as often as 2 hours. This is what I use:

Inputs: time1(630), time2 (930);

If time >= time1 and time <= time 2 then begin

Put conditions for trade here;

end;

Depending how many 2 hour periods you want segregated, you could repeat this process assigning new times i.e. time3, time4. It's almost like writing the same strategy multiple times unfortunately. There may be an easier way and you might also ask on the TS forum for help.


Reply With Quote
  #5 (permalink)
onava
London/England, Zurich/Switzerland
 
Posts: 20 since Apr 2012
Thanks Given: 2
Thanks Received: 1

up




onava View Post
i definitely dont want to repeat for every 2 hours the code below.. I think i need some kind of loop or something like below. can anyone help on this. thanks

for counter =0 to hour(t) = 24 then begin

( do stuff)

counter = counter +2;


Reply With Quote
  #6 (permalink)
 SPMC 
GER
 
Experience: Advanced
Platform: MC
Trading: ES
Posts: 144 since May 2011
Thanks Given: 11
Thanks Received: 213

You could use Mod, ie to plot a histogram every 2 hours on a 5 minute 24 h chart use :

If Mod(Time,200) = 0 then plot1 (1);


Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

This might work for you, too:

 
Code
Inputs:
	ResetMinutes		(120);

Variables:
	ResetCounter		(0),
	NewResetTime		(0);

if Time > NewResetTime then
begin
	NewResetTime = TimeToMinutes(Time) + ResetMinutes;
	NewResetTime = MinutesToTime(NewResetTime);
	
	ResetCounter += 1;
end;

Plot1(ResetCounter, "ResetCounter");
Hope this helps,
ABCTG


Follow me on X Reply With Quote




Last Updated on May 12, 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