I have converted this basic to afl with no results.
Can you tell me where is the error?
The original one is:
rem filter stop 1% below wmm30 in bull market
if close>weightedaverage[30](close) then
a=weightedaverage[30](close)-weightedaverage[30](close)/100
rem distance with the stop point
distanciamm30=close-a
remou maximun amount of money you can loose(v variable)
v=292
b=v/distanciamm30
endif
if close<weightedaverage[30](close) then
a=weightedaverage[30](close)+weightedaverage[30](close)/100
rem distance from the stop point to the close
distanciamm30=close-a
b=v/distanciamm30
cero=0
endif
return cero, b as "shares"
AND THIS IS THE AFL TRANSCRIPCION.:
I know that it is incorrect couse does not show the same result
// filtro stop 1% por debajo de mm30 en mercado alcista
mm30=WMA(Close,30);
x=Close;
IIf (x>mm30,colorBlue,styleLine);
a=(mm30-mm30)/100;
// distancia del cierre con punto de stop
distanciamm30=Close-a;
// numero de acciones segun riesgo en dinero asumible(variable V)
V=292;
b=V/distanciamm30;
IIf (Close<mm30,colorRed,styleLine) ;
a=mm30+mm30/100;
// distancia del punto stop al cierre
distanciamm30=Close-a;
b=V/distanciamm30;
cero=0;
Plot(b,"Acciones", colorRed);
Plot(Cero,"0",colorBlue,styleLine);
Can you tell me where is the error?
The original one is:
rem filter stop 1% below wmm30 in bull market
if close>weightedaverage[30](close) then
a=weightedaverage[30](close)-weightedaverage[30](close)/100
rem distance with the stop point
distanciamm30=close-a
remou maximun amount of money you can loose(v variable)
v=292
b=v/distanciamm30
endif
if close<weightedaverage[30](close) then
a=weightedaverage[30](close)+weightedaverage[30](close)/100
rem distance from the stop point to the close
distanciamm30=close-a
b=v/distanciamm30
cero=0
endif
return cero, b as "shares"
AND THIS IS THE AFL TRANSCRIPCION.:
I know that it is incorrect couse does not show the same result
// filtro stop 1% por debajo de mm30 en mercado alcista
mm30=WMA(Close,30);
x=Close;
IIf (x>mm30,colorBlue,styleLine);
a=(mm30-mm30)/100;
// distancia del cierre con punto de stop
distanciamm30=Close-a;
// numero de acciones segun riesgo en dinero asumible(variable V)
V=292;
b=V/distanciamm30;
IIf (Close<mm30,colorRed,styleLine) ;
a=mm30+mm30/100;
// distancia del punto stop al cierre
distanciamm30=Close-a;
b=V/distanciamm30;
cero=0;
Plot(b,"Acciones", colorRed);
Plot(Cero,"0",colorBlue,styleLine);