Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 sofortune, Yesterday, 11:48 AM
        2 responses
        20 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by Zach55, 02-19-2024, 07:22 PM
        2 responses
        52 views
        0 likes
        Last Post lbadisa1  
        Started by JGriff5646, Today, 05:47 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by AlphaOptions, 06-18-2013, 08:24 AM
        9 responses
        2,199 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by ttrader23, Today, 09:33 AM
        3 responses
        22 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X