if (vAlert == false) { if (vMACD1 < vSignal1 && vMACD >= vSignal) { // crossing up vAlert = true; AlertCntr += 1; drawShapeRelative(0, vSignal, Shape.UPARROW, null, Color.yellow, Image.TOP | Image.ONTOP, "Alert" + AlertCntr); } if (vMACD1 > vSignal1 && vMACD <= vSignal) { // crossing down vAlert = true; AlertCntr += 1; drawShapeRelative(0, vSignal, Shape.DOWNARROW, null, Color.yellow, Image.BOTTOM | Image.ONTOP, "Alert" + AlertCntr); } } else { if ((vMACD1 < vSignal1 && vMACD < vSignal) || (vMACD1 > vSignal1 && vMACD > vSignal)) { vAlert = false; removeShape("Alert" + AlertCntr); } } return new Array(vHist, vSignal, vMACD);