XBTUSD Regression 1 (Machine learning to obtain Decision Trees )

Forums ProRealTime English forum ProOrder support XBTUSD Regression 1 (Machine learning to obtain Decision Trees )

Viewing 12 posts - 1 through 12 (of 12 total)
  • #51470

    Hi,

    I would like to share some research with PRC community. I’m trying to obtain better Equation for price prediction using different kind of indicators. This is an example obtained by multiple factors linear regression in R, but it is also possibile using Machine learning to obtain Decision Trees logics to convert in PRT code with “if.then” .

    The regression coefficient are not so good because I think it is difficult to predict future price analysis past bars, but if someone would like make some trials with some indicators or periods, I could analyse the best factors in R with historical data.

    Also it is possible to use neural network but regression results I found some the moment are not so different from linear regression…

    Thanks for your comments and suggestions

     

    2 users thanked author for this post.
    #51503

    Hello, congratulations for your work and thanks for sharing. The backtest shows very good results, but I do not know if you have taken into account the cost of the Bitcoin operation, given that the spread is 10 points.
    Best regards.

    #51547

    Hello, unfortunately your regression is overfitted on short term data, 200k bar backtest is flat until 15 september.

    #51556

    Hi, thanks for your answers! I know that this precise model is not profitable or have some defects

    I’m searching some people who have basis notions in R programming and machine learning to try a lot of models that it is possibile to obtain from it and try it in PRT.

    1. Converting linear regression models in equation or
    2. Decision trees in IF, THEN logics.
    3. Neural Network tree in weighted equations

    If you have some knowledge in R programming I should send to you my R codes for historical data extraction, model training / regression.

    Note that a lot of those results will be “overfitted” by nature of the use of machine learning training.

    But I think that it’s possibile also to create some auto-adaptative models or equity slope change alerts…

    Thanks!

    #51558

    Hi Arnaud, thanks for your sharing and to propose different approach. I know quite well R language, and even if I do not have a lot of time to invest in all the good discussions around here (and at the same time OMG .. 😉 ), I can have a look on your machine learning code, as long as discussions remain public in this topic for the benefit of everyone.

     

    #51560

    Hi Nicolas, ok no problem! sharing with community could only improve the possibilities and the code…

    Let me write an explanation text before.

    Also how can I share “.R” or “CSV” type files  on the platform? (it gives me an error)

    Thanks

     

    #51563

     

    R code for decision trees models uses “caret” package. Neural network uses “neuralnet” package. Standard trading indicators are calculated using “TTR” package.

     

    Note: You will find the original code sources for each techniques as references, but all code has been modified and can’t give any guarantee of success for trading.

     

    1.Process of data Analysis:

    1. Data extraction: I used MT4 platform to export historical data in CSV format at prefered timeframe. The path to csv file must be indicated in the code.  
    2. Determination of future price movement by shifting values to 5 periods in the future
    3. Calculation of custom and standard indicators (TTR)
    4. Training of the model (classification, neural network or regression)
    5. Printing / analysis of results

     

    2.CLASSIFICATION MODEL for NON-PARAMETRIC PREDICTION

     

    Filename: “Predictive RPART Price Modeling v3.0.R”

     

    (code reference: https://www.quantinsti.com/blog/predictive-modeling-algorithmic-trading/)

     

    The price value is transformed to non-parametric “class” of movement: UP, DOWN or NOTHING (possibile actions to BUY, SELL or NOTHING).

    The file uses rpart training method to obtain decision trees, without pre processing to maintained values scales of each indicators.

     

    PRO: rpart used directly is very fast. Random forest features selection skipped because too slow..

    CONS: I omit to test the model on real data after training: I prefer to make it directly in “backtest” with  trading code like Prorealcode or MQL4

     

    3.NEURAL NETWORK AND REGRESSION MODEL for PARAMETRIC PREDICTION

     

    Filename “neuralnetR for PRT v1.2.R”

     

    (code reference: https://www.r-bloggers.com/fitting-a-neural-network-in-r-neuralnet-package/)

     

    It use parametric values of price changes from now to 5 periods in the future.

    The file uses neural network compared to multiple linear regression.

     

    PRO: regression is faster but works for parametric features (how to choose it?)

    Easier to classification because there is no need to transform values in “classes”.

    CONS: neural network difficult to code in trading system. Features must be reduced at the minimum.

    I create a repository here : https://github.com/adegard/PRT

    You will find source code and csv historical data for example.

    Thanks for you comments

    #51567

    Thanks, I’ll try to give a look this week.

    #51707

    here i.e. another multiple regression optimized on the long side…

    I don’t know how to use neural network “as equation” in PRT?

     

    #51770

    Coding a Decision tree could be a little tricky in PRT… here I give an example of Caret-Rpart results (in R) convert to PRT code for EURUSD 30Minutes… Results are not so good,  because accuracy of model depends so much about the choice of factors…

     

     

    #51817

    Tricky but seems like you made it 🙂 Do the settings are over-fit by the training model or did you make some validations somehow?

    #51842

    Hi Nicolas, yes, it is possibile in R to test models by using some real data (typically 20%) and also to plot the equity line… but for some reasons, the backtests in R and on other platforms (PRT or metatrader) doesn’t give the same results.

    The best way should be to find machine learning directly integrated in trading platform which find automatically models using indicators and historical data from the platform itself. I hope those new “features” could be accessibles for all of us.

    In fact intuitive methods of writing strategies are “old” method of trading and we need new tools to fastered strategy creation (take a look of the attached image from hiHedge, a new generattion of AI traders from Singapor. ) Not at the same level… but it could be nice to use Neural Network or Deep learning for “common” people trading… 😉

     

    1 user thanked author for this post.
Viewing 12 posts - 1 through 12 (of 12 total)

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