NexusFi: Find Your Edge


Home Menu

 





Any coder to help modifying a strategy to trade at specified time ?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one energetic with 2 posts (0 thanks)
    2. looks_two Quick Summary with 1 posts (0 thanks)
    3. looks_3 fluxsmith with 1 posts (1 thanks)
    4. looks_4 redratsal with 1 posts (0 thanks)
    1. trending_up 3,363 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 energetic 
hk
 
Experience: Intermediate
Platform: NinjaTrader
Posts: 55 since Apr 2010
Thanks Given: 23
Thanks Received: 17

Any coder to help modifying a strategy to trade at specified time ?
i.e. I want to trade form last 2 hrs before market close.
thanks


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
AI for Traders — Agents, Memory, Tools & Real-Worl …
Elite Quantitative GenAI/LLM
Bitcoin’s 2022 low, 2025 high and 2026 low so far arou …
Cryptocurrency
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
[WTS] ATAS Lifetime ULTRA license – EU buyers only – …
Platforms and Indicators
Building a free browser DOM/SMC simulator - need some ad …
Platforms and Indicators
 
  #3 (permalink)
 
redratsal's Avatar
 redratsal 
Milan (I)
 
Experience: Advanced
Platform: Ninjatrader
Broker: Kinetick
Trading: FDAX,6E,CL,YM,NQ,ES
Posts: 1,648 since Oct 2010
Thanks Given: 1,216
Thanks Received: 2,090



energetic View Post
Any coder to help modifying a strategy to trade at specified time ?
i.e. I want to trade form last 2 hrs before market close.
thanks


if (ToTime(Time[0]) > StartTime && ToTime(Time[0]) < EndTime)


Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 energetic 
hk
 
Experience: Intermediate
Platform: NinjaTrader
Posts: 55 since Apr 2010
Thanks Given: 23
Thanks Received: 17

thanks..........................



redratsal View Post
if (ToTime(Time[0]) > StartTime && ToTime(Time[0]) < EndTime)


Started this thread Reply With Quote
  #5 (permalink)
 fluxsmith 
Santa Maria
 
Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker: Mirus/Zen-Fire
Trading: ES
Posts: 290 since May 2010
Thanks Given: 97
Thanks Received: 323


redratsal View Post
if (ToTime(Time[0]) > StartTime && ToTime(Time[0]) < EndTime)

Keep in simple when you can (like above). But if you need to support a time range which spans local midnight, structure it like this (from a function wich receives Time[0] as a parameter named '_now', and returns a boolean as to if we're in the timespan):

 
Code
TimeSpan now = _now.TimeOfDay;
 
if ( startTime.CompareTo(endTime) < 0 ) { // Time range is intra-day
   if ( now.CompareTo(startTime) > 0
     && now.CompareTo(endTime) <= 0 )
   returntrue;
}
else                                      // Time range spans midnight
if ( now.CompareTo(startTime) > 0
  || now.CompareTo(endTime) <= 0 )
   returntrue;

returnfalse;


Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on February 5, 2011


© 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