How to convert this code AFL function

IMG_20210907_002013
Help me to convert.

Here is a skeleton. Search formulas for missing MAs (hint: some are basic AB functions) and fill the gaps. Have fun :slightly_smiling_face:


// functions
function VariantMA(type, src, len, g) {
	local S;
	switch(type) {
		case "EMA": S = EMA(src, len); break;
		case "WMA": S = WMA(src, len); break;
		// etc
		
		default: S = 0; break;
	}
	return S;
}

// params
type = ParamList("Type", "EMA|WMA");
src = ParamField("src");
len = Param("length", 20, 5, 100);
// etc

// computations
M = VariantMA(type, src, len, 0);

// graphs
Plot(src, "", colorBlack, styleThick);
Plot(M, "Variant MA", colorGreen, styleThick);
1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.