I want to change the next formula to backtest and scan in amibroker. The original is from basic languaje(prorealtime software) to backtest. Please tell me separately the formulas to backtest and to scan .
Many, many thanks
cap=volume*close
Rem cap sirve para filtrar smallcaps
maxi=highest[52](close)
distancia1=(maxi-close[0])/maxi*100
myCPM = CALL "Capital proporcional medio"[52]
rem CPM guarda el promedio de 5 semanas del CPM
CPM5 = (myCPM+myCPM[1]+myCPM[2]+myCPM[3]+myCPM[4])/5
mydistancia, ignored = CALL "Distancia MM30"
resultado=0
if mydistancia >2 then
resultado=1
endif
ignored, myFR = CALL "RSCMansfield2"
resultadomansfield=0
if myFR>0.10 then
resultadomansfield=1
endif
// Condiciones para entrada de posiciones largas
IF NOT LongOnMarket AND resultadomansfield and resultado and distancia1<3 AND CPM5>0 and mydistancia<9 and myFR>0.10 and cap>1000000 THEN
BUY 1000 CONTRACTS AT MARKET
ENDIF
// Condiciones de salida de posiciones largas
If LongOnMarket AND WeightedAverage[30](close)[2]<WeightedAverage[30](close)[1]and WeightedAverage[30](close)[1]> WeightedAverage[30](close)and close< WeightedAverage[30](close) THEN
SELL AT MARKET
ENDIF
Many, many thanks
cap=volume*close
Rem cap sirve para filtrar smallcaps
maxi=highest[52](close)
distancia1=(maxi-close[0])/maxi*100
myCPM = CALL "Capital proporcional medio"[52]
rem CPM guarda el promedio de 5 semanas del CPM
CPM5 = (myCPM+myCPM[1]+myCPM[2]+myCPM[3]+myCPM[4])/5
mydistancia, ignored = CALL "Distancia MM30"
resultado=0
if mydistancia >2 then
resultado=1
endif
ignored, myFR = CALL "RSCMansfield2"
resultadomansfield=0
if myFR>0.10 then
resultadomansfield=1
endif
// Condiciones para entrada de posiciones largas
IF NOT LongOnMarket AND resultadomansfield and resultado and distancia1<3 AND CPM5>0 and mydistancia<9 and myFR>0.10 and cap>1000000 THEN
BUY 1000 CONTRACTS AT MARKET
ENDIF
// Condiciones de salida de posiciones largas
If LongOnMarket AND WeightedAverage[30](close)[2]<WeightedAverage[30](close)[1]and WeightedAverage[30](close)[1]> WeightedAverage[30](close)and close< WeightedAverage[30](close) THEN
SELL AT MARKET
ENDIF