Background: I have created an indicator in MQL4 and will use the mql5 market service (as suggested by users in another post I started). However, I also want to build my own independent 5 day free trial version for a group of traders that I am already in touch with (due to limitations of the MQL5 market demo versions I want to offer my own to traders that I know so they get the full experience).
Problem: After reading some articles found through this website and others, I have successfully been able to modify the initialization code so that it expires after a specified future time T has been reached (using basic functions like TimeCurrent, Day, Month, ... etc). However, I notice that when the indicator is open in MT4 and running, it will continue to work even after the deadline is passed. It only stops working if you exit the indicator and try to start it up again after time T. The problem is that in theory, someone can leave their terminal open indefinitely and use the software indefinitely. And so my current security feature relies on them exiting their terminal at some point.
Is there a way to make an indicator stop running, while it's open, once a certain time is hit?
I believe this can be done with EAs using OnTick(), but OnTick() does not apply for indicators
place your protection code in such way:
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time,
const double &open,
const double &high,
const double &low,
const double &close,
const long &tick_volume,
const long &volume,
const int &spread)
Or within OnTimer().