RSC Mansfield indicator problems plotting the chart - some help please

Hello all.

I just starting with the AFL programming a couple of months. At the moment I am just copying some codes trying to see the charts.

I am using the full license of Amiquote as database.

The following is the Indicator code RSC Mansfield;

_SECTION_BEGIN("RSC MANSFIELD");
period=Param("Periodo",52,1,500,1);
rsSymbol= ParamStr("Base Index Symbol","^GSPC");
Cociente= C/Foreign(rsSymbol,"C");
countR=Sum(Cociente,period);
Baseprice=CountR/period;
RSC=((Cociente / Baseprice)-1)*10;
SetGradientFill(colorGreen/*top*/,colorRed/*bottom*/,0/*baseline level*/,GetChartBkColor()/*baseline color*/);
Plot(RSC,"RSCMansfield Vs SP500", colorLightOrange, styleLine|styleGradient);
_SECTION_END();

Alfa-Mainsfield Error

You will get {EMPTY} if the data that you pass to Plot() call is not known (it is Null).

In your code it can be because:

  • rsSymbol does not exist in your database
  • rsSymbol does not have the data for the date range shown in the chart
  • the number of bars in either current symbol or rsSymbol is less than your averaging period
1 Like

@trapaga, in the previous answer by @Tomasz, "rsBase" actually refers to the "rsSymbol" in your code.

Anyway, since you are learning AFL, it is essential to learn ASAP how to debug your formulas.

One very simple and efficient way is to employ "explorations" to verify the values of your code.

For instance, as a minimum, I would add to your code these lines:

Filter = 1;
AddTextColumn(rsSymbol, "rsSymbol", 1);
AddColumn(period, "Period", 1);
AddColumn(Cociente, "Cociente", 1.2);
AddColumn(countR, "CountR", 1.2);
AddColumn(Baseprice, "BasePrice", 1.2);
AddColumn(RSC, "RSC", 1.2);

And I will apply the exploration to the current symbol, for an interval of dates/bars greater than the period, to check where null vales are coming from.

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