Jump to content

Coder needed to make this EA refresh


Guest jaet1989

Recommended Posts

Guest jaet1989

Many Kudos for the coder :)

 

#property copyright

#property link

 

extern string t = "Fixed Lot OR if Lot_size=0 >> AutoLot with Risk_percent!";

extern double Lot_size = 0.0;

extern int Risk_percent = 5;

extern int Distance = 50;

extern string t1 = "Indicator Params";

extern int K = 5;

extern int D = 3;

extern int S = 3;

extern int Length = 10;

int gia_124[7] = {5, 3, 3, 0, 0, 10, 0};

int gi_128;

int g_count_132;

int g_count_136;

int g_count_140;

int g_count_144;

int gi_148;

int gi_152;

int gi_156 = 100;

int g_magic_160 = 20092009;

double g_lots_164;

string g_symbol_172;

int gi_76;

int gi_84;

int g_file_88;

int gia_92[];

double gda_96[];

double gda_100[];

 

int init() {

double ld_4;

double ld_12;

double ld_20;

switch (MarketInfo(Symbol(), MODE_LOTSTEP)) {

case 0.01:

gi_152 = 2;

break;

case 0.1:

gi_152 = 1;

break;

default:

gi_152 = 0;

}

g_symbol_172 = Symbol();

if (Digits > 4 || Digits == 3) {

Distance = 10 * Distance;

gi_156 = 1000;

}

gia_124[0] = K;

gia_124[1] = D;

gia_124[2] = S;

gia_124[5] = Length;

gi_128 = MarketInfo(g_symbol_172, MODE_STOPLEVEL) + MarketInfo(g_symbol_172, MODE_SPREAD);

if (Distance < gi_128) Distance = gi_128;

g_file_88 = FileOpenHistory(Symbol() + Period() + ".hst", FILE_BIN|FILE_READ);

gi_76 = (FileSize(g_file_88) - 148) / 44;

ArrayResize(gia_92, gi_76);

ArrayResize(gda_96, gi_76);

ArrayResize(gda_100, gi_76);

FileSeek(g_file_88, 148, SEEK_SET);

for (int l_index_0 = 0; l_index_0 < gi_76; l_index_0++) {

gia_92[l_index_0] = FileReadInteger(g_file_88, LONG_VALUE);

ld_4 = FileReadDouble(g_file_88, DOUBLE_VALUE);

gda_100[l_index_0] = FileReadDouble(g_file_88, DOUBLE_VALUE);

gda_96[l_index_0] = FileReadDouble(g_file_88, DOUBLE_VALUE);

ld_12 = FileReadDouble(g_file_88, DOUBLE_VALUE);

ld_20 = FileReadDouble(g_file_88, DOUBLE_VALUE);

if (FileIsEnding(g_file_88)) break;

}

return (0);

}

 

int start() {

int l_error_0;

if (Bars < K + Length + 3) return (0);

if (Time[0] > gi_148) {

Check();

if (signal(gia_124) != 0) {

if (MM(gi_156) == 0.0) return (0);

if (gia_124[6] == 1 && g_count_132 + g_count_136 == 0) OrderSend(g_symbol_172, OP_BUYLIMIT, g_lots_164, Bid - Distance * Point, 3, 0, 0, "Fisherman", g_magic_160, 0, Lime);

if (gia_124[6] == -1 && g_count_144 + g_count_140 == 0) OrderSend(g_symbol_172, OP_SELLLIMIT, g_lots_164, Bid + Distance * Point, 3, 0, 0, "Fisherman", g_magic_160, 0, Pink);

l_error_0 = GetLastError();

}

if (l_error_0 == 0 && Check(gia_124[6]) >= 0) {

gi_148 = Time[0];

gia_124[6] = 0;

} else Sleep(10000);

}

return (0);

}

 

