Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ticks to seconds -- code help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Ticks to seconds -- code help

    I get an entry signal of '1' from an indicator on a tick by tick timeframe. As soon as I get the '1', I want to start measuring seconds (i.e. timestamp when the '1' is thrown and then start a timer countdown basically). After 'x' amount of seconds have passed I want to re-evaluate the signal before placing an order.

    Anyone know how to timestamp this event and then do something 'x' seconds later? Would you use TriggerCustomEvent? Thanks,

    kc

    #2
    kc,

    Unfortunately this requires much more advanced C# than we can offer indepth assistance for. You will likely need to create your own custom timer event. Please see this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=5965
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      kc,

      Unfortunately this requires much more advanced C# than we can offer indepth assistance for. You will likely need to create your own custom timer event. Please see this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=5965
      I was afraid of that...thanks, I'll try to work through the sample.

      Comment


        #4
        I got your back :-)

        Code:
        private int TimeToSec()
        {
        	int t = ((Time[0].Hour * 3600) + (Time[0].Minute * 60) + (Time[0].Second) + (Time[0].Millisecond / 1000));
        	return t;
        }
        This function will convert any time of the day into seconds. You can then calculate a delta on each call.

        hope this helps
        mrlogik
        NinjaTrader Ecosystem Vendor - Purelogik Trading

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        64 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        35 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        59 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        51 views
        0 likes
        Last Post CarlTrading  
        Working...
        X