Missing arguments error for AFL function MA

The following short code (as indicator) was running OK. It shows error recently. Someone please help me to figure out what is the problem. Thanks

image

type or paste code here
```_SECTION_BEGIN("Volume");
FVB = Status("firstvisiblebar"); 
color_v = IIf( C >Ref(C,-1), colorGreen, colorRed);
colorma65 = colorCustom11;
MA65 = MA( V, 65);
Plot( V, "", Color_v, styleHistogram | styleThick, maskHistogram);
Plot( MA65, "", colorma65, styleLine|styleThick);
Title = Name()+"  -  "+_SECTION_NAME()
+"\n"+ EncodeColor(colorGreen)+"Volume = "+WriteVal(V,FORMAT=1.0)
+"\n"+ EncodeColor(colorma65)+"MA65"+ EncodeColor(colorwhite) + " = "+WriteVal(mA65,FORMAT=1.0);
_SECTION_END();

In the code you posted (after removing what you should have 'type or paste code here ```'!) there is no errors!

The code that you posted is correct and does not produce any errors. The problem is most likely elsewhere (in the part that you did not post)

Thanks for the response.
The error appears on every code/pane at the function "MA". Does an error on a code/pane affect other code/pane?
image

@Victor it seems that you are using a plugin to access data from TC2000.

Just to exclude one possible source of trouble, could you test the snippet you posted originally, using the sample database that is provided during the Amibroker installation? (Without using the plugin, just a simple local database).

It works for:

  1. new full installation.
  2. new full installation and TC2000 plugin data .

It does not work for:
new upgrade installation

Apparently, the software was damaged and cannot repaired simply by upgrade installation. So, I need to redo all the layouts (all the indicators) one by one manually.
Thank you very much for the help!

Just by chance, you might have added a 3rd party PLUGIN that OVERWRITES internal MA() function. Please send a screenshot from
Tools->Plugins

The screenshot (attached) looks ok.
After putting back all the indicators one by one to the newly full installed program. I found out that one of the indicators/panes was causing the problem. I corrected it and all the errors were fixed. So, it seems to me that one bad indicator/pane can affect others. Is this true?
Thank you very much for following up.

image

By the way, I just noticed that there is "TC2Q0x/rCNet Plug-in" in the list. How can I use it? Can I use it to directly connect to TC2000 to get data? Currently, I download the data using TC2000 v7 and save as a data file for Amibroker to use.

The screenshot is truncated, we don't know if these are all plugins or not.

No, it is impossible.

As I wrote, the only situation when MA would throw an error as you wrote before would be when you had 3rd party plugin installed that overwrites MA built-in function.

As for TC2000: https://forum.amibroker.com/search?q=TC2000

Delete or Move all plugin to desktop or another location. and run the Amibroker setup files once again with full installation then you can check.

Ma function never give syntax error..

Try the below AFL

_N( Formula_Name = "" );
_N( System_Ver = "" + Name() );
Day_OfWeek = DayOfWeek();
No_Month = Month();
_N( Day_Name = WriteIf( Day_OfWeek == 0, "Sun", WriteIf( Day_OfWeek == 1, "Mon", WriteIf( Day_OfWeek == 2, "Tue", WriteIf( Day_OfWeek == 3, "Wed",	WriteIf( Day_OfWeek == 4, "Thu",	WriteIf( Day_OfWeek == 5, "Fri", WriteIf( Day_OfWeek == 6, "Sat",	"Unknown" ) ) ) ) ) ) ) );
_N( Month_Name = Writeif( No_Month == 1, "Jan", Writeif( No_Month == 2, "Feb", Writeif( No_Month == 3, "Mar", Writeif( No_Month == 4, "Apr", Writeif( No_Month == 5, "May",
                          Writeif( No_Month == 6, "Jun", Writeif( No_Month == 7, "Jul", Writeif( No_Month == 8, "Aug", Writeif( No_Month == 9, "Sept", Writeif( No_Month == 10, "Oct", Writeif( No_Month == 11, "Nov", Writeif( No_Month == 12, "Dec", "Unknown" ) ) ) ) ) ) ) ) ) ) ) ) );
