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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        46 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        14 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        20 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        22 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X