Doesn't quite do what I was hoping for. PlotMode PL_ALL just mashes the graphs together making them not legible. I was hoping for neat single asset result plot that I can use to analyze and debug.
Looks like I'll have to do one asset a time for this.
If you have all the asset price curves and let's say SMAs saved in different globally defined series, there is nothing stopping you from doing something like
Code:
int cnt=0;
while(loop(Assets)){
asset(Loop1);
Prices[cnt]=series(price());
smas[cnt] =series(SMA(Prices[cnt],10));
cnt++;
}
asset(Assets[0]);
PlotWidth = 600;
PlotHeight1 = 500;
PlotHeight2 = 500;
int i;
for(i=0;i<cnt;i++){
plot(strf("%s",Assets[i]),Prices[cnt],NEW,BLACK);
plot(strf("sma for %s",Assets[i]),smas[cnt],0,BLUE);
...plot more stuff...
}
Hi Hredot, I am new to Zorro and I can not run your code. It complained about Prices and smas undefined and some other errors. So I canged the code to:
Code
function run()
{
StartDate = 20200710;
// My Assets File
assetList("AssetsFXCMLite");
int cnt=0;
vars Prices[10];
vars smas[10];
BarPeriod = 1440;
while(loop(Assets)){
//printf("\n%s", Loop1);
//asset(Loop1);
Prices[cnt] = series(priceClose());
smas[cnt] = series(SMA(Prices[cnt],10));
cnt++;
}
asset(Assets[0]);
PlotWidth = 600;
PlotHeight1 = 500;
PlotHeight2 = 500;
int i;
print("\n*************** %d",cnt);
for(i=0;i<cnt;i++){
plot(strf("%s",Assets[i]),Prices[i],NEW,BLACK);
plot(strf("sma for %s",Assets[i]),smas[i],0,BLUE);
}
}
Now there is no errors. But the plots are the same. (See bellow). Can you give me a clue?
Only cleaned up your code, it works fine (unfortunately it seems to not be possible to plot candles in all charts: "Candles and bands are only plotted in the main chart." see https://zorro-project.com/manual/en/plot.htm)):
Code
Code
vars Prices[0];
vars smas[0];
function run()
{
set(PLOTNOW);
PlotWidth = 600;
PlotHeight1 = 500;
PlotHeight2 = 500;
StartDate = 20220101;
EndDate = 20220205;
BarPeriod = 1440;
//My Asset File
assetList("AssetsXY");
int cnt = 0;
int i;
//while(loop(Assets))
while(asset(loop(Assets)))
{
Prices[cnt] = series(priceClose());
smas[cnt] = series(SMA(Prices[cnt],10));
cnt++;
}
asset(Assets[0]);
for(i=0;i<cnt;i++)
{
plot(strf("Cl for %s",Assets[i]),Prices[i],NEW,BLACK);
plot(strf("SMA for %s",Assets[i]),smas[i],0,BLUE);
}
}