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,255 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?
Datafeed for Atas
Platforms and Indicators
Warsh Drops Easing Bias, December Hike Now Above 50% -- …
Prediction Markets & Event Contracts
Without Pulisic, USA 61.5% Live vs. Australia -- France …
Prediction Markets & Event Contracts
Would a node-based workflow for automated trading be useful?
Traders Hideout
Daytrading to swingtrading
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Want your NinjaTrader indicator created, free?
5 thanks
BERN ALGOS algo trading journal
1 thanks
Afternoon-close session
1 thanks
Franks Trading Journey
1 thanks
Denied 20K payouts: Alpha Futures
1 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,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