/*----- ONE PLUS ONE -----*/
//CU1 AND bsnd==1,UP
//CU2,DN
//CU3,IIf(bsnd==1,UP,UP+DN)
//CU5 AND bsnd!=1,UP
//CU6,UP
//CU7 AND bsnd==1,UP
//CU8 AND bsnd==1,DN
/* -------- Yellow setup bar test ------------
setupBar= (zColor==colorYellow AND NOT lbd) AND NOT farMonth;
Buy=0;Sell=0;Short=0;Cover=0;
BuyPrice=0;SellPrice=0;ShortPrice=0;CoverPrice=0;
for(i=0;i<BarCount;i++){
local entryH, entryL, tradeON, longON, shortON, setupON;
if(i==0 OR bsnd[i]==1){
entryH=0;entryL=0;tradeON=0;longON=0;shortON=0;setupON=0;
}
if(setupON){
if(H[i]>=entryH AND L[i]<=entryL){
Buy[i]=1;BuyPrice[i]=entryH;Sell[i]=1;SellPrice[i]=entryL;setupON=0;tradeON=0;longON=0;
}
else if(H[i]>=entryH){Buy[i]=1;BuyPrice[i]=entryH;setupON=0;tradeON=1;longON=1;}
else if(L[i]<=entryL){Short[i]=1;ShortPrice[i]=entryL;setupON=0;tradeON=1;shortON=1;}
}
if(longON AND L[i]<=entryL){Sell[i]=1;SellPrice[i]=entryL;tradeON=0;longON=0;}
if(shortON AND H[i]>=entryH){Cover[i]=1;CoverPrice[i]=entryH;tradeON=0;shortON=0;}
if(longON AND lbd[i]){Sell[i]=1;SellPrice[i]=C[i];tradeON=0;longON=0;}
if(shortON AND lbd[i]){Cover[i]=1;CoverPrice[i]=C[i];tradeON=0;shortON=0;}
if(setupBar[i] AND NOT tradeON){setupON=1;entryH=bandH[i];entryL=bandL[i];}
}
-------- Yellow setup bar test ------------ */
/*-------- Total coverage ------------*/
setupBarLong= ((zColor==colorBrightGreen OR zColor==colorGreen OR zColor==colorYellow) AND NOT lbd) AND NOT farMonth;
setupBarShort= ((zColor==colorRed OR zColor==colorOrange OR zColor==colorYellow) AND NOT lbd) AND NOT farMonth;
setupBar= setupBarLong OR setupBarShort;
Buy=0;Sell=0;Short=0;Cover=0;
BuyPrice=0;SellPrice=0;ShortPrice=0;CoverPrice=0;
for(i=0;i<BarCount;i++){
local entryH, entryL, tradeON, longON, shortON, setupON, setupLongON, setupShortON;
if(i==0 OR bsnd[i]==1){
entryH=0;entryL=0;tradeON=0;longON=0;shortON=0;setupON=0;setupLongON=0;setupShortON=0;
}
if(setupON){
if(H[i]>=entryH AND L[i]<=entryL){
if(setupLongON){Buy[i]=1;BuyPrice[i]=entryH;Sell[i]=1;SellPrice[i]=entryL;}
if(setupShortON){Short[i]=1;ShortPrice[i]=entryL;Cover[i]=1;CoverPrice[i]=entryH;}
setupON=0;setupLongON=0;setupShortON=0;tradeON=0;longON=0;
}
else if(H[i]>=entryH){if(setupLongON){Buy[i]=1;BuyPrice[i]=entryH;}setupON=0;setupLongON=0;setupShortON=0;tradeON=1;longON=1;}
else if(L[i]<=entryL){if(setupShortON){Short[i]=1;ShortPrice[i]=entryL;}setupON=0;setupLongON=0;setupShortON=0;tradeON=1;shortON=1;}
}
if(longON AND L[i]<=entryL){Sell[i]=1;SellPrice[i]=entryL;tradeON=0;longON=0;}
if(shortON AND H[i]>=entryH){Cover[i]=1;CoverPrice[i]=entryH;tradeON=0;shortON=0;}
if(longON AND lbd[i]){Sell[i]=1;SellPrice[i]=C[i];tradeON=0;longON=0;}
if(shortON AND lbd[i]){Cover[i]=1;CoverPrice[i]=C[i];tradeON=0;shortON=0;}
if(setupBar[i] AND NOT tradeON){
setupON=1;entryH=bandH[i];entryL=bandL[i];realLongON=0;realShortON=0;
if(setupBarLong[i]){setupLongON=1;}
if(setupBarShort[i]){setupShortON=1;}
}
//if(tradeON AND zColor[i]==colorYellow){entryH=bandH[i];entryL=bandL[i];} //---- trail
}
/*-------- Total coverage ------------*/