I wouldn't put money on the following script because it gives negative results in different periods of time than 2011-2013. However for the sake to know if there is some mistake since it gives CAGR 3174%, can anyone have a look and see if there is mistake?

#include <profile.c>
function run()

{

BarPeriod = 60;
Stop = optimize(30,20,200)*PIP;
TakeProfit = optimize(500,150,700)*PIP;
ExitTime = 25;
NumWFOCycles = 4;
set(PARAMETERS+FACTORS);
Capital = 500;
StartDate = 2011;
EndDate = 2013;
set(LOGFILE);
plotTradeProfile(-100);

vars A1 = series(priceHigh(2));
vars A2 = series(priceHigh(1));
vars A3 = series(price(0));
var percentage = 0.001;
var Vlr;
Vlr = A1[0] * percentage;


Margin = OptimalF * Capital * sqrt(1 + ProfitClosed/Capital);
if (A1[0] < A2[0] and A3[0] < A1[0]-Vlr) enterLong();
if (A1[0] > A2[0] and A3[0] > A1[0]+Vlr) enterShort();

vars B1 = series(priceLow(2));
vars B2 = series(priceLow(1));
vars B3 = series(price(0));
var percentage = 0.001;
var Vlr;
Vlr = B1[0] * percentage;



//if (B1[0] < B2[0] and B3[0] < B1[0]-Vlr) enterLong();
//if (A1[0] > A2[0] and A3[0] > A1[0]+Vlr) enterShort();


}

------------------------------------------------------
It gives the following result with two degres of freedom:

Read A1,2,3 60'_EURUSD_1.par A1,2,3 60'_EURUSD_2.par A1,2,3 60'_EURUSD_3.par
Factors stored in A1,2,3 60'_EURUSD.fac

A1,2,3 60' run..
Walk-Forward Test: A1,2,3 60' EUR/USD 2011..2013
Read A1,2,3 60'_EURUSD.fac A1,2,3 60'_EURUSD_1.par A1,2,3 60'_EURUSD_2.par A1,2,3 60'_EURUSD_3.par
Monte Carlo Analysis... Median AR 168%
Profit 18772$ MI 1494$ DD 5127$ Capital 2719$
Trades 326 Win 60% Avg +801.8p Bars 21
CAGR 3174% PF 1.53 SR 2.10 UI 11% R2 0.69 ok
Generate Chart - please wait... ok