Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Tick Charts - How to track time?

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

    Tick Charts - How to track time?

    Hi all,

    I've been experimenting with tick charts on some of the contracts I trade (versus minute charts), and I've run into a curious problem.

    When looking at these contracts in a one minute chart, it was easy to code up reports that would send e-mails out at 10:30 am, 12 Noon, 1:30 pm, etc. With tick charts, it all depends on how long it takes ticks to fill up a bar. So a tick may conclude filling at 10:31am, and complete miss the timeframe a report is supposed to be sent.

    If I'm still looking to send out these reports at these specific times, what can I use instead of ToTime(Time[0]) to achieve this?

    FYI, this is done in a COBC = false, FirstTickofBar setting. The code looks like this:

    Code:
    //  Send SMS to update performance of trading day (done at 10:30AM, Noon, 1:30PM and 3:00PM CDT)
    			if (marketUpdateTime != ToTime(Time[0]))		{	marketCheck = true;  }
    			
    			if (marketCheck == true)
    			{
    				if (ToTime(Time[0]) == 103000
    					|| ToTime(Time[0]) == 120000
    					|| ToTime(Time[0]) == 133000
    					|| ToTime(Time[0]) == 150000)
    				{
    					subjectLine = (Time[0].ToShortTimeString() + " Report for " + DateTime.Today.DayOfWeek);
    					smsMessage = ("Score: $" + Math.Round(Performance.RealtimeTrades.TradesPerformance.Currency.CumProfit, 0) + " (" + Math.Round(Performance.RealtimeTrades.TradesPerformance.GrossProfit, 0) + " vs. " + Math.Round(Performance.RealtimeTrades.TradesPerformance.GrossLoss, 0) + ") on " + Performance.RealtimeTrades.Count + " trades.");
    					
    					Print(subjectLine);
    					Print(smsMessage);
    					
    					SendMail(fromEMail, toEMail, subjectLine, smsMessage);
    					
    					marketCheck = false;
    					marketUpdateTime = ToTime(Time[0]);
    				}
    			}

    #2
    As of right now, i can only think of:

    Add a time end condition check of say 1-2 minutes.

    Add some variables to know if that time check has been fired off for that time period.





    Originally posted by Spiderbird View Post
    Hi all,

    I've been experimenting with tick charts on some of the contracts I trade (versus minute charts), and I've run into a curious problem.

    When looking at these contracts in a one minute chart, it was easy to code up reports that would send e-mails out at 10:30 am, 12 Noon, 1:30 pm, etc. With tick charts, it all depends on how long it takes ticks to fill up a bar. So a tick may conclude filling at 10:31am, and complete miss the timeframe a report is supposed to be sent.

    If I'm still looking to send out these reports at these specific times, what can I use instead of ToTime(Time[0]) to achieve this?

    FYI, this is done in a COBC = false, FirstTickofBar setting. The code looks like this:

    Code:
    //  Send SMS to update performance of trading day (done at 10:30AM, Noon, 1:30PM and 3:00PM CDT)
    			if (marketUpdateTime != ToTime(Time[0]))		{	marketCheck = true;  }
    			
    			if (marketCheck == true)
    			{
    				if (ToTime(Time[0]) == 103000
    					|| ToTime(Time[0]) == 120000
    					|| ToTime(Time[0]) == 133000
    					|| ToTime(Time[0]) == 150000)
    				{
    					subjectLine = (Time[0].ToShortTimeString() + " Report for " + DateTime.Today.DayOfWeek);
    					smsMessage = ("Score: $" + Math.Round(Performance.RealtimeTrades.TradesPerformance.Currency.CumProfit, 0) + " (" + Math.Round(Performance.RealtimeTrades.TradesPerformance.GrossProfit, 0) + " vs. " + Math.Round(Performance.RealtimeTrades.TradesPerformance.GrossLoss, 0) + ") on " + Performance.RealtimeTrades.Count + " trades.");
    					
    					Print(subjectLine);
    					Print(smsMessage);
    					
    					SendMail(fromEMail, toEMail, subjectLine, smsMessage);
    					
    					marketCheck = false;
    					marketUpdateTime = ToTime(Time[0]);
    				}
    			}

    Comment


      #3
      Oh yeah, there are on event callbacks you can add, which might work for your minute checks.

      Time for zzzz.l8r
      Originally posted by Spiderbird View Post
      Hi all,

      I've been experimenting with tick charts on some of the contracts I trade (versus minute charts), and I've run into a curious problem.

      When looking at these contracts in a one minute chart, it was easy to code up reports that would send e-mails out at 10:30 am, 12 Noon, 1:30 pm, etc. With tick charts, it all depends on how long it takes ticks to fill up a bar. So a tick may conclude filling at 10:31am, and complete miss the timeframe a report is supposed to be sent.

      If I'm still looking to send out these reports at these specific times, what can I use instead of ToTime(Time[0]) to achieve this?

      FYI, this is done in a COBC = false, FirstTickofBar setting. The code looks like this:

      Code:
      //  Send SMS to update performance of trading day (done at 10:30AM, Noon, 1:30PM and 3:00PM CDT)
      			if (marketUpdateTime != ToTime(Time[0]))		{	marketCheck = true;  }
      			
      			if (marketCheck == true)
      			{
      				if (ToTime(Time[0]) == 103000
      					|| ToTime(Time[0]) == 120000
      					|| ToTime(Time[0]) == 133000
      					|| ToTime(Time[0]) == 150000)
      				{
      					subjectLine = (Time[0].ToShortTimeString() + " Report for " + DateTime.Today.DayOfWeek);
      					smsMessage = ("Score: $" + Math.Round(Performance.RealtimeTrades.TradesPerformance.Currency.CumProfit, 0) + " (" + Math.Round(Performance.RealtimeTrades.TradesPerformance.GrossProfit, 0) + " vs. " + Math.Round(Performance.RealtimeTrades.TradesPerformance.GrossLoss, 0) + ") on " + Performance.RealtimeTrades.Count + " trades.");
      					
      					Print(subjectLine);
      					Print(smsMessage);
      					
      					SendMail(fromEMail, toEMail, subjectLine, smsMessage);
      					
      					marketCheck = false;
      					marketUpdateTime = ToTime(Time[0]);
      				}
      			}

      Comment


        #4
        Hi Sledge,

        What did you mean by event callbacks?

        And yeah, your first post is what I'm thinking about doing. Basically opening those times up to 10:30am to 10:35 am, adding another variable to see if the message has been fired off during that time, and working it that way.

        - Spider

        Comment


          #5
          Hi Spider, you could use a custom timer event here to fire at a time interval of your choosing instead relying on the bars time formation, which can hit or miss on non time based charts - http://www.ninjatrader.com/support/f...ead.php?t=5965

          Or you add a minute stream to your tick script, and fire events off those updates.
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Thanks Bertrand! I'll give that a shot and post back if I have anything meaningful to contribute. Much appreciated!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            7 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            4 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            12 views
            0 likes
            Last Post Javierw.ok  
            Started by timmbbo, Today, 08:59 AM
            2 responses
            13 views
            0 likes
            Last Post bltdavid  
            Working...
            X