StockFetcher Forums · General Discussion · Can this indicator be coded for Stockfetcher<< >>Post Follow-up
schaballa
5 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

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.