Current bar is not finished, and the "close" of bar zero is the (still changing) current bid.
My understanding is that the expert advisor should only run when a new tick comes through. Is there a way to code only for entry on closing price (30 min chart)?

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
......
double DonchianLowerEntry = iCustom(NULL,0,"DonchianChannel2",2400,3,-2,0,100,0,0); // Entry for Lower Donchian Channel - 50 days, 2400
double DonchianUpperEntry = iCustom(NULL,0,"DonchianChannel2",2400,3,-2,0,100,1,0); // Entry for Upper Donchian Channel - 50 days, 2400
double ClosingPrice = iClose(NULL,0,0); //Closing Price of current bar
......
if(ClosingPrice>DonchianUpperEntry) // Closing price is greater than the Donchian upper channel
{
if(trend>0) // Trend is up - MACD indicator filter
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-TrailingStop,0,"Alcatraz: Long Order Placed",16384,0,Green); // Open Long order
.....
Expert Advisor is opening a trade when bar penetrates Donchian Channel, but does not close above the Channel. It should be opening trade only when it CLOSES above the channel. Does anyone know why this might be happening?