_N( Hour_Min_Sec = WriteIf( Hour() > 9, "" + Hour(), "0" + Hour() ) + ":" + WriteIf( Minute() > 9, "" + Minute(), "0" + Minute() ) + ":" + WriteIf( Second() > 9, "" + Second(), "0" + Second() ) );
_N( CustomDateFormat = Day_Name + " " + NumToStr( Day(), 1.0 ) + " " + Month_Name + " " + NumToStr( Year(), 1.0, False ) + "  " + WriteIf( Interval() < inDaily, Hour_Min_Sec, "" ) );
Yogya_Upcolor = ColorRGB( 0, 177, 88 );
Yogya_DownColor = ColorRGB( 246, 70, 65 );
Setchartoptions( 0, Chartshowarrows | chartShowDates );
SetbarfillColor( IIf( C > O,  Yogya_Upcolor, Yogya_DownColor ) );
Plot( C, "Price", IIf( C > O,  Yogya_Upcolor, Yogya_DownColor ), styleCandle | styleNoTitle );
SetFormulaName( Formula_Name + "" + System_Ver );
_N( Title = EncodeColor( ColorRGB( 255, 150, 150 ) ) + StrFormat( Formula_Name + "" + System_Ver + "  {{INTERVAL}}  " ) + CustomDateFormat + "" + StrFormat( "  Open = %g, Hi = %g, Lo = %g, Close = %g, Volume = %g Change = (%.1f%%) {{VALUES}}", O, H, L, C, V, SelectedValue( ROC( C, 1 ) ) ) );

_SECTION_BEGIN( "MA1");
MA1_Type = ParamList( "MA1_Type", "MA,EMA,HMA,Double EMA,Tripple EMA,Wilders,VWAP,WMA,TSF,LinearReg,LinRegIntercept", 0 );
MA1_Period = Param( "MA1_Period", 10, 2, 300, 1 );
MA1_Color = colorAqua;
_SECTION_END();
MA1_Field = Close;
//MA1_Value = 0;

VMA1_Sum = Sum( Volume, MA1_Period );
VPMA1_Sum = Sum( MA1_Field * Volume, MA1_Period );

if( MA1_Type == "VWAP" ) 	    MA1_Value = VPMA1_Sum / VMA1_Sum;
if( MA1_Type == "MA" ) 					MA1_Value = MA( MA1_Field, MA1_Period );
if( MA1_Type == "EMA" ) 			MA1_Value = EMA( MA1_Field, MA1_Period );
if( MA1_Type == "HMA" ) 					MA1_Value = HMA( MA1_Field, MA1_Period );
if( MA1_Type == "Double EMA" ) 	    MA1_Value = DEMA( MA1_Field, MA1_Period );
if( MA1_Type == "Tripple EMA" ) 	MA1_Value = TEMA( MA1_Field, MA1_Period );
if( MA1_Type == "Wilders" ) 				MA1_Value = Wilders( MA1_Field, MA1_Period );
if( MA1_Type == "WMA" ) 				MA1_Value = WMA( MA1_Field, MA1_Period );
if( MA1_Type == "TSF" ) 	        MA1_Value = TSF( MA1_Field, MA1_Period );
if( MA1_Type == "LinearReg" ) 	    MA1_Value = LinearReg( MA1_Field, MA1_Period );
if( MA1_Type == "LinRegIntercept" ) 	    MA1_Value = LinRegIntercept( MA1_Field, MA1_Period );

Plot( MA1_Value, StrFormat( "\n" + MA1_Type + "(%g)", MA1_Period ), MA1_Color, styleLine, Null, Null, 0, 0, 1 );

Thank you for the help.
The screenshot I posted is all I got. It includes the scrolled down part. It may be the way my Amibroker was set up this way.

Thank you for the response.
I tried it. there is no error.
The problem I had is not the MA function itself. The error was also NOT from the code (pane #2 from top of the list) I posted. Although, it showed error message.
By putting back all the indicators one by one to the newly installed Amibroker. I found out the source of error comes from the last (bottom) pane. Over there, I used an erroneous 2nd parameter input to the ma fuction. This error affected other indicator/pane in the same window (eg. pane #2 whose code I posted). Although, Tomasz think this is unlikely. I did not know this when I posted message for help.
Anyway, I appreciate your kindly response.

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