Hi,
I am new to Zorro. I have donwloaded minute data from IB for few symbols and start experimenting.
Here is my first sample script:
```
function run() // at any bar
{
// Setup
StartDate = 20200101;
EndDate = 20200201;
BarPeriod = 1;
LookBack = 4800;
// Universe
assetList("AssetsIB");
// trading strategy
while(asset(loop("AMZN", "AXP"))){
// help ts
// The priceO, priceH, priceL, priceC functions can be also used under the names priceOpen, priceHigh, priceLow, priceClose.
vars close = series(priceC());
vars close_returns = series(ROCP(close, 4800 - 1));
// calculate percentile
var percentile_upper = Percentile(close_returns, 4800, 0.99);
//var percentile_lower = Percentile(close_returns, CLOSE_WINDOW_SIZE, 0.01);
/*
// get above and belowe returns if any
if(priceC(0) > percentile_upper){
var above = price(0) - percentile_upper;
}
*/
}
}
```
The code works, but it is pretty slow. I have set only one month for backtest period, but it takes more than 5 minutes for just 2 symbols (I have stopped execution after 5 minutes so I don't know how long it takes in the end ).
Is the problem in my code or is just Percentile function so slow?