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.


Forex Software → Express Generator → SyntaxError: Unexpected token � in JSON at position 0

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 4

Topic: SyntaxError: Unexpected token � in JSON at position 0

I used the download script to download data from MT5. However, the data I got gives the following error when I used EG to generate strategies from the data. I have attached the data for your review. What could I be doing wrong?

C:\express-generator>node bin/gen --server fxtm --symbol EURUSD --period D1
                ..:: Express Generator v2.11 ::..
undefined:1
��{
^

SyntaxError: Unexpected token � in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (C:\express-generator\bin\gen.js:52:25)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.12.1

Re: SyntaxError: Unexpected token � in JSON at position 0

The problem is that NodeJS doesn't read UTF-8 files properly as exported from MT.

I tried many tricks to overcome that, but still, I had no success.

The current solution is to edit your Data Export scripts to export ASCII files instead of UTF8.

Open your Data export script and find the SaveFile function around line 131.

Replace:

int file_handle = FileOpen(fileName, FILE_WRITE|FILE_TXT);

With:

int file_handle = FileOpen(fileName, FILE_WRITE|FILE_ANSI);

This will force MT to export ASCII files, and Express Generator will be able to read them properly.

Re: SyntaxError: Unexpected token � in JSON at position 0

Thank you very much. This solved the problem

Re: SyntaxError: Unexpected token � in JSON at position 0

This issue is fixed in Express Generator v2.22

Posts: 4

Pages 1

You must login or register to post a reply

Forex Software → Express Generator → SyntaxError: Unexpected token � in JSON at position 0

Similar topics in this forum