Jump to content

Enterra EA


Recommended Posts

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

Re: Enterra EA

 

Thanks Vidara, could you please tell us what pairs and TF does it work?? :arrow: :arrow:

 

@Sh1n1ch1

Yes, the mq4 code is a bunch of lines with the following:

Ïðèâåò îò Enterra! Ïðèâåò îò Enterra! Ïðèâåò îò Enterra! Ïðèâåò îò

 

that is russian language :D

[center:3pm5sdyh]~ Life's Good ~[/center:3pm5sdyh]
Link to comment
Share on other sites

Re: Enterra EA

 

Nope .. I only know that needs to work on low spread and M1 TF and there is time filter in EA, default risk is by mine opinion too high. So we need to figure out a lots of variables there :)

 

Your new link

download link

http://www.forexsharing.com/247162

 

Multicurrency - trades perfectly on EURGBP, EURCHF, GBPCHF, USDCAD, EURCAD, USDCHF, CADCHF

 

TF1M

Link to comment
Share on other sites

Re: Enterra EA

 

Nope .. I only know that needs to work on low spread and M1 TF and there is time filter in EA, default risk is by mine opinion too high. So we need to figure out a lots of variables there :)

 

Your new link

download link

 

http://www.forexsharing.com/593089

 

Multicurrency - trades perfectly on EURGBP, EURCHF, GBPCHF, USDCAD, EURCAD, USDCHF, CADCHF

 

TF1M

 

My frends, this not Entera!

Link to comment
Share on other sites

Re: Enterra EA

 

Nope .. I only know that needs to work on low spread and M1 TF and there is time filter in EA, default risk is by mine opinion too high. So we need to figure out a lots of variables there :)

 

Your new link

download link

http://www.forexsharing.com/247162

 

Multicurrency - trades perfectly on EURGBP, EURCHF, GBPCHF, USDCAD, EURCAD, USDCHF, CADCHF

 

TF1M

 

what is the time set. (gmt settings)

Link to comment
Share on other sites

Re: Enterra EA

 

Even the statement is truthful I don't know which certified broker will allow you to trade it, and even he allows you to trade it, they all have 4+ night spread . ODL has very good fluctuating night EG spread (on demo though), but people had very bad experience with them trading such EAs.

Link to comment
Share on other sites

  • 4 weeks later...

Please Make Entera run on ECN broker

 

Please ladies and gentleman, guy and gal, please change the Entera code and make it run on Nordmarket ECN broker. Entera 3.1 EA or Telescop EA copy some code form Thunder 2E, while thunder 2e can run on ECN broker, why can't we make Entera run on

ECN broker as well :mrgreen: Since we doing backtest and perform much better than Thunder 2E

 

Anyway the hot cake now is ECN isn't it? Enough suffering from Bucket Shop MT4 broker.

 

Code paste below

 

Thanks.

 

 

#property copyright "Enterra_EA_3.1"

#property link "Enterra_EA_3.1"

 

extern string Expert_Name = "Enterra_EA_3.1";

extern bool CloseAll_NOW = FALSE;

extern double TargetEquity = 5000000.0;

extern int OpenHour = 20;

extern int CloseHour = 4;

extern bool LotsOptimized = TRUE;

extern int Risk = 200;

extern double Lots = 0.1;

extern double MaxLots = 100.0;

extern int TP = 4;

extern int SLA = 22;

extern int SLB = 32;

extern int Range_OP = 5;

extern int Slippage = 2;

extern double MaxSpread = 3.0;

extern bool Time_Opened_Protection = TRUE;

extern int OPFromFractal = 7;

extern bool Hidden_TP = TRUE;

extern bool Hidden_SL = TRUE;

extern int MaxTrades = 4;

extern int MaxTradePerBar = 1;

extern int MaxTradePerPosition = 3;

extern int IMA_PERIOD = 11;

extern int MA_AngleZero_PERIOD = 14;

extern int LimitTime_1 = 60;

extern int LimitTime_2 = 140;

extern int LimitTime_3 = 170;

extern int LimitTime_4 = 200;

extern int LimitTime_5 = 240;

