Linear Regression Candles strategy

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #232425 quote
    SnorreDK
    Participant
    Junior

    Hi. Its it possible to creta a stradegy from this indicator

    Buy  when candle is green an signal is crossing under close

    sellshort  when candle is  red and signal is crossing over close

    Linear Regression Candles

    #232454 quote
    JS
    Participant
    Veteran

    Hi,

    What do you mean by Buy when the candle is green and the signal is crossing the close”

    The indicator consists of the LinearRegressionCandles (which are red or green) and the Signal Line but theres no Close in it Do you mean Buy when the candle is green and the candle crosses over the signal line or SellShort when the candle is red and the candle crosses under the signal line???
    #232459 quote
    SnorreDK
    Participant
    Junior
    Do you mean Buy when the candle is green and the candle crosses over the signal line or SellShort when the candle is red and the candle crosses under the signal line???
    Yes 🙂
    #232463 quote
    Iván González
    Moderator
    Master
    Hi Here you have the code
    defparam cumulateorders=false
    ///////////////////////////////////////////////////////
    //------------------Inputs------------------------------
    signallength = 11 //integer//Signal Smoothing
    smasignal = 1 //boolean // Simple MA (Signal Line)
    linreg = 1 //boolean//Linear Regression
    linreglength = 11//integer//Linear Regression Length
    //------------------------------------------------------
    //-------------Candle definition------------------------
    if linreg then
    bopen = LinearRegression[linreglength](open)
    bhigh = LinearRegression[linreglength](high)
    blow = LinearRegression[linreglength](low)
    bclose = LinearRegression[linreglength](close)
    else
    bopen = open
    bhigh = high
    blow = low
    bclose = close
    endif
    //--------------------------------------------------------
    //--------------Color candles-----------------------------
    green=bopen < bclose
    red=bopen>=bclose
    //---------------------------------------------------------
    //---------------Signal definition-------------------------
    if smasignal then
    signal = average[signallength](bclose)
    else
    signal = average[signallength,1](bclose)
    endif
    //---------------------------------------------------------
    if green and bclose crosses over signal then
    buy 1 contract at market
    endif
    if red and bclose crosses under signal then
    sellshort 1 contract at market
    endif
    #232464 quote
    JS
    Participant
    Veteran

    That’s right, that’s the system… 😉

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Linear Regression Candles strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
SnorreDK @snorredk Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by JS
1 year, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/07/2024
Status: Active
Attachments: No files
Logo Logo
Loading...