/*
Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
Website: http://purebeam.biz
E-mail : purebeam@gmail.com
*/
#property copyright "Copyright @ 2010 Rita Lasker"
#property link "http://www.robot4free.com"
extern double LotSize = 0.1;
double gd_84 = 3.0;
int gi_92 = 110;
int gi_96 = 100;
int gi_100 = 540;
int gi_104 = 2;
int g_color_108 = Blue;
int g_color_112 = Red;
int g_magic_116;
int g_bars_120 = 0;
int g_bars_124 = 0;
double gd_128;
int g_slippage_136;
int init() {
if (Point == 0.00001 || Point == 0.001) {
gd_128 = 10.0 * Point;
g_slippage_136 = 10.0 * gd_84;
} else {
gd_128 = Point;
g_slippage_136 = gd_84;
}
g_magic_116 = Period() + 1339005;
return (0);
}
int start() {
if (g_bars_120 == Bars) return (0);
g_bars_120 = Bars;
if (AccountFreeMargin() < 1000.0 * (2.0 * LotSize)) return (0);
if (LotSize < 0.1) return (0);
MathSrand(TimeLocal());
int l_count_0 = 0;
int l_ord_total_4 = OrdersTotal();
for (int l_pos_8 = 0; l_pos_8 < l_ord_total_4; l_pos_8++) {
if (OrderSelect(l_pos_8, SELECT_BY_POS) != FALSE)
if (OrderMagicNumber() == g_magic_116 && OrderSymbol() == Symbol()) l_count_0++;
}
if (l_count_0 >= gi_104) return (0);
if (Bars >= g_bars_124 + gi_92) {
if (MathRand() % 2 == 1) fSell();
else fBuy();
g_bars_124 = Bars;
}
return (0);
}
void fBuy() {
int l_error_4;
RefreshRates();
int l_ticket_0 = OrderSend(Symbol(), OP_BUY, LotSize, Ask, g_slippage_136, Ask - gi_96 * gd_128, Ask + gi_100 * gd_128, "myRandom", g_magic_116, 0, g_color_108);
if (l_ticket_0 == -1) {
l_error_4 = GetLastError();
Print(l_error_4);
}
}
void fSell() {
int l_error_4;
RefreshRates();
int l_ticket_0 = OrderSend(Symbol(), OP_SELL, LotSize, Bid, g_slippage_136, Bid + gi_96 * gd_128, Bid - gi_100 * gd_128, "myRandom", g_magic_116, 0, g_color_112);
if (l_ticket_0 == -1) {
l_error_4 = GetLastError();
Print(l_error_4);
}
}