Activate the Strategy routine after specified DateTime – how

Advertising of the commercial indicators and strategies.

Moderator: admin

Activate the Strategy routine after specified DateTime – how

Postby sztracyh » Sun Oct 30, 2016 5:00 pm

Here is what I want:
The specified Activate DateTime (call it ActivateDateTime) to be entered in the Parameter input when loading the Strategy.
Use Now() to check against the ActivateDateTime.
Only move on to the strategy routine script after the ActivateDateTime reaches.

I use below in the Parameter:

strategy.parameters:addGroup("Activate DateTime Parameters");
strategy.parameters:addInteger("ActivateYear", "Activate Year", "Specify the Year", 2016);
strategy.parameters:addInteger("ActivateMonth", "Activate Month", "Specify the Month", 10);
strategy.parameters:addInteger("ActivateDay", "Activate Day", "Specify the Day", 1);
strategy.parameters:addInteger("ActivateHour", "Activate Hour", "Specify the Hour", 0);
strategy.parameters:addInteger("ActivateMinute", "Activate Minute", "Specify the Minute", 0);
strategy.parameters:addInteger("ActivateSecond", "Activate Second", "Specify the Second", 0);

And I use below to try to pass-on the above parameters to get the ActivateDateTime:
ActivateDateTime = core.datetime (ActivateYear, ActivateMonth, ActivateDay, ActivateHour, ActivateMinute, ActivateSecond);

But it does not work – the error message is “The first parameter must be a number”.

If I directly enter the number in the assignment (like below), it works:
ActivateDateTime = core.datetime (2016, 10, 1, 0, 0, 0);

Can I get some help on how can I use Parameter to assign a DateTime to the ActivateDatetime?

Appreciate any help.

Tracy Huang
sztracyh
 
Posts: 7
Joined: Wed Dec 16, 2015 4:42 pm

Return to Indicators and Strategies Advertising

Who is online

Users browsing this forum: No registered users and 1 guest