Why code using AlertByEmail takes a long time to execute?
Author: maximgl
Creation Date: 8/12/2018 11:03 PM
profile picture



I am trying to implement email functionality within my strategy to send emails only when running in StrategyMonitor and I am using something like this:
Please log in to see this code.

When running such code in Strategy mode (not in optimization or monitor) on Daily scale and about 200 tickers takes quite a long time. Commenting out param.SendEmail line significantly improves the speed. Why is this happening?

profile picture


Hi Maxim,

Since the code in question should not run in Strategy Window mode at all, the only reasonable explanation might be having On Demand Data Update enabled.

A side note:

1. At any rate it's under your control. Follow suggestion in this FAQ: Is there a way to profile Wealth-Lab 6 Strategies i.e. measure application/script performance?

2. In some cases, an overhead could be caused by using System.Reflection but not in your case I think.

3. Per se, sending email implies a big time penalty. Sending 200 emails in a row in a sequential manner (or you risk getting banned by the SMTP server for concurrent connections - this may be treated like a form of spam abuse) should take minutes. If the SMTP isn't some paid service I'd even insert a delay between the calls!

This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).