Linear Regression Universal Strategy, how to improve it?

Viewing 15 posts - 16 through 30 (of 33 total)
  • Author
    Posts
  • #199634 quote
    JS
    Participant
    Senior

    A typical case of selective reading and reverse psychology… 😉

    #199639 quote
    MaoRai54
    Participant
    Master
    @  JS what do you mean ?
    #199640 quote
    JS
    Participant
    Senior

    I mean, there are a lot of questions about the system and I had hoped to get an answer to that… 😉

    #199643 quote
    MaoRai54
    Participant
    Master
    me too …………………   🙂 in fact, no one is writing any comment about my .itf  I’ve uploaded. well, let’s see !!!
    #199644 quote
    JS
    Participant
    Senior

    Sorry MaoRai54, I thought that comment came from davidelaferia, is not about your system, was about the “Linear regression universel strategy” system.

    #199645 quote
    JS
    Participant
    Senior
    Hi @MaoRai54

    I’ve downloaded your itf -file now, thanks for sharing, but not sure which time frame to use?

    You say “5M as basic timeframe” but in the itf -file it says 15 minutes?

    #199657 quote
    MaoRai54
    Participant
    Master
    @ JS you’re right, sorry. the TF ‘ve tested better is 15 M not 5M
    JS thanked this post
    #199658 quote
    GraHal
    Participant
    Master
    For now, I have reluctantly given up on David’s original TS as it not work without ’round’ and with ’round’ it gets Rejected for not enough historical data. I have a version of MaoRai54 running in Live Demo on 2 mins TF on EURUSD for the last 2 days, but it has yet to take a trade. The original MaoRai54 posted version took too few trades for my trading profile. If I recall correctly there were many days / weeks even (?) where no trades were taken … due I think to too many restrictive conditions?  I’d love to be corrected so if anybody wants to post results?
    #199662 quote
    JS
    Participant
    Senior

    The “linear regression universal system” which I started yesterday in demo (time frame 1 day) is still running and has made two transactions…

    Probably something else going on yesterday, that’s why it rained error messages…

    GraHal thanked this post
    #199663 quote
    JS
    Participant
    Senior
    Hi @MaoRai54

    I’m going to study your system and put it in demo.

    What strikes me is that there are many optimization parameters, can you tell us more about this?

    How did you envision how the system should work?

    #199668 quote
    GraHal
    Participant
    Master
    I started yesterday in demo (time frame 1 day) is still running
    On the strength of above, I just started my M5 version of David TS. First full 5 min bar it got Rejected for not enough historical data to calculate at least one indicator etc Seems Rejections are linked to TF’s at < 1 day fo some weird reason? Anybody got any ideas (Roberto?) … here’s the code (optimised for 10K bars)  that gets Rejected at first full 5 min bar,
    //-------------------------------------------------------------------------
    // Main code : David LinReg DJI M5 10K v1gh
    //-------------------------------------------------------------------------
    //https://www.prorealcode.com/topic/linear-regression-universal-strategy-how-to-improve-it/#post-199478//Linear Regression Universal Strategy
    //DJI
    // timeframe : M5
    // Spread: 5
    // created and coded by davidelaferla
    //————————————————————————-
     
    defparam cumulateorders=false
    DEFPARAM PRELOADBARS = 10000
     
    //***********************************************************************************************************
    ONCE A15 = 25.0
    ONCE A16 = 10.0
    ONCE A17 = 0.8
    N = 1
    //------------------ VARIABILI DEL SISTEMA---------------------------------------
    //CNHJPY Values:      -------------------------------------------- Ottimization info
    Volatilityperiod=A15 //15// different fixed value for each currency pair: range=3-20, with step=1
    Regression1period=A16 //18// Linear Regression Imput Signal:              range=6-100 with step=1
    Regression2period=A17 //1.3//Linear Regression Output Signal:             range=1-2, with step=0.01
    //***********************************************************************************************
    //------------------ INDICATOR ---------------------------------------
     
    hv=HistoricVolatility[VolatilityPeriod](close)
    hv2=HistoricVolatility[VolatilityPeriod](typicalprice)
    st=linearregression[ROUND(Regression1Period*hv)](close)
    lr=linearregression[ROUND(Regression1Period*Regression2Period*hv2)](typicalprice)
     
    // Condizioni per uscire da posizioni short e entrare su posizioni long
    IF st<lr THEN
    BUY n contract AT lr stop
    ENDIF
    // Condizioni per uscire da posizioni long e entrare su posizioni short
    IF st>lr THEN
    SELLshort n contract At st stop
    ENDIF
    
    #199670 quote
    MaoRai54
    Participant
    Master
    @ JS @GraHal Comments on my itf :
    • I started from the version of Davide then I applied different TF to try to get more triggers
    • I added the long part at the beginning to have increase/decrease of number of contracts based on profits. that’s why you’ll see many variables
    • in addition H1 and H2 are the best hour to operate
    • furthermore, to reduce the amount of losses based on contract q.ty I divide the SL by the number of contracts. So in case of multiple q.ty the maximum SL amount remains the one of 1 contract
    • finally, I’m running it with basic TF  15M and, at the moment, only for Eur/$. I’ll try other later.
    The result of backtest are quite poor but constant:
    • Eur/$    period  July 2018 – Aug 2022
    • winning rate  71%
    • 1897 trades
    • +0,90 $ average per trade
    #199672 quote
    JC_Bywan
    Moderator
    Master
    Hi GraHal, hi all, maybe worth trying these 2 modifications together for lines 29-30 of your #199668? (a) change the period to max(1, ROUND(Regression1Period*Regression2Period*hv2)) in order to avoid a zero period in case of low hv or hv2, and still keep the “round” spirit (read: not use ceil when not necessary above 1) (b) add an “if” statement on barindex to make sure hv and hv2 actually exist when calculting these periods for lr and st: if barindex>=VolatilityPeriod then… All together:
    if barindex>=VolatilityPeriod then
     lr=linearregression[max(1,ROUND(Regression1Period*Regression2Period*hv2))](typicalprice)
     st=linearregression[max(1,ROUND(Regression1Period*hv))](close)
    endif
    If it doesn’t work I can try to have another look, but it’s all I can think of for now…
    GraHal thanked this post
    #199673 quote
    GraHal
    Participant
    Master
    Thanks so much JC, unfortunately the TS – including your suggestions above – got Rejected (not enough historic data to calc an indicator) at the first full 5 minute bar … weird eh?
    #199675 quote
    JC_Bywan
    Moderator
    Master
    ok, as it solved display issues with returned lr and st in probuilder, I was hoping to avoid the pain of adding another system in proorder… but I tried and got it rejected too. With it working in probuilder and not proorder it made me look at orders code lines, two thoughts:  (1) I never tried sending pending order « from the wrong side », and position of price wasn’t checked to decide if pending order at stop or at limit is more appropriate, so I modified code as follows in case wrong side pending order was messing things up : IF st<lr THEN if close<lr then BUY n contract AT lr stop elsif close>lr then BUY n contract AT lr limit ENDIF endif // IF st>lr THEN if close>st then SELLshort n contract At st stop elsif close<st then SELLshort n contract At st limit endif ENDIF and (2) st and lr are highly likely to be within minimum stop distance and without stop readjustment box checked system is likely to get stopped fast, so I tried again checking the box… But even with those further 2 changes, got it rejected again… sorry…
    GraHal thanked this post
Viewing 15 posts - 16 through 30 (of 33 total)
  • You must be logged in to reply to this topic.

Linear Regression Universal Strategy, how to improve it?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 32 replies,
has 6 voices, and was last updated by GraHal
3 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/23/2022
Status: Active
Attachments: 4 files
Logo Logo
Loading...