double MM(double ad_0 = 100.0) {

if (Lot_size > 0.0) g_lots_164 = Lot_size;

else g_lots_164 = NormalizeDouble(Risk_percent / 100.0 * AccountEquity() / (MarketInfo(g_symbol_172, MODE_TICKVALUE) * ad_0), gi_152);

if (g_lots_164 < MarketInfo(g_symbol_172, MODE_MINLOT) || g_lots_164 > AccountFreeMargin() / MarketInfo(g_symbol_172, MODE_MARGINREQUIRED)) {

if (AccountFreeMarginCheck(g_symbol_172, OP_BUY, MarketInfo(g_symbol_172, MODE_MINLOT)) > 0.0) g_lots_164 = MarketInfo(g_symbol_172, MODE_MINLOT);

else {

Alert("No money!");

g_lots_164 = 0;

}

}

if (g_lots_164 > MarketInfo(g_symbol_172, MODE_MAXLOT)) g_lots_164 = MarketInfo(g_symbol_172, MODE_MAXLOT);

return (g_lots_164);

}

 

int Check(int ai_0 = 0) {

g_count_132 = 0;

g_count_144 = 0;

g_count_136 = 0;

g_count_140 = 0;

for (int l_ord_total_4 = OrdersTotal(); l_ord_total_4 >= 0; l_ord_total_4--) {

if (OrderSelect(l_ord_total_4, SELECT_BY_POS, MODE_TRADES)) {

if (OrderSymbol() == g_symbol_172 && OrderMagicNumber() == g_magic_160) {

if (OrderType() == OP_BUY) {

g_count_132++;

if (!(ai_0 == -1 && OrderStopLoss() == 0.0)) continue;

OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Distance * Point, Bid + Distance * Point, 0, Gold);

continue;

}

if (OrderType() == OP_SELL) {

g_count_144++;

if (!(ai_0 == 1 && OrderStopLoss() == 0.0)) continue;

OrderModify(OrderTicket(), OrderOpenPrice(), Bid + Distance * Point, Bid - Distance * Point, 0, Gold);

continue;

}

if (OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP) {

g_count_136++;

if (ai_0 != -1) continue;

OrderDelete(OrderTicket(), Black);

continue;

}

if (OrderType() == OP_SELLLIMIT || OrderType() == OP_SELLSTOP) {

g_count_140++;

if (ai_0 != 1) continue;

OrderDelete(OrderTicket(), Black);

continue;

}

}

}

if (GetLastError() > 0) return (-1);

}

return (g_count_132 + g_count_144 + g_count_136 + g_count_140);

}

 

int signal(int &aia_0[]) {

int li_16;

int li_20;

int li_4 = aia_0[0] + aia_0[1] + aia_0[2] + aia_0[3] + aia_0[4] + aia_0[5];

if (li_4 < 10) li_4 = 10;

int l_timeframe_8 = Period();

if (l_timeframe_8 < PERIOD_D1 && l_timeframe_8 > 0) li_4 = NormalizeDouble(li_4 * MathLog(4320 / l_timeframe_8), 0);

for (int li_12 = gi_84; li_12 < gi_76; li_12++) {

if (gia_92[li_12] >= Time[0]) {

gi_84 = li_12;

break;

}

}

li_16 = ArrayMaximum(gda_96, 2 * li_4, MathMax(gi_84 - li_4, 0));

li_20 = ArrayMinimum(gda_100, li_4 * 2, MathMax(gi_84 - li_4, 0));

if (gi_84 == li_16 && gi_84 < gi_76 - 3) {

aia_0[6] = -1;

return (-1);

}

if (gi_84 == li_20 && gi_84 < gi_76 - 3) {

aia_0[6] = 1;

return (1);

}

double l_istochastic_24 = iStochastic(NULL, 0, aia_0[0], aia_0[1], aia_0[2], aia_0[3], aia_0[4], MODE_MAIN, 0);

return (0);

}

Link to comment
Share on other sites

  • 2 weeks later...
Guest jaet1989

Re: Coder needed to make this EA refresh

 

The EA does trade, and as I can gauge, in accordance with the backtest on m1 timeframe, but only when I start MetaTrader.

 

I want the EA to trade constantly.

 

Hope this helps.

Link to comment
Share on other sites

Re: Coder needed to make this EA refresh

 

The EA does trade, and as I can gauge, in accordance with the backtest on m1 timeframe, but only when I start MetaTrader.

 

I want the EA to trade constantly.

 

Hope this helps.

 

Not really, sorry.

Metatrader needs to run constantly for the EA to run.

Thanks for the kudos...much appreciated!
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...