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

time at the close of bar plus 2 minutes in HH:mm format.

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

    time at the close of bar plus 2 minutes in HH:mm format.




    people with nt,


    i have been collaborating on a system to trade individual stock options automated. this system is almost finished and at the moment i am testing rolling positions over.


    to this end i need to create a variable (or variables) that will take the time at the close of the current bar only, add two minutes to this time and then return this new time as a string in HH:mm format.



    from other indicators i have created for nt i have this code below but i don't know if this will return the time in the desired HH:mm format and how could i add 2 minutes to this time.


    = string.Format(@"{0}", DateTime.Now.ToString("HH:mm"));



    i will greatly appreciate your assistance, i think this should be a really elementary piece of code to put together for advanced developers.



    very well, regards.

    #2
    Hello rtwave,

    The Time objects in NinjaScript are C# DateTime objects so you can use any standard DateTime functions like AddMinutes : https://docs.microsoft.com/en-us/dot...tframework-4.8

    Code:
    DateTime newTime = Time[0].AddMinutes(2);
    Then you can format the newTime variable however you waned like you have shown with ToString.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by rtwave View Post

      i have been collaborating on a system to trade individual stock options automated. this system is almost finished and at the moment i am testing rolling positions over.

      Hello rtwave

      I was reading some comments from you about algorithmic options trading, here in ninjatrader forum, in a couple threads.

      I'm starting to work in the topic of how to automate options, for both, options on ETFs/stocks and mainly for options on Futures, and I would like to ask you where I can find more information about these topics, because I'm seeing most platforms doesn't come with a built and ready-to-use way to automate options and about how to make backtests/optimizations for options automated strategies.

      I was reading your other post here:
      Hi, I'm assessing to develop an automated options trading system based obviously on its underlying's behavior. I imagine that if I knew in advance what option would I use, then I'd simply add that data series to submit orders. But I wonder this: Could I make a system that once is running the strategy on the underlying or


      and there you say that "...i have posted about this system on elite trader and other public fora and will post more extensively when i have the chance.", but I couldn't find those posts in Elite Trader, so I would like to ask you to share the links of those posts from Elite Trader and the other public forums, I don't know if maybe directly in the "github discussions section" for example.

      Well, in addition to what you've posted in the past in other forums, I will appreciate all the help you can provide about this topic.

      Thank you in advance!



      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Waxavi, 04-19-2024, 02:10 AM
      2 responses
      36 views
      0 likes
      Last Post poeds
      by poeds
       
      Started by chbruno, Yesterday, 04:10 PM
      1 response
      44 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by Max238, Today, 01:28 AM
      1 response
      23 views
      0 likes
      Last Post CactusMan  
      Started by giulyko00, Yesterday, 12:03 PM
      2 responses
      10 views
      0 likes
      Last Post giulyko00  
      Started by r68cervera, Today, 05:29 AM
      0 responses
      4 views
      0 likes
      Last Post r68cervera  
      Working...
      X