Error:0 and Uninit reason 1

 

Hi all.

I'm an old trader who's learning MQL.

I'm testing a EA who make GRID, and i had the idea to open two charts of the same pair:

In the first one i add the EA to ONLY GO LONG.

In the second one i add the EA to ONLY GO SHORT.

My idea is to do something like a Hedge.

Unfortunatelly, the EA only work in one of the charts.

At the Experts folders i see Error:0 and uninit reason 1 for the chart who don't open orders.

What's the problem? May you please help me on this?

Here is part of the code i guess the problem can be:

gi_328 = CountTrades();
if (gi_328 == 0) gi_292 = FALSE;
for (g_pos_324 = OrdersTotal() - 1; g_pos_324 >= 0; g_pos_324--) {
OrderSelect(g_pos_324, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != g_magic_208) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_208) {
if (OrderType() == OP_BUY) {
gi_344 = TRUE;
gi_348 = FALSE;
l_ord_lots_0 = OrderLots();
break;
}
}
if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_208) {
if (OrderType() == OP_SELL) {
gi_344 = FALSE;
gi_348 = TRUE;
l_ord_lots_8 = OrderLots();
break;

 
Nietsche:

gi_328 = CountTrades();
if (gi_328 == 0) gi_292 = FALSE;
for (g_pos_324 = OrdersTotal() - 1; g_pos_324 >= 0; g_pos_324--) {
OrderSelect(g_pos_324, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != g_magic_208) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_208) {
if (OrderType() == OP_BUY) {
gi_344 = TRUE;
gi_348 = FALSE;
l_ord_lots_0 = OrderLots();
break;
}
}
if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_208) {
if (OrderType() == OP_SELL) {
gi_344 = FALSE;
gi_348 = TRUE;
l_ord_lots_8 = OrderLots();
break;

You did a good job at decompiling. Good luck!
Reason: