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 2,428 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread

Code to increment every two hours.

(login for full post details)
  #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?
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Request for MACD with option to use different MAs for fa …
NinjaTrader
Trader Dale [email protected] or Scammer Dale
Trading Reviews and Vendors
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Tao te Trade: way of the WLD
30 thanks
Supertradersams Thread Journal on NQ/MNQ
25 thanks
Deaddogs Stock Trading
23 thanks
GFIs1 1 DAX trade per day journal
21 thanks
Daytrading ES & NQ
13 thanks

(login for full post details)
  #3 (permalink)
 
phantomtrader's Avatar
 phantomtrader 
Reno, Nevada
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Trading: ZN, ZB, CL
Posts: 588 since May 2011
Thanks Given: 216
Thanks Received: 984


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
(login for full post details)
  #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
(login for full post details)
  #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
(login for full post details)
  #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
(login for full post details)
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,426 since Apr 2013
Thanks Given: 474
Thanks Received: 1,618

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 Twitter Reply With Quote





Last Updated on May 12, 2013


© 2024 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 - Privacy Policy - Downloads - Top
no new posts