Reinforcement learning without ARRAYS is horrible

Forums ProRealTime English forum ProOrder support Reinforcement learning without ARRAYS is horrible

Viewing 6 posts - 1 through 6 (of 6 total)
  • #53434

    Hi everybody

    I share a piece of code for reinforcement learning technic with 2 variables on only 3 historical of lookback…(very low)… It is horrible thinks without ARRAYS!!

    Unfortunately prorealcode is very limited for such technics because without arrays it is very time consuming and very bigs codes…For this kind of things MQL4 (metatrader) is more powerful! … I’d like that developer people of prorealtime could put arrays too in next releases!! ! 😮

    Do you have some ideas?

     

    #53440

    You are right, some things are difficult (or impossible) to code without Arrays capabilities. Because the programming language was thought of in these beginnings as simply as possible. Today and since the version 10 of prorealtime and the possibility of doing automatic trading, since also version 10.3 and the new graphic possibilities, the need of arrays tables is more and more felt, it is undeniable! I also hope that it will happen soon, I will try to know more, it happens so often to me to be blocked on a code .. 😐

    About your code, I do not understand what you want to do exactly? Are there no possibilities to make it easier with a loop?

    #53443

    I love and can really appreciate what you are attempting here. Especially given the constraints presented by PRT’s lack of array support.

    I must admit I find it difficult to entirely follow the logic in your code. Maybe you can add a few more descriptive comments in your code?

    Anyway, I have attempted similar techniques using PRT in the form of Heuristics but as you say without arrays the code becomes very bulky very quickly.

    Did you test the above on any specific instrument and timeframe?

    #53449

    Hi Nicolas, thanks for your reply…

    It s frustrating because it could have big potential to save data in arrays, such as in my example…

    To explain the principle of reinforcement learning  (see wikipedia image) and explaination:

    The typical framing of a Reinforcement Learning (RL) scenario: an agent takes actions in an environment, which is interpreted into a reward and a representation of the state, which are fed back into the agent.

    • You look the state S of precedent x periods of time and “code” the states by the use of indicators.
    • ie. If you define 3 levels for each indicators, the state 312 for 3 variables a.b.c means A is in state 3, B in state 1 and C in state 2
    • The reward R corrispond to the price increase in the future after the state (you can shift to 1 period or more)
    • The Action A you define corrispond to BUY or SELL based on future rewards
    • if more than 1 state have different rewards, you give a probability

    So the arrays are useful because you need to feed a lot on variables for each states you want to make learn to the machine and multiply by the number of indicators to want to use… i.e. 4 indicators with 4 levels and lookback of 4 periods …means 4x4x4=64 variables to store in PRT code.. and compare to the actual state and predict the action to take

    1 user thanked author for this post.
    #53560

    Hi @juanj

    Thanks for your comments above… I see it now, sorry!

    Yes I try to test it on PRT but to code a reinforcement learning you need to lookback at at least 100-1000 periods. In the above code you can lookback only up to 3 periods…. so it is insufficient to compare the states with the current and make predictions…

    I’m trying it with arrays in MQL4, if you know it, it seems more difficult but the code is much short by the use of array and loops:

    (MQL4 code ONLY)

    This code is not sure, use only in demo!

     

    I like PRT because it is easy to backtest vs metatrader, so I hope it will possibile to run code like this with arrays in the closed future

    I’m please to help the community and receive feedbacks!

     

    #53568

    … one another usefull function of MQL4 is that you can use different securities in your code (i.e. for spread calculation… ) and look different time frame also! 😉

    I’d like to do it in PRT because it ‘s faster!

Viewing 6 posts - 1 through 6 (of 6 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login