extern int pips_1 = 3;

extern int pips_2 = 2;

extern int pips_3 = 0;

extern int pips_4 = 1;

extern int pips_5 = 4;

string gs_unused_232 = "";

string gs_unused_240 = "extern";

string gs_unused_248 = "extern";

string gs_unused_256 = " ";

string gs_unused_264 = " ";

int g_count_272 = 0;

double g_ord_open_price_276 = 0.0;

double g_ord_open_price_284 = 0.0;

int gi_292 = 55;

int g_magic_296 = 123321;

int g_bars_300 = -1;

bool gi_unused_304 = TRUE;

bool gi_unused_308 = TRUE;

double g_ifractals_312;

double g_ifractals_320;

double gd_unused_328;

double gd_unused_336;

double g_ifractals_344;

double g_ifractals_352;

double gd_unused_360;

double gd_unused_368;

int gi_376 = 0;

int gi_unused_380 = 0;

int gi_unused_384 = 0;

double gd_388 = 0.0;

double gd_unused_396 = 0.0;

double gd_unused_404 = 0.0;

int gi_unused_412;

int gi_416;

int gi_420;

double gd_424;

 

int init() {

gd_424 = SetPoint();

return (0);

}

 

int start() {

double ld_0 = NormalizeDouble(MarketInfo(Symbol(), MODE_LOTSTEP), 2);

if (ld_0 == 0.01) gi_420 = 2;

else {

if (ld_0 == 0.1) gi_420 = 1;

else gi_420 = 0;

}

gi_416 = gi_420;

if (CloseAll_NOW == TRUE) {

CloseAll();

return (0);

}

if (TargetEquity > 0.0 && AccountEquity() >= TargetEquity) {

ForceCloseAll();

return (0);

}

int l_count_8 = 0;

int l_count_12 = 0;

int l_count_16 = 0;

int l_ticket_20 = -1;

int l_pos_24 = 0;

for (l_pos_24 = 0; l_pos_24 < OrdersTotal(); l_pos_24++) {

OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES);

if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_296 && OrderCloseTime() == 0) {

l_count_16++;

if (OrderType() == OP_BUY) {

l_count_8++;

g_ord_open_price_276 = OrderOpenPrice();

}

if (OrderType() == OP_SELL) {

l_count_12++;

g_ord_open_price_284 = OrderOpenPrice();

}

}

}

for (int li_28 = 1; li_28 < Bars; li_28++) {

if (iFractals(NULL, PERIOD_M15, MODE_UPPER, li_28) != 0.0) {

g_ifractals_312 = iFractals(NULL, PERIOD_M15, MODE_UPPER, li_28);

gd_unused_336 = Time[li_28];

break;

}

}

for (int li_32 = 1; li_32 < Bars; li_32++) {

if (iFractals(NULL, PERIOD_M15, MODE_LOWER, li_32) != 0.0) {

g_ifractals_320 = iFractals(NULL, PERIOD_M15, MODE_LOWER, li_32);

gd_unused_328 = Time[li_32];

break;

}

}

for (int li_36 = 1; li_36 < Bars; li_36++) {

if (iFractals(NULL, PERIOD_H1, MODE_UPPER, li_36) != 0.0) {

g_ifractals_344 = iFractals(NULL, PERIOD_H1, MODE_UPPER, li_36);

gd_unused_368 = Time[li_36];

break;

}

}

for (int li_40 = 1; li_40 < Bars; li_40++) {

if (iFractals(NULL, PERIOD_H1, MODE_LOWER, li_40) != 0.0) {

g_ifractals_352 = iFractals(NULL, PERIOD_H1, MODE_LOWER, li_40);

gd_unused_360 = Time[li_32];

break;

}

}

gi_376 = MathRound((g_ifractals_312 - g_ifractals_320) / gd_424);

gi_unused_380 = MathRound((g_ifractals_344 - g_ifractals_352) / gd_424);

gd_388 = 0;

gd_388 = g_ifractals_312 - (g_ifractals_312 - g_ifractals_320) / 2.0;

