Momentum (close minus close 10 bars ago) Experimental
MQL4 → Cuprel · converter mql4 0.2.0 · converted · 3 lines out
Source (MQL4)
#property indicator_separate_window
#property indicator_buffers 1
double Mom[];
int init() {
SetIndexBuffer(0, Mom);
SetIndexStyle(0, DRAW_LINE);
ArraySetAsSeries(Mom, true);
return(0);
}
int start() {
int limit = Bars - 10;
for (int i = 0; i < limit; i++) {
Mom[i] = Close[i] - Close[i + 10];
}
return(0);
}
Converted (Cuprel)
indicator("Converted indicator", edition = 1, overlay = false)
plot((if bar.index < 10 then na else (close - close[10])), name = "Mom")
Known differences
- the indicator has no title in a form this converter reads: it is called "Converted indicator" (rename it in the editor)
- the platform recalculates the forming bar on every tick; the converted indicator follows the product language (the forming bar can differ)
- the bars before the loop start are unassigned buffer elements in the source; the converted indicator draws nothing there (what the platform draws for them depends on its empty-value default, which is not documented)
Experimental means: the converter reads a thin, tested slice, adds warnings, and says no when it is unsure. Run the converted program on your own data before relying on it.