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 redratsal with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 fluxsmith with 1 posts (1 thanks)
    1. trending_up 3,066 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?
Kalshi Rockets to $22B, Passes Polymarket in Volume -- B …
Prediction Markets & Event Contracts
Bookmap Global Plus Lifetime + Lifetime Addons For Sale
Platforms and Indicators
TradingView Deploys AI to Monitor SEC Filings in Real Ti …
TradingView
US Treasury Weighs Direct Oil Futures Market Interventio …
Commodities
Iran Ceasefire Surges to 19.5% on US 15-Point Plan -- 82 …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
23 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #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,215
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