Linear Regression Intercept Buy Sell

Optuma Forums Optuma Scripting Linear Regression Intercept Buy Sell

This topic contains 3 replies, has 3 voices, and was last updated by Darren Darren 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #44735

    Jonathan
    • Topics: 12
    • Replies: 12
    • Posts: 24

    Hey,

    If I wanted to add a linear regression buy/sell signal to my charts, what would be the best way to achieve this. I tried to implement the below but showed no results.

    LRINT(BARS=6,DEFAULT=Buy) == 1

    #44743
    Matthew
    Matthew
    • Topics: 3
    • Replies: 38
    • Posts: 41

    Hi Jonathan,

    It depends on what you consider to be a Buy criteria.  For example, if the Close price Crosses Above the Linear Regression Intercept line you would set the script to:

    Close() CrossesAbove LRINT(BARS=6, CALC=Close)

    Ex5

    This image shows the areas (in green) that would pass the above script.

    #44751

    Jonathan
    • Topics: 12
    • Replies: 12
    • Posts: 24

    Thank you, I was forgetting the Close() CrossesAbove!

     

    Is this the same process for other scripts such as darvasbox etc?

    • This reply was modified 3 months ago by  Jonathan.
    #44767
    Darren
    Darren
    • Topics: 22
    • Replies: 87
    • Posts: 109

    Hi Jonathan,

    The formula depends on the type of tool and the signal you want. Because the Linear Regression Intercept is drawn on the price chart then you want the signal to be when closing price crosses the tool, but if you were looking at an oscillator crossing below a value (eg RSI(5) and 30) then you would just use the tool in the function:

    RSI(Bars=5) CrossesBelow 30

    Note that it’s not possible to script for tools that you manually place on a chart, such as a Darvas Box or Fibonacci Retracement. If you want to be notified when those levels are breached you can use a Line Alert.

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

You must be logged in to reply to this topic.

Pin It on Pinterest

Share This

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close