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:
// 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