Backtest in weekly mode

#1
How can I get in weekly mode the results from my afl.

Please give me an idea.


Thanks

SECTION_BEGIN("DISTANCIA A MAXIMOS");


//poner "cap" en otro lugar despues
cap=Volume*Close;

// cap sirve para filtrar smallcaps

Maxi=HHV(Close,52);
distancia1=(maxi-Close[0])/maxi*100;

_SECTION_END();


_SECTION_BEGIN("CAPITAL PROPORCIONAL MEDIO(CPM)");


CPM = Volume * Close;
volmax = HHV(CPM, 52); // 52 days, not week
vol_ = ((CPM * 100)/volmax) * (4/5); // 52 days, not week
volpmed = EMA(vol_, 52);
CPM2 = vol_ - volpmed;

// CPM guarda el promedio de 5 semanas del CPM

CPM2 = (CPM+CPM[1]+CPM[2]+CPM[3]+CPM[4])/5;

IIf(CPM2>0,1,0);

_SECTION_END();






_SECTION_BEGIN("DISTANCIA A mm30");


// mide el riesgo en valor absoluto

wm30 = WMA(Close, 30);

cero = ParamColor("Color", ColorRGB(0,0,0));
distancia = IIf(Close>wm30, (Close-wm30)/Close * 100,
IIf(Close<wm30, (wm30-Close)/Close * 100, 0));

IIf(distancia<9,1,0);
IIf(distancia>2,1,0);

_SECTION_END();

baseprice = Sum((Close/Foreign("^GSPC","Close")),52)/52;
graphmansfield = ((Close/Foreign("^GSPC","Close")/baseprice)-1)*10;
Ligne0 = 0;
IIf(graphmansfield>0.10,1,0);

_SECTION_END();
Buy=IIf(Cap>1000000,1,0);
Buy = IIf(CPM2>0,1,0);
Buy=IIf(distancia1<3,1,0);
Buy=IIf(distancia<9,1,0);
Buy=IIf(distancia>2,1,0);
Buy=IIf(graphmansfield>0.10,1,0);
Sell = IIf(Close<wm30,1,0);
 
#2
Now I know how to show any part or section separately in weekly mode as indicator, but if I convert all them in weekly in this afl to backtest I get no results.
When trying in daily mode I can.
for example I transform any of the indicators above in weekly writting
"TimeFrameSet( inWeekly );" in the first line and it appears in weekly.

Any idea


TimeFrameSet( inWeekly );



weeklyCPM = Volume * Close;
volmax = HHV(weeklyCPM, 52); // 52 days, not week
vol_ = ((weeklyCPM * 100)/volmax) * (4/5); // 52 days, not week
volpmed = EMA(vol_, 52);
CPM2 = vol_ - volpmed;



dynamic_color = IIf( CPM2 > 0, colorGreen, colorRed );
Plot(CPM2, "CPM", dynamic_color , styleHistogram);
// if you do not want to plot, comment above line and can do
// further calc on CPM2

_SECTION_BEGIN("distancia");
wm30 = WMA(Close, 30);

cero = ParamColor("Color", colorYellow);
distancia = IIf(Close>wm30, (Close-wm30)/Close * 100,
IIf(Close<wm30, (wm30-Close)/Close * 100, 0));