Not sure what you mean with the lines of code you posted.

Here's the code. I have also attached a screenshot of what I would like to see... Showing the subplots is not necessary, I just want to have both instruments showing their respective trades.


Code
#define Y "EWC"
#define X "EWA"


function run()
{
    set(PLOTNOW);
    setf(PlotMode, PL_ALL + PL_FINE);
    StartDate = 20100101;
    EndDate = 20200101;
    BarPeriod = 1440;
    LookBack = ZSLookback;
    MaxLong = MaxShort = MaxTrades;
    
    if(is(INITRUN)) {
	  string Name;
	  while(Name = loop(Y, X)){
			assetHistory(Name, FROM_AV);
	  }
    }
    

// -------------------------------
// PLOTS 
// -------------------------------  
	plot("zscore", ZScore, NEW, BLUE);
	plot(strf("#upLevel"), 2, 0, BLACK);
	plot(strf("#downLevel"), -2, 0, BLACK);
	
}

Attached Files IDEA.png
Last edited by 3dvg; 09/18/20 17:38.