Simple system: Need very little EA recommendation

 

Here is Logic

Trade when the range between GMT 02:00 and 10:00 is less than 60 pips then Open sell IF price breaks minimum - 5pips line or buy if price breaks maximum + 5 pips line. AND EXECUTE ONLY ONE TRADE PER DAY, IT DOES NOT MATTER TRADE IS CANCELED CLOSED AT STOP OR TAKEN PROFIT JUST ONE ORDER A DAY.

HERE IS CODE BUT IT DOES NOT WORK, IN EA MANU OF MT4 it has inactive icon and there is no ex4 file in experts folder, I could not understand what's wrong

extern double stopLoss = 300.0;

extern double takeProfit = 500.0;

extern string Begin = "2: 00";

extern string End = "10: 00";

extern double distance = 60;

bool isECN = true;

bool cond = false;

bool cond2 = false;

double low;

double high;

extern double lots = 0.1;

int magic = 1232344524285020;

int slippage = 1;

string comment = "";

int ticket;

int short = 0;

long int = 0;

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

//----

//----

(0) return;

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit ()

{

//----

Print (countOrders (magic, OP_BUY));

//----

(0) return;

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

Print (AccountCurrency ());

//----

if (isGoodTime (Begin, End))

{

short = 0;

long = 0;

if (! cond)

{

low = Bid;

high = Ask;

}

cond = true;

if (Bid < low) low = Bid;

if (Ask > high) high = Ask;

}

if ((high-low) * 1000 > distance)

{

cond2 = true;

}

if (! isGoodTime (Begin, End))

{

cond = false;

}

if (! isGoodTime (Begin, End) & & cond2)

{

if (countOrders (magic, OP_SELL) == 0)

{

if (Bid ≪ = (CRL-0.0005) & & short == 0)

{

short + +;

if (isECN == false)

{

OrderSend (Symbol (), OP_SELL, lots, Bid, slippage, sltpValue (Ask + stopLoss * Point, stopLoss), sltpValue (Ask-takeProfit * Point, takeProfit), comment, magic);

}

if (isECN)

{

ticket = OrderSend (Symbol (), OP_SELL, lots, Bid, slippage, 0,0, comment, magic);

OrderSelect (ticket, SELECT_BY_TICKET);

OrderModify (ticket, OrderOpenPrice (), sltpValue (Ask + stopLoss * Point, stopLoss), sltpValue (Bid-takeProfit * Point, takeProfit), 0);

}

}

}

if (countOrders (magic, OP_BUY) == 0)

{

if ((Ask-high) > = 0.005 & & long = = 0)

{

long + +;

if (isECN == false)

{

OrderSend (Symbol (), OP_BUY, lots, Ask, slippage, sltpValue (Ask-stopLoss * Point, stopLoss), sltpValue (Bid + takeProfit * Point, takeProfit), comment, magic);

}

if (isECN)

{

ticket = OrderSend (Symbol (), OP_BUY, lots, Ask, slippage, 0,0, comment, magic);

OrderSelect (ticket, SELECT_BY_TICKET);

OrderModify (ticket, OrderOpenPrice (), sltpValue (Bid-stopLoss * Point, stopLoss), sltpValue (Ask + takeProfit * Point, takeProfit), 0);

}

}

}

}

//----

(0) return;

}

//+------------------------------------------------------------------+

bool isGoodTime (string, string, Begin, End) {

if (TimeCurrent () > Localtime (Begin) & & TimeCurrent < Localtime () (End)) {

return (true);

}

return (false);

}

int countOrders (int, int oMagic oType) {

int count = 0;

for (int i = 0; i < OrdersTotal (); i ++) {

if (OrderSelect (i, SELECT_BY_POS)) {

if (OrderMagicNumber () == oMagic) {

if (OrderSymbol () = the = Symbol ()) {

if (OrderType () == oType || oType < 0) {

count ++;

}

}

}

}

}

return (count);

}

double sltpValue (double, int w1 w2)

{

if (w2 = = 0)

return (0);

return (NormalizeDouble (w1, Digits));

}

Reason: