Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, Ayumi, AndrewAMD, Quad), 1,014 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Neural networks - separate long and short models? #458987
04/12/16 03:17
04/12/16 03:17
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
I was looking into Gruber's post about reproducing the deep learning example in the manual - http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=458985&#Post458985

This approach is similar to some of my own recent work, except for one major difference, which I am hoping jcl or someone else can explain.

In my own machine learning research, I have typically used only one advise() function for trading both long and short, since the function returns a prediction value between -100 and +100 and can therefore be used for both long and short directions. I typically go long for a positive prediction and short for a negative prediction. I also experiment with the prediction threshold at which to enter a trade.

I notice in the deep learning example in the manual that both long and short models are used. I would very much appreciate any insight into how this works. Are there actually two separate models for predicting long and short directions? If so, why do you need two models to predict a binary outcome? And how does one set this up in practice? What is the benefit over using a single model? Any insight or explanation would be greatly appreciated!

In comparison, I trained a neural network from the 'deepnet' package in R by feeding the network the five most recent hourly log returns and asked the network to predict the next log return. Obviously I used a regression approach as opposed to classification, but I measured the out of sample directional accuracy of my network at 53%. This is not quite as good as the accuracy of the network presented in the manual (57%). My network architecture was 5 input nodes, 1 hidden layer with 3 nodes and 1 output node. While the directional accuracy looks decent, the average (no trading cost) profit from trading the direction of the prediction was only about 0.3 pips per trade - not nearly enough to cover the enormous transaction costs of taking a trade every hour.

Re: Neural networks - separate long and short models? [Re: boatman] #458988
04/12/16 03:33
04/12/16 03:33
Joined: Apr 2016
Posts: 3
G
Gruber Offline
Guest
Gruber  Offline
Guest
G

Joined: Apr 2016
Posts: 3
Hey Boatman, reading through the Financial hacker posts I found that he posted the same script again here:
http://www.financial-hacker.com/build-better-strategies-part-4-machine-learning/
And he specified that he uses 3 hidden layers on his network. Maybe that can help on improving your results?

Re: Neural networks - separate long and short models? [Re: Gruber] #458991
04/12/16 07:33
04/12/16 07:33
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Thanks Gruber! Well spotted.

jcl, is the network architecture in your example script the same as that used in the example on the 'How does a trading system work?' page in the manual? ie 3 hidden layers with 20 neurons per layer? If so, what are your inputs?

No problem if the above is a trade secret, I will work it out the hard way. wink

Re: Neural networks - separate long and short models? [Re: boatman] #458992
04/12/16 08:10
04/12/16 08:10
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
No, the chart in the manual page was from a programming job. The inputs were a list of indicators that were particularly required by the client. The 3 layers with 20 neurons in the example was just a random setting for demonstration.

adviseLong() and adviseShort() do exactly the same, they just train two separate models. So you can indeed use only one advise function for both long and short prediction. Or for example one advise function for predicting and the other one for filtering with a different method.


Re: Neural networks - separate long and short models? [Re: jcl] #458997
04/12/16 10:12
04/12/16 10:12
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Thanks, that makes a lot of sense. I am going to try creating a simple ensemble using adviseLong and adviseShort calls.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1