gi_unused_412 = MathRound(iATR(Symbol(), PERIOD_M15, 4, 0) / gd_424);

bool li_44 = FALSE;

if (Close[0] <= g_ifractals_344 && Close[0] >= g_ifractals_352) li_44 = TRUE;

if (IsTradeTime()) {

Comment("\n " + Expert_Name,

"\n\n ???? ",

"\n Broker Time = ", Hour() + " : " + Minute(),

"\n ??? ???? = ", OpenHour,

"\n ??????? = ", CloseHour,

"\n Fractal Envelope = " + gi_376 + " pips",

"\n MidFractal = " + DoubleToStr(gd_388, Digits),

"\n L O T S = " + DoubleToStr(GetLots(), 2),

"\n B A L A N C E = " + DoubleToStr(AccountBalance(), 2),

"\n E Q U I T Y = " + DoubleToStr(AccountEquity(), 2),

"\n*=====================*");

} else {

Comment("\n " + Expert_Name,

"\n\n ? ???? ",

"\n Broker Time = ", Hour() + " : " + Minute(),

"\n ??? ???? = ", OpenHour,

"\n ??????? = ", CloseHour,

"\n Fractal Envelope = " + gi_376 + " pips",

"\n MidFractal = " + DoubleToStr(gd_388, Digits),

"\n L O T S = " + DoubleToStr(GetLots(), 2),

"\n B A L A N C E = " + DoubleToStr(AccountBalance(), 2),

"\n E Q U I T Y = " + DoubleToStr(AccountEquity(), 2),

"\n*=====================*");

}

if (Time_Opened_Protection == TRUE) {

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

OrderSelect(l_pos_48, SELECT_BY_POS, MODE_TRADES);

if (OrderType() == OP_BUY && OrderMagicNumber() == g_magic_296) {

if (TimeCurrent() - OrderOpenTime() > 60 * LimitTime_1 && TimeCurrent() - OrderOpenTime() < 60 * LimitTime_2 && Bid >= OrderOpenPrice() + pips_1 * gd_424) {

RefreshRates();

OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Orange);

Print("Prot. Level 1 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_416) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +

" Profit : $ " + DoubleToStr(OrderProfit(), 2));

}

if (TimeCurrent() - OrderOpenTime() > 60 * LimitTime_2 && TimeCurrent() - OrderOpenTime() < 60 * LimitTime_3 && Bid >= OrderOpenPrice() + pips_2 * gd_424) {

RefreshRates();

OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Orange);

Print("Prot. Level 2 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_416) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +

" Profit : $ " + DoubleToStr(OrderProfit(), 2));

}

if (TimeCurrent() - OrderOpenTime() > 60 * LimitTime_3 && TimeCurrent() - OrderOpenTime() < 60 * LimitTime_4 && Bid >= OrderOpenPrice() + pips_3 * gd_424) {

RefreshRates();

OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Orange);

Print("Prot. Level 3 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_416) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +

" Profit : $ " + DoubleToStr(OrderProfit(), 2));

}

if (TimeCurrent() - OrderOpenTime() > 60 * LimitTime_4 && TimeCurrent() - OrderOpenTime() < 60 * LimitTime_5 && Bid >= OrderOpenPrice() - pips_4 * gd_424) {

RefreshRates();

OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Orange);

Print("Prot. Level 4 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_416) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +

" Profit : $ " + DoubleToStr(OrderProfit(), 2));

}

if (TimeCurrent() - OrderOpenTime() > 60 * LimitTime_5 && Bid >= OrderOpenPrice() - pips_5 * gd_424) {

RefreshRates();

OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Orange);

Print("Prot. Level 5 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_416) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +

" Profit : $ " + DoubleToStr(OrderProfit(), 2));

}

if (DayOfWeek() == 5 && Hour() >= 16) {

RefreshRates();

OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Orange);

Print("Prot. Level 5 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_416) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +

" Profit : $ " + DoubleToStr(OrderProfit(), 2));

}

}

