Why i am getting error in this code?

hmsanil

Active Member
#1
Hi
Can somebody please tell me why am i getting error in this code?

Code:
SetChartBkColor( colorPaleBlue ) ;
SetChartOptions(0,chartShowDates|chartShowArrows);
Plot(C,"",colorWhite,styleCandle);
Price = ParamField("Price");
Period = Param("Period", 20,1,100,1);
function HMA(Price, Length)
{
return WMA(2*WMA(Price, Period/2)-WMA(Price, Period), sqrt(Period));
}
A = HMA(Price, Period);
colorA= IIf(A > Ref(A,-1), colorBrightGreen,colorRed);
Plot(A, "HMA", colorA, styleLine|styleThick);

The errors i am getting are


Ln 6 error 31 syntax error unexpected FUN,epecting identifier
Ln 9 error 32 syntax error, unexpected "}". Is there semicolan missing at the end of previous line?
 

KelvinHand

Well-Known Member
#2
Hi
Can somebody please tell me why am i getting error in this code?

Code:
SetChartBkColor( colorPaleBlue ) ;
SetChartOptions(0,chartShowDates|chartShowArrows);
Plot(C,"",colorWhite,styleCandle);
Price = ParamField("Price");
Period = Param("Period", 20,1,100,1);
function HMA(Price, Length)
{
return WMA(2*WMA(Price, Period/2)-WMA(Price, Period), sqrt(Period));
}
A = HMA(Price, Period);
colorA= IIf(A > Ref(A,-1), colorBrightGreen,colorRed);
Plot(A, "HMA", colorA, styleLine|styleThick);

The errors i am getting are


Ln 6 error 31 syntax error unexpected FUN,epecting identifier
Ln 9 error 32 syntax error, unexpected "}". Is there semicolan missing at the end of previous line?
HMA already a internal function for latest amibroker, so conflict.
you should see the word in highlighted blue in editor.


Change the name of function to HullMA will do OR
remove your own function and used the internal function.

They are the same, check the help guide.
 
Last edited:

Similar threads

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?