You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Know Sure Thing (KST): KST is a momentum oscillator that combines various timeframes to identify trend changes. It has a value range between -100 and +100, where crossovers above or below zero can indicate potential buy or sell signals.
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Lime
//---- indicator parameters
extern int ROC_Period1 = 10; // Rate of Change period 1
extern int ROC_Period2 = 15; // Rate of Change period 2
extern int ROC_Period3 = 20; // Rate of Change period 3
extern int ROC_Period4 = 30; // Rate of Change period 4
extern int SMAROC_Period = 9; // Smoothed Moving Average period for ROC
extern int Signal_SMAPeriod = 9; // Signal line Smoothed Moving Average period
//---- indicator buffers
double KSTBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
SetIndexBuffer(0, KSTBuffer);
IndicatorDigits(Digits + 1);
IndicatorShortName("KST");
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int start = max(ROC_Period1, max(ROC_Period2, max(ROC_Period3, ROC_Period4))) + SMAROC_Period + Signal_SMAPeriod + 1;
if (rates_total < start)
return(0);
int limit = rates_total - 1;
double SMAROC = (iMAOnArray(close, 0, ROC_Period1, 0) +
iMAOnArray(close, 0, ROC_Period2, 0) +
iMAOnArray(close, 0, ROC_Period3, 0) +
iMAOnArray(close, 0, ROC_Period4, 0)) / 4;
double SignalLine = iMAOnArray(SMAROC, 0, Signal_SMAPeriod, 0);
KSTBuffer[limit] = SMAROC - SignalLine;
return(rates_total);
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Beta Was this translation helpful? Give feedback.
All reactions