if (OrderType() == OP_SELL && OrderMagicNumber() == g_magic_296) {

if (TimeCurrent() - OrderOpenTime() > 60 * LimitTime_1 && TimeCurrent() - OrderOpenTime() < 60 * LimitTime_2 && Ask <= OrderOpenPrice() - pips_1 * gd_424) {

RefreshRates();

OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Orange);

Print("Prot. Level 1 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_416) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +

" Profit : $ " + DoubleToStr(OrderProfit(), 2));

}

if (TimeCurrent() - OrderOpenTime() > 60 * LimitTime_2 && TimeCurrent() - OrderOpenTime() < 60 * LimitTime_3 && Ask <= OrderOpenPrice() - pips_2 * gd_424) {

RefreshRates();

OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Orange);

Print("Prot. Level 2 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_416) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +

" Profit : $ " + DoubleToStr(OrderProfit(), 2));

}

if (TimeCurrent() - OrderOpenTime() > 60 * LimitTime_3 && TimeCurrent() - OrderOpenTime() < 60 * LimitTime_4 && Ask <= OrderOpenPrice() - pips_3 * gd_424) {

RefreshRates();

OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Orange);

Print("Prot. Level 3 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_416) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +

" Profit : $ " + DoubleToStr(OrderProfit(), 2));

}

if (TimeCurrent() - OrderOpenTime() > 60 * LimitTime_4 && TimeCurrent() - OrderOpenTime() < 60 * LimitTime_5 && Ask <= OrderOpenPrice() + pips_4 * gd_424) {

RefreshRates();

OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Orange);

Print("Prot. Level 4 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_416) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +

" Profit : $ " + DoubleToStr(OrderProfit(), 2));

}

if (TimeCurrent() - OrderOpenTime() > 60 * LimitTime_5 && Ask <= OrderOpenPrice() + pips_5 * gd_424) {

RefreshRates();

OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Orange);

Print("Prot. Level 5 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_416) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +

" Profit : $ " + DoubleToStr(OrderProfit(), 2));

}

if (DayOfWeek() == 5 && Hour() >= 16) {

RefreshRates();

OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Orange);

Print("Prot. Level 5 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_416) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +

" Profit : $ " + DoubleToStr(OrderProfit(), 2));

}

}

}

}

CloseAll();

double l_icustom_52 = iCustom(Symbol(), PERIOD_M1, "MA_AngleZeroSigma", MA_AngleZero_PERIOD, 1, 0, 0.2, 6, 0, 9, 1, "", "", 4, 0);

if (IsTradeTime() && IsTradeTimeA()) {

if (l_count_16 <= MaxTrades) {

if (g_bars_300 != Bars) {

g_count_272 = 0;

g_bars_300 = Bars;

}

RefreshRates();

if (Ask - Bid < MaxSpread * gd_424 && li_44 && g_count_272 <= MaxTradePerBar) {

if (l_count_8 < 1 && l_icustom_52 <= -0.12 && Bid <= gd_388 - OPFromFractal * gd_424 && GetSignal(0) == 1) {

if (AccountFreeMarginCheck(Symbol(), OP_BUY, GetLots()) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) Print("We have no money.Reduce your Lots! Free Margin = ", AccountFreeMargin());

else {

if (Hidden_TP == TRUE && Hidden_SL == FALSE) l_ticket_20 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, Slippage, Ask - SLB * gd_424, 0, Expert_Name + " " + Symbol(), g_magic_296, 0, Blue);

else {

if (Hidden_TP == TRUE && Hidden_SL == TRUE) l_ticket_20 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, Slippage, 0, 0, Expert_Name + " " + Symbol(), g_magic_296, 0, Blue);

else l_ticket_20 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, Slippage, Ask - SLB * gd_424, Ask + TP * gd_424, Expert_Name + " " + Symbol(), g_magic_296, 0, Blue);

}

if (l_ticket_20 > 0) g_count_272++;

}

gi_unused_308 = TRUE;

}

if (l_count_8 > 0 && l_count_8 < MaxTradePerPosition && l_icustom_52 <= -0.12 && g_ord_open_price_276 - Bid >= Range_OP * gd_424 && Bid <= gd_388 - OPFromFractal * gd_424 &&

GetSignal(0) == 1) {

if (AccountFreeMarginCheck(Symbol(), OP_BUY, GetLots()) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) Print("We have no money.Reduce your Lots! Free Margin = ", AccountFreeMargin());

else {

if (Hidden_TP == TRUE && Hidden_SL == FALSE) l_ticket_20 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, Slippage, Ask - SLB * gd_424, 0, Expert_Name + " " + Symbol(), g_magic_296, 0, Blue);

else {

if (Hidden_TP == TRUE && Hidden_SL == TRUE) l_ticket_20 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, Slippage, 0, 0, Expert_Name + " " + Symbol(), g_magic_296, 0, Blue);

else l_ticket_20 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, Slippage, Ask - SLB * gd_424, Ask + TP * gd_424, Expert_Name + " " + Symbol(), g_magic_296, 0, Blue);

}

if (l_ticket_20 > 0) g_count_272++;

}

gi_unused_308 = TRUE;

gi_unused_304 = FALSE;

}

if (l_count_12 < 1 && l_icustom_52 >= 0.12 && Ask >= gd_388 + OPFromFractal * gd_424 && GetSignal(1) == 1) {

if (AccountFreeMarginCheck(Symbol(), OP_BUY, GetLots()) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) Print("We have no money.Reduce your Lots! Free Margin = ", AccountFreeMargin());

else {

if (Hidden_TP == TRUE && Hidden_SL == FALSE) l_ticket_20 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, Slippage, Bid + SLB * gd_424, 0, Expert_Name + " " + Symbol(), g_magic_296, 0, Red);

else {

if (Hidden_TP == TRUE && Hidden_SL == TRUE) l_ticket_20 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, Slippage, 0, 0, Expert_Name + " " + Symbol(), g_magic_296, 0, Red);

else l_ticket_20 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, Slippage, Bid + SLB * gd_424, Bid - TP * gd_424, Expert_Name + " " + Symbol(), g_magic_296, 0, Red);

}

if (l_ticket_20 > 0) g_count_272++;

}

gi_unused_304 = TRUE;

}

if (l_count_12 > 0 && l_count_12 < MaxTradePerPosition && l_icustom_52 >= 0.12 && Ask - g_ord_open_price_284 >= Range_OP * gd_424 && Ask >= gd_388 + OPFromFractal * gd_424 &&

GetSignal(1) == 1) {

if (AccountFreeMarginCheck(Symbol(), OP_BUY, GetLots()) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) Print("We have no money.Reduce your Lots! Free Margin = ", AccountFreeMargin());

else {

if (Hidden_TP == TRUE && Hidden_SL == FALSE) l_ticket_20 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, Slippage, Bid + SLB * gd_424, 0, Expert_Name + " " + Symbol(), g_magic_296, 0, Red);

else {

if (Hidden_TP == TRUE && Hidden_SL == TRUE) l_ticket_20 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, Slippage, 0, 0, Expert_Name + " " + Symbol(), g_magic_296, 0, Red);

else l_ticket_20 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, Slippage, Bid + SLB * gd_424, Bid - TP * gd_424, Expert_Name + " " + Symbol(), g_magic_296, 0, Red);

}

if (l_ticket_20 > 0) g_count_272++;

}

gi_unused_304 = TRUE;

gi_unused_308 = FALSE;

}

}

}

if (l_icustom_52 < 0.1 && l_icustom_52 > -0.1) {

gi_unused_308 = TRUE;

gi_unused_304 = TRUE;

}

}

return (0);

}

 

int GetSignal(int ai_0) {

bool li_ret_4 = FALSE;

int li_8 = 0;

int li_12 = 3;

if (Digits == 5 || Digits == 3) li_8 = 10 * li_12;

else li_8 = li_12;

if (ai_0 == 0) {

if (Ask <= NormalizeDouble(iMA(Symbol(), PERIOD_M5, IMA_PERIOD, 0, MODE_SMA, PRICE_OPEN, 0), Digits) - gd_424 * li_8) li_ret_4 = TRUE;

} else {

if (ai_0 == 1)

if (Bid >= NormalizeDouble(iMA(Symbol(), PERIOD_M5, IMA_PERIOD, 0, MODE_SMA, PRICE_OPEN, 0), Digits) + gd_424 * li_8) li_ret_4 = TRUE;

}

return (li_ret_4);

}

 

void CloseAll() {

for (int l_pos_0 = OrdersTotal() - 1; l_pos_0 >= 0; l_pos_0--) {

OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES);

if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_296 && OrderCloseTime() == 0) {

if (SecurProfit() == 1) {

if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Blue);

if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Red);

} else {

if (IsTradeTime()) {

if (OrderType() == OP_BUY && (OrderOpenPrice() - Bid) / gd_424 > SLA) OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Blue);

if (OrderType() == OP_SELL && (Ask - OrderOpenPrice()) / gd_424 > SLA) OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Red);

} else {

if (Hidden_SL == TRUE)

if (OrderType() == OP_BUY && (OrderOpenPrice() - Bid) / gd_424 > SLB) OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Blue);

if (OrderType() == OP_SELL && (Ask - OrderOpenPrice()) / gd_424 > SLB) OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Red);

}

}

}

}

}

 

void ForceCloseAll() {

for (int l_pos_0 = OrdersTotal() - 1; l_pos_0 >= 0; l_pos_0--) {

OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES);

if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_296 && OrderCloseTime() == 0) {

if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Blue);

if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Red);

}

}

}

 

bool IsTradeTime() {

if (OpenHour < CloseHour && TimeHour(TimeCurrent()) < OpenHour || TimeHour(TimeCurrent()) >= CloseHour) return (FALSE);

if (OpenHour > CloseHour && (TimeHour(TimeCurrent()) < OpenHour && TimeHour(TimeCurrent()) >= CloseHour)) return (FALSE);

if (OpenHour == 0) CloseHour = 24;

if (Hour() == CloseHour - 1 && Minute() >= gi_292) return (FALSE);

return (TRUE);

}

 

int IsTradeTimeA() {

if (DayOfWeek() == 5 && Hour() >= CloseHour) return (0);

return (1);

}

 

double GetLots() {

double ld_ret_0;

double ld_8;

int li_16;

double l_lotsize_20 = MarketInfo(Symbol(), MODE_LOTSIZE);

double ld_28 = NormalizeDouble(MarketInfo(Symbol(), MODE_LOTSTEP), 2);

double ld_36 = NormalizeDouble(MarketInfo(Symbol(), MODE_MARGINREQUIRED), 4);

if (ld_28 == 0.01) li_16 = 2;

else {

if (ld_28 == 0.1) li_16 = 1;

else li_16 = 0;

}

gi_416 = li_16;

if (LotsOptimized == TRUE) ld_ret_0 = NormalizeDouble(AccountFreeMargin() * Risk / l_lotsize_20 / MaxTrades, gi_416);

else ld_ret_0 = Lots;

double ld_44 = NormalizeDouble(MarketInfo(Symbol(), MODE_MINLOT), 2);

double ld_52 = NormalizeDouble(MarketInfo(Symbol(), MODE_MAXLOT), 2);

if (gi_416 == 2) ld_44 = 0.01;

if (gi_416 == 1) ld_44 = 0.1;

if (gi_416 == 0) ld_44 = 1;

if (ld_ret_0 < ld_44) ld_ret_0 = ld_44;

if (ld_52 > MaxLots) ld_8 = MaxLots;

else ld_8 = ld_52;

if (ld_ret_0 > ld_8) ld_ret_0 = ld_8;

return (ld_ret_0);

}

 

double TickValue() {

double ld_0 = NormalizeDouble(MarketInfo(Symbol(), MODE_TICKVALUE), Digits);

return (ld_0);

}

 

int SecurProfit() {

bool li_ret_0 = FALSE;

if (OrderProfit() > TickValue() * GetLots() * TP) li_ret_0 = TRUE;

return (li_ret_0);

}

 

double SetPoint() {

double ld_ret_0;

if (Digits == 5 || Digits == 3) ld_ret_0 = 0.00001;

else ld_ret_0 = 0.0001;

return (ld_ret_0);

}

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...