forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Software

Create and Test Forex Strategies

You are not logged in. Please login or register.


(Page 1 of 2)

Forex Software → Express Generator → How to get ExpressGenerator to run with Test.cmd file

Pages 1 2 Next

You must login or register to post a reply

RSS topic feed

Posts: 1 to 25 of 38

1 (edited by Alann 2023-09-12 12:26:15)

Topic: How to get ExpressGenerator to run with Test.cmd file

When I put the following in a command prompt it will collect strategies:

C:\ExpressGenerator - majors\EG_EURUSD & Step11_Run_ExpressGenerator.cmd

However, when I put the following in a Test.cmd file and the Test.cmd file is on my Desktop it will not run:

start cd C:\"ExpressGenerator - majors\EG_EURUSD & Step11_Run_ExpressGenerator.cmd"

Re: How to get ExpressGenerator to run with Test.cmd file

Try renaming the folder so there's no space in the name, and then you won't have to use quotes on the start command. Quotes don't get passed well without double quotes and other ridiculousness with nested commands like that. ;-)

Re: How to get ExpressGenerator to run with Test.cmd file

Same result.

4 (edited by aaronpriest 2023-09-12 02:42:56)

Re: How to get ExpressGenerator to run with Test.cmd file

Spaces, ampersands, and other special characters (like & or %, etc.) don't do well with shell commands, especially when calling one batch file from another. Hyphen and underscore are usually OK (- and _). I'd remove all of those and try again with some simple folder and file names. Also, remove the cd as you don't need to change directories to call a batch file from a folder with a start command.

For example, mine looks like this:
start C:\express-generator\generate.cmd

5 (edited by Alann 2023-09-12 06:00:00)

Re: How to get ExpressGenerator to run with Test.cmd file

When I create a short-cut it will run.

Target: "C:\ExpressGenerator - Majors\EG_EURUSD\Step11_Run_ExpressGenerator.cmd"
Start in: "C:\ExpressGenerator - Majors\EG_EURUSD"

When I put the following in my test.cmd file it will not run:

start  "C:\ExpressGenerator - Majors\EG_EURUSD\Step11_Run_ExpressGenerator.cmd"

6 (edited by aaronpriest 2023-09-12 09:41:34)

Re: How to get ExpressGenerator to run with Test.cmd file

It works for me when I don't use spaces or quotes. A shortcut can use quotes, but to use them on a nested command line (one .cmd starting another .cmd) probably requires double quotes to pass it properly to the next environment, or change the names to avoid using quotes altogether, which means no spaces or certain characters like %, &, etc.

Re: How to get ExpressGenerator to run with Test.cmd file

I am trying to get it to work when I have my test.cmd file located on my desktop.  Does your work from the desktop?

Re: How to get ExpressGenerator to run with Test.cmd file

My .cmd file is in my C:\express-generator\ folder. But I've created a shortcut to that .cmd file.

Re: How to get ExpressGenerator to run with Test.cmd file

> I am trying to get it to work when I have my test.cmd

The easiest way to run Express Generator is to have your CMD file in its directory.

I have tried to run it from a different directory, but I have used Powershell or JavaScript scripts because it is possible to set the "current working directory" for the new process to the Express Generator's directory.

10 (edited by Alann 2023-09-12 16:54:38)

Re: How to get ExpressGenerator to run with Test.cmd file

Maybe I am going about this in the wrong way.  What I was hoping if I could get task.cmd to work then maybe I could get Task Scheduler to work so I could automatically start all my expressgenerators at one time so I could automatically collect strategies for all my chosen currency pairs late on Friday night.  So my question is there another way to do this such as is there a way to schedule a time and day to start expressgenerator in power shell or command prompt that can be written in a windows file and be able to automatically run?

Re: How to get ExpressGenerator to run with Test.cmd file

Alann wrote:

Maybe I am going about this in the wrong way.  What I was hoping if I could get task.cmd to work then maybe I could get Task Scheduler to work so I could automatically start all my expressgenerators at one time so I could automatically collect strategies for all my chosen currency pairs late on Friday night.  So my question is there another way to do this such as is there a way to schedule a time and day to start expressgenerator in power shell or command prompt that can be written in a windows file and be able to automatically run?

Absolutely, I do the same, but my starting .cmd file and the file I reference via start are both in the same C:\express-generator\ folder. And then I reference that file in my task scheduler.

12 (edited by Alann 2023-09-12 22:45:01)

Re: How to get ExpressGenerator to run with Test.cmd file

I finally got it working in Task Scheduler!

Re: How to get ExpressGenerator to run with Test.cmd file

In an attempt to make various generator configurations easier to deploy, I have made all settings in "gen.settings.ini" generic for all possible configurations, placed only the account and symbol settings in "pair.ini", and then placed all the remaining settings in "pair.cmd".

The idea was to have multiple versions of "pair.ini" in nested folders (e.g. data sources, time frames, and pair groups). In this way, I just needed to navigate to the appropriate folder and run a group.cmd that would run each of the individual .cmd files in that folder. This process could be repeated in the future without any changes to the settings.

Unfortunately, it seems from reading other posts that all .cmd files must be in the express-generator folder. Is that the case or do I have it wrong?

P.S. Have I understood the sequencing correctly?
1. "group.cmd" runs multiple "pair.cmd"
2. "pair.cmd" runs "node.js", "gen.js"
3. "gen.js" runs "gen.settings.ini"
4. "pair.cmd" runs "pair.ini"
5. "pair.cmd" takes precedence over "pair.ini"
6. "pair.ini" takes precedence over "gen.settings.ini"

Re: How to get ExpressGenerator to run with Test.cmd file

dlouisbriggs wrote:

In an attempt to make various generator configurations easier to deploy, I have made all settings in "gen.settings.ini" generic for all possible configurations, placed only the account and symbol settings in "pair.ini", and then placed all the remaining settings in "pair.cmd".

The idea was to have multiple versions of "pair.ini" in nested folders (e.g. data sources, time frames, and pair groups). In this way, I just needed to navigate to the appropriate folder and run a group.cmd that would run each of the individual .cmd files in that folder. This process could be repeated in the future without any changes to the settings.

Unfortunately, it seems from reading other posts that all .cmd files must be in the express-generator folder. Is that the case or do I have it wrong?

I have all my .cmd files under C:\express-generator. I don't have any outside of that folder. I have a generate.ini (also under C:\express-generator) that has all my generic settings. I have a generate.cmd file that uses some variables at the top, and then references the generate.ini file, something like this:

set symbol=%1
set period=%2
set minutes=%3

IF "%symbol%" == "" EXIT
IF "%period%" == "" EXIT
IF "%minutes%" == "" EXIT

TITLE %symbol% %period%

REM Fetch Forex Data
node .\bin\fetch.js ^
 --fx-rates true ^
 --symbol %symbol% ^
 --period %period% ^
 --max-data-bars 100000 ^
 --time-zone 3 ^
 --symbol-info true ^
 --check_for_update true ^
 --automatic_update true

REM Generate Strategies
node .\bin\gen.js ^
 --symbol %symbol% ^
 --period %period% ^
 --data-file ./data/Premium/%symbol%_%period%.json ^
 --input ./collections/ ^
 --input-match %symbol% ^
 --output ./collections/[SYMBOL]_[PERIOD].json ^
 --max_working_minutes %minutes% ^
 --settings generate.ini

EXIT

I then have a command that starts it on every pair and timeframe I might want, for as many minutes as a I want it to run, something like this:

START C:\express-generator\generate.cmd EURAUD H1 60
START C:\express-generator\generate.cmd EURCAD H1 60
START C:\express-generator\generate.cmd EURCHF H1 60
START C:\express-generator\generate.cmd EURGBP H1 60
START C:\express-generator\generate.cmd EURJPY H1 60
START C:\express-generator\generate.cmd EURNZD H1 60
START C:\express-generator\generate.cmd EURUSD H1 60

Add as many symbols, timeframes, and minutes you want it to run for (or set 0 for indefinitely until you stop it). If you need more pairs to have more unique settings, then set up more variables for them so you can reference them in your start command.

Re: How to get ExpressGenerator to run with Test.cmd file

I should add, I don't make any changes to the files under the \bin folder because they change with every update. I made a copy of gen.settings.ini and simply called it generate.ini and placed it one folder level up under C:\express-generator, and then edited it to have all my generic settings.

Re: How to get ExpressGenerator to run with Test.cmd file

Thank you aaronpriest ...

I haven't used variables in .cmd files yet so please bear with me.

Suppose I wanted to run 3 pairs. Would I change the "set symbol=%1" to "set symbols=EURUSD GBPUSD USDCAD"

Re: How to get ExpressGenerator to run with Test.cmd file

dlouisbriggs wrote:

Thank you aaronpriest ...

I haven't used variables in .cmd files yet so please bear with me.

Suppose I wanted to run 3 pairs. Would I change the "set symbol=%1" to "set symbols=EURUSD GBPUSD USDCAD"

No, each variable you want to call later needs it's own unique number, hence this at the top of generate.cmd:

set symbol=%1
set period=%2
set minutes=%3

Then in the start command that references generate.cmd (AllPairs.cmd for example) you use the variables you already set placeholders for (1, 2, 3, etc.). In this case symbol, period, and minutes. Thus the command you see that starts generate.cmd and then has symbol, period, and minutes afterward, in that precise order, because those were the 1, 2, and 3 placeholders already defined in generate.cmd. For example:

START C:\express-generator\generate.cmd EURAUD H1 60
START C:\express-generator\generate.cmd EURCAD H4 120

You can use whatever variables you want, as long as they are in the correct order. You couldn't say generate.cmd H4 120 EURUSD for example because symbol=%1, period=%2, and minutes=%3, you'd have to arrange the variables in the correct sequence to match the placeholders you defined. You can define as many variables as you need in this manner, just use them in the correct sequence.

Re: How to get ExpressGenerator to run with Test.cmd file

I have researched more with respect to the format you shared in the prior post (which format 100x better than mine).

I was able to get everything running to the point where I received the error message "There are no loaded collection records!"

Post's attachments

Screenshot 2023-10-11 at 7.29.12 AM.png
Screenshot 2023-10-11 at 7.29.12 AM.png 113.09 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

19 (edited by aaronpriest 2023-10-11 07:12:17)

Re: How to get ExpressGenerator to run with Test.cmd file

dlouisbriggs wrote:

I have researched more with respect to the format you shared in the prior post (which format 100x better than mine).

I was able to get everything running to the point where I received the error message "There are no loaded collection records!"

Check this post with this particular update:
https://forexsb.com/forum/post/75525/#p75525

It is probably because I have validate_then_generate = true in my generate.ini file, that way it will look at existing input files if they exist, and ignore them if they don't.

Some of the new --input-match features might interest you as well.

Re: How to get ExpressGenerator to run with Test.cmd file

You identified my problem perfectly. Thank you. Now I will study the topic you recommended regarding validations.

Re: How to get ExpressGenerator to run with Test.cmd file

Aaron, I checked your previous script and noticed that you export the strategies as [SERVER]_[PERIOD] but import them only by %symbol% for validation. If you work with H1 only, it is not a problem, but it may be if you introduce other periods.

In your script:

REM Generate Strategies
node .\bin\gen.js ^
 --symbol %symbol% ^
 --period %period% ^
 --input ./collections/ ^
 --input-match %symbol% ^
 --output ./collections/[SYMBOL]_[PERIOD].json ^
...

You can use:

 --input-match %symbol% %period% ^

You will match both the symbol and the period in this case.

Re: How to get ExpressGenerator to run with Test.cmd file

Yes, that is true; that is because I have a more complicated script that uses multiple folders for several brokers and datasets [I wrote it before --input-match existed, so that was my workaround], and I had simplified it for this thread for a single dataset. I missed that step, good catch!

Re: How to get ExpressGenerator to run with Test.cmd file

for aaronpriest ... I understand that in your setup the generic settings are placed in generate.ini, and the universal settings like symbol, time frame, mins etc. are generated with variables in generate.cmd, but how do you handle settings that are unique to a pair like swap long and swap short?

24 (edited by aaronpriest 2023-10-11 17:55:24)

Re: How to get ExpressGenerator to run with Test.cmd file

dlouisbriggs wrote:

for aaronpriest ... I understand that in your setup the generic settings are placed in generate.ini, and the universal settings like symbol, time frame, mins etc. are generated with variables in generate.cmd, but how do you handle settings that are unique to a pair like swap long and swap short?

That's where you create new variables, %4, %5, %6, etc. and reference them in your start command line. Also, symbol, timeframe, and minutes ARE unique to each pair, that's why they are variables. If they were universal, then they would be generic and I'd just put them in the generate.ini file.

Re: How to get ExpressGenerator to run with Test.cmd file

> but how do you handle settings that are unique to a pair like swap long and swap short?

> That's where you create new variables, %4, %5, %6, etc.

I solve this problem by having separate "ini" files for each symbol in a subfolder.

For example:
.\ini\EURUSD.ini


swap_long  = -6.88
swap_short = 2.02
stop_loss_range_min = 20
stop_loss_range_max = 220

Then, we can call gen.js with two "ini" files:

node .\bin\gen.js --settings generate.ini .\ini\%symbol%.ini ...

Posts: 1 to 25 of 38

Pages 1 2 Next

You must login or register to post a reply

Forex Software → Express Generator → How to get ExpressGenerator to run with Test.cmd file

Similar topics in this forum