Perceptron – Single layer neural network

Perceptron – Single layer neural network

The Perceptron is the simplest neural network, here is the code for the single layer version.

To put it simply, here I use a RSI 14 periods smoothed over 5 periods for example, but one could transmit any kind of data to it. By summing the value of the indicator at the instants y1, y2, y3 and y4 and weighted by a different factor for each of these iterations, we obtain an overall weight of the value which must then be interpreted naturally (see attached illustration).

In this version I left the value “raw”, in general one tries to obtain a boolean value by activating the true or false of this value with respect to levels of activation to be defined. In the case of this example on the RSI, this could be “on purchase if perceptron> 70 and on sale if perceptron <30 ..).

The values of the parameters x1 to x4 and y1 to y4 are to be modified at convenience and why not to optimize in Walk Forward mode in the ProBacktest strategy tester.

This code is an example of how the Perceptron is functioning and should be adapted with data arrays of any kind (indicators, prices, …). This leaves a wide area of exploration for those who want to try neural network. Good luck!


Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. juanj • 09/25/2017 #

    Hi Nicolas, this is very interesting. Do you mind maybe providing some more information on how to interpret it or even a use case or two?
    Especially with regards to using the activation/de-activation and then moving on to a stronger neuron (or would this maybe require a new indicator?)

  2. avatar
    fabioerliam • 09/25/2017 #

    Hi Nicolas…I don’t know where to post my request…..sorry!!!!
    Can you tell me in a generic code how can I indicate not 1 contract buy or sell….but less…I tried 0,1 or 0,01 contract at the market,
    but the result it’s always the same….it considers always 1 contract….gimme a hand please=)

    • Nicolas • 09/25/2017 #

      Hi, please post your question in the ProOrder section of the forum.

Register or


avatar avatar avatar avatar avatar avatar
Related users ' posts
tibo002 Bonjour Filoutube, je suis également bloqué comme vous mais votre dernier lien de photo avec...
Jiankyr82 It is a very nice idea, I have taken so many ideas
frenqle Hi There.. It seems the TSL stop loss is not working.. it does not respond is that correct?