StockFetcher Forums · General Discussion · Can this indicator be coded for Stockfetcher<< >>Post Follow-up
schaballa
8 posts
msg #161509
Ignore schaballa
12/22/2024 5:36:39 PM

I have had good entry success with call options using this Leading Indicator on Tradingview. Wondering if anyone can possibly code this indicator.

/@version=5
indicator("Leading Indicator Example", overlay=false)

// Input parameters for indicator sensitivity
length = input(14, title="Regression Period Length")
rocLength = input(9, title="ROC Period Length")
rocThreshold = input(5, title="ROC Threshold")

// Linear Regression for Trend Prediction
lrc = ta.linreg(close, length, 0)

// Rate of Change (ROC) for momentum prediction
roc = ta.roc(close, rocLength)

// Leading Indicator Logic
leadingIndicator = (close - lrc) / ta.stdev(close, length) // Standardized difference from regression line

// Define possible buy and sell signals based on ROC and Leading Indicator
buySignal = roc > rocThreshold and leadingIndicator > 0 // Predicting upward momentum
sellSignal = roc < -rocThreshold and leadingIndicator < 0 // Predicting downward momentum

// Plot the leading indicator as an oscillator
plot(leadingIndicator, color=color.blue, title="Leading Indicator", linewidth=2)

// Highlight buy and sell signals on the chart
bgcolor(buySignal ? color.new(color.green, 90) : na)
bgcolor(sellSignal ? color.new(color.red, 90) : na)

// Plotting ROC to visualize momentum as well
hline(rocThreshold, "ROC Threshold", color=color.gray)
plot(roc, color=color.purple, title="ROC Momentum", linewidth=2)

Thanks in Advance

nibor100
1,052 posts
msg #161510
Ignore nibor100
modified
12/23/2024 3:45:33 PM

what is the TradingView name for this indicator, do you have a chart image to share? or the author's name?
thanks,
Ed S.

schaballa
8 posts
msg #161512
Ignore schaballa
12/23/2024 6:57:06 PM

Hey Ed, The indicator is called Leading Indicator by Parag Raut on Tradingview.

This is the only way I can get an image of his indicator working on my Tradingview account on this forum - https://ibb.co/chW1bgp


schaballa
8 posts
msg #161513
Ignore schaballa
12/23/2024 7:05:00 PM

The indicator is at the bottom of my chart. I was entering just after the solid red bar off a higher low or lower low starting an uptrend and exiting into the first green bar.

nibor100
1,052 posts
msg #161514
Ignore nibor100
12/24/2024 1:28:44 PM

That helps a lot, might take me a couple of days to work out a solution but I think its doable.
Ed S.

nibor100
1,052 posts
msg #161515
Ignore nibor100
12/27/2024 9:41:08 AM

This is as close as I can get it.
Note that during the current day, when the market is open, because TradingView and SF refresh market data at different rates the numbers won't exactly match between them.
Ed S.

Fetcher[
close > 15 close < 16
set{varreg, lri(14)}
set{varstddev1, standard deviation(14)}
set{var4, close minus varreg}
set{var5, var4/varstddev1} add column var5
set{varroc, roc(9,0)} add column varroc
set{thresh, 5}
set{buya, count(varroc > thresh, 1)}
set{buyb, count(var5 > 0, 1)}
set{buyc, buya * buyb}
set{buynow, count(buyc > 0, 1)} add column buynow draw buynow
set{threshneg, -1 * thresh}
set{sella, count(varroc < threshneg, 1)}
set{sellb, count(var5 < 0, 1)}
set{sellc, sella * sellb}
set{sellnow, count(sellc > 0, 1)} add column sellnow draw sellnow
]



schaballa
8 posts
msg #161516
Ignore schaballa
12/27/2024 10:10:20 AM

Ed, Thank you for all of your time and effort! I appreciate it. Lets take a look and hope we can make some money off of this.

Steve

StockFetcher Forums · General Discussion · Can this indicator be coded for Stockfetcher<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.