Page 1 of 1

Torch framework

PostPosted: Thu Feb 01, 2018 12:49 pm
by daniel.alzate
Hey Guys,

I don't know if this is the right place to post this, but I'm trying to math torch ( with indicoreSDK with no luck. A simple test (just adding
Code: Select all
require 'torch'
in one of the standard indicators show error when loading DLL files from the torch library.

Have any of you guys tried to do this before?

Thanks in advance for comments.

Re: Torch framework

PostPosted: Sun Feb 04, 2018 11:26 am
by Apprentice
The query was forwarded to the development team.

Re: Torch framework

PostPosted: Mon Feb 12, 2018 11:20 am
by daniel.alzate
Hi, any updates on this?

As an alternative, I also tried to link Octave using indicoreDev. I was able to make a simple dll file and call the function in it from a Lua file, but when I added libraríes and includes from octave, the indicoreSDK debug simply didn't find the dll suitable showing an error like
error loading module "xxxxxx" from file

waiting for comments

thanks again.

Re: Torch framework

PostPosted: Tue Feb 13, 2018 3:49 pm
by Konstantin.Toporov
Torch is not provided officially for Windows.
What Torch binaries do you have?
I am not sure they are compatible with FXTS.

Re: Torch framework

PostPosted: Wed Feb 14, 2018 11:56 am
by daniel.alzate
Hi Konstantin ...

I'm using this: I've tested in my windows 10 and is working good.

Re: Torch framework

PostPosted: Wed Feb 28, 2018 4:01 pm
by Konstantin.Toporov
We ll investigate what is the problem

Re: Torch framework

PostPosted: Tue Mar 06, 2018 1:24 am
by PetroIV
Hello daniel.alzate,

Actually, Torch works only with Lua JIT.
You will be able to use Torch for indicators/strategies if you do the following steps:
1. Download the x86 branch from
2. Copy all .dll files except libluajit.dll from WindowsTorch\bin\ to the root folder where FXTS is installed.
3. Copy the file FXTS\Lua5.1.jit.dll to FXTS\libluajit.dll.
4. Copy the WindowsTorch\lua folder to FXTS\lua.
5. In FXTS, select FXTS Options-> Marketscope 2.0 -> Lua Virtual Machine Type -> Lua Just-In-Time.
6. Restart FXTS.

For testing, you can use the attached indicator test_torch.lua.

Re: Torch framework

PostPosted: Thu Mar 15, 2018 12:33 pm
by daniel.alzate
Good work guys, it worked great.

I'll try to play with that framework and see what I get. If I run into problems I'll post it.

Thank you

Re: Torch framework

PostPosted: Mon Jun 11, 2018 12:40 am
by daniel.alzate
Hello Guys, Does anyone want to help me with this?.

Ive already done some torch basics using example you guys gave me. I have done some simple candle recognition working good on FXTS and IndicoreSDK.
Got issues when i tried to do a simple nn like this (example gotten from this

Code: Select all
function Init()
    indicator:name("Torch Test");
    indicator:description("Torch Test indicator");

require 'torch'
require "nn"
function Prepare(onlyName)

    if onlyName then
        return ;
    local z = torch.Tensor(4,5,6,2)
    local s = torch.LongStorage(6);
    s[1] = 4; s[2] = 5; s[3] = 6; s[4] = 2; s[5] = 7; s[6] = 3;   
    local x = torch.Tensor(s);;
   --NN test
   function dataset:size() return 100 end -- 100 examples
   for i=1,dataset:size() do
     local input = torch.randn(2);     -- normally distributed example in 2d
     local output = torch.Tensor(1);
     if input[1]*input[2]>0 then     -- calculate label for XOR function
      output[1] = -1;
      output[1] = 1
     dataset[i] = {input, output}

   mlp = nn.Sequential();  -- make a multi-layer perceptron
   inputs = 2; outputs = 1; HUs = 20; -- parameters
   mlp:add(nn.Linear(inputs, HUs))
   mlp:add(nn.Linear(HUs, outputs))   
   criterion = nn.MSECriterion() 
   trainer = nn.StochasticGradient(mlp, criterion)
   trainer.learningRate = 0.01

function Update(period)


When testing this code in IndicoreSDK 3.0 works fine:


But when trying to import and run the exact same indicator in FXTS i got this:


Im blocked here :cry: Any help will be appreciated.

Re: Torch framework

PostPosted: Fri Jun 29, 2018 5:27 am
by Apprentice
Forwarded to the development team.