Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade Timer

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

    Trade Timer

    I'm trying to write some code for a trade timer. Basically I want the timer to let me know how long I have been in the current trade. Spent hours tying myself in knots to get this code going.

    I decided to use the Bar Timer as a code templet. Should I be considering something elese?

    Any thoughts would be appreciated.

    Thanks in adavance.

    George

    #2
    As a last resort you can try contacting one of the NinjaScript Consultants: http://www.ninjatrader.com/webnew/pa...injaScript.htm
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Try this:

      //Variables
      DateTime date1;

      //When you enter trade
      date1 = DateTime.Now;

      //OnBarUpdate
      DateTime date2 = DateTime.Now;
      System.TimeSpan diff = date2.Subtract(date1);
      Print("TimeDiff " + diff.Minutes);

      Originally posted by zepplin View Post
      I'm trying to write some code for a trade timer. Basically I want the timer to let me know how long I have been in the current trade. Spent hours tying myself in knots to get this code going.

      I decided to use the Bar Timer as a code templet. Should I be considering something elese?

      Any thoughts would be appreciated.

      Thanks in adavance.

      George

      Comment


        #4
        Thanks - that is a lot simpler then the nonesense I have been trying to put together.

        Appreciate it - will try it a little later today after the close.

        George

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by GussJ, 03-04-2020, 03:11 PM
        12 responses
        3,239 views
        0 likes
        Last Post Leafcutter  
        Started by AveryFlynn, Today, 04:57 AM
        0 responses
        4 views
        0 likes
        Last Post AveryFlynn  
        Started by RubenCazorla, 08-30-2022, 06:36 AM
        3 responses
        79 views
        0 likes
        Last Post PaulMohn  
        Started by f.saeidi, Yesterday, 12:14 PM
        9 responses
        25 views
        0 likes
        Last Post f.saeidi  
        Started by Tim-c, Today, 03:54 AM
        0 responses
        3 views
        0 likes
        Last Post Tim-c
        by Tim-c
         
        Working...
        X