Linear Regression Intercept Buy Sell

Optuma Forums Optuma Scripting Linear Regression Intercept Buy Sell

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #44735
    Jonathan
    • Topics: 39
    • Replies: 59
    • Posts: 98

    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
    • Topics: 5
    • Replies: 430
    • Posts: 435

    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: 39
    • Replies: 59
    • Posts: 98

    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 years ago by Jonathan.
    #44767
    Darren
    • Topics: 66
    • Replies: 679
    • Posts: 745

    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