Linear Regression Universal Strategy, how to improve it?

Viewing 3 posts - 31 through 33 (of 33 total)
  • Author
    Posts
  • #199676 quote
    GraHal
    Participant
    Master

    I tried below, didnt affect results (attached) but still got Rejected!

    //https://www.prorealcode.com/topic/linear-regression-universal-strategy-how-to-improve-it/#post-199478//Linear Regression Universal Strategy
    // instrument: CNHJPY
    // timezone : europetime, berlin
    // timeframe : Daily
    // Spread: 0.7
    // created and coded by davidelaferla
    //————————————————————————-
     
    defparam cumulateorders=false
    DEFPARAM PRELOADBARS = 10000
     
    //***********************************************************************************************************
    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 ---------------------------------------
    if barindex>=10000 then
    hv=Max(0.1,HistoricVolatility[VolatilityPeriod](close))
    hv2=Max(0.1,HistoricVolatility[VolatilityPeriod](typicalprice))
    endif
    if barindex>=10000 then
    lr=linearregression[max(1,ROUND(Regression1Period*Regression2Period*hv2))](typicalprice)
    st=linearregression[max(1,ROUND(Regression1Period*hv))](close)
    endif
    //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
    
    GRAPH HV
    GRAPH HV2
    
    Rejects.jpg Rejects.jpg
    #199682 quote
    JC_Bywan
    Moderator
    Master

    Maybe Linearregression doesn’t like the easy job of having just 1 point to look at, and wants 2 points at least before deeming it acceptable to play with us pleb…

    so: max(2,ROUND(…  (to modify twice)  (worked without rejection this time)

    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)
    
    if barindex>=VolatilityPeriod then
    lr=linearregression[max(2,ROUND(Regression1Period*Regression2Period*hv2))](typicalprice)
    st=linearregression[max(2,ROUND(Regression1Period*hv))](close)
    endif
    
    //
    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
    //
    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
    GraHal and Midlanddave thanked this post
    #199691 quote
    GraHal
    Participant
    Master

    Genius JC! Thank You!

    I have a 1 hour TF and 12 min TF version running, both have run through a ‘first full bar’ and neither have been rejected!

Viewing 3 posts - 31 through 33 (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...