Linear Regression - Reverse Up/Down Strategy by bruce.lesko

By bruce.lesko

Performance Metrics

Description

Dec 27, 2020For my first foray into pine script I took the code from the generic "Consecutive up/down" and flipped the logic. I added a linear regression filter to try and stay with the overall trend. ATR added for visual, I eventually want to use it as part of the money management.Rules to open trade or close the opposite:IF the linear regression slope is >=0 AND the last candle closes lower, BUYIF the linear regression slope is =0 AND the last candle closes higher, close any open SELLIF the linear regression slope is <=0 AND the last candle closes lower, close any open BUYDec 28, 2020Release NotesGo with or against the Linear Regression trend using pullbacks or looking for breakouts of consecutive bars.Dec 28, 2020Release NotesUpdated smooth moving average for ATR channelDec 28, 2020Release NotesAdded RSI for filtering overbought and oversold conditionsDec 29, 2020Release NotesCode cleanup. Dec 30, 2020Release Notesmoved early exit to after entry to reduce redundant position callsDec 30, 2020Release NotesSet default behavior to go with major trend(200 linear regression slope) and against minor trend pullbacks(4 linear regression slope)Dec 30, 2020Release NotesAdded a date range function for choosing which date to test.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView