Download MetaTrader 5

Universal MA Cross EA - page 65

kavklov
4
kavklov  

Daily profit limit add on to EA.

Hi everybody,

I would like to know if someone could add the feature bellow, to the UMA cross EA attached.

extern string DayProfitHelp = "--Enter either DayProfitLimit in USD or DayProfitLimitPct in percent of last day balance. Set both 0 to disable.";

extern double DayProfitLimit = 0.0;

extern double DayProfitLimitPct = 0.0;

extern int DayProfitResetHour = 0;

extern bool DayProfitGlobal = FALSE;

I found this function very handy on another EA, and basically what it does is to stop the EA opening orders if a "x%" has been hit before the Stop time.

Also the trailing features is not working properly on the UMAcrossEA. If someone could help I appreciate.

Thks very much

===============================

extern int SL_pips = 290;

extern int MA_distance_pips = 20;

extern int MA_period = 16;

extern int TP_pips = 20;

extern int TradeVolume = 1;

extern string HourTradeHelp = "--Set if EA will work only on a specific period of the day. ForceClose will close all open orders.";

extern bool UseHourTrade = FALSE;

extern int StartHourTrade = 21;

extern int EndHourTrade = 3;

extern bool ForceClose = FALSE;

extern string MinToKeepTradeHelp = "--Will close the order once its life time is grater than MinutesToKeepTrade. Set 0 to disable.";

extern int MinutesToKeepTrade = 0;

extern string DayProfitHelp = "--Enter either DayProfitLimit in USD or DayProfitLimitPct in percent of last day balance. Set both 0 to disable.";

extern double DayProfitLimit = 0.0;

extern double DayProfitLimitPct = 0.0;

extern int DayProfitResetHour = 0;

extern bool DayProfitGlobal = FALSE;

extern int ModifyIntervalMin = 1;

extern int MagicNumber = 2265;

extern bool Hedge=false;

int g_ord_total_172;

int g_ticket_176;

int g_ticket_180;

int g_minute_184;

bool g_bool_188;

bool gi_192;

bool gi_196;

bool gi_200;

bool gi_204;

double g_price_208;

double gd_216;

double g_price_224;

double gd_232;

double gd_240;

double gd_248;

double gd_256;

double gd_264;

double gd_272;

double gd_280;

double g_ima_288;

double gd_296;

double gd_304;

double gd_312;

double g_lots_320;

void init() {

gd_240 = MarketInfo(Symbol(), MODE_STOPLEVEL);

gd_256 = gd_240 * Point;

gd_248 = (gd_240 + 1.0) * Point;

gd_216 = SL_pips * Point;

gd_232 = MA_distance_pips * Point;

gd_280 = TP_pips * Point;

g_minute_184 = Minute();

}

int start() {

double ld_8;

double ld_16;

if (AccountBalance() - gd_304 != 0.0) ld_8 = 100.0 * (gd_304 / (AccountBalance() - gd_304));

else ld_8 = 0;

if (AccountBalance() - gd_304 != 0.0) ld_16 = 100.0 * ((AccountBalance() - gd_304 + gd_312) / (AccountBalance() - gd_304)) - 100.0;

else ld_16 = 0;

gd_296 = Ask - Bid;

gd_304 = GetDailyProfit();

g_lots_320 = Lots();

if (DayProfitLimitPct > 0.0) gd_312 = (AccountBalance() - gd_304) * (DayProfitLimitPct / 100.0);

else gd_312 = DayProfitLimit;

g_bool_188 = !(UseHourTrade && !IsTradeTime(StartHourTrade, EndHourTrade));

if (g_bool_188 && GlobalVariableGet("gISEAStop") == 1.0) g_bool_188 = FALSE;

string ls_0 = "Symbol: " + Symbol()

+ "\nSpread: " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD) / 10.0, 1) + " pips"

+ "\nDaily P/L: $" + DoubleToStr(gd_304, 2) + " (" + DoubleToStr(ld_8, 2) + "%)"

+ "\nLimit P/L: $" + DoubleToStr(gd_312, 2) + " (" + DoubleToStr(ld_16, 2) + "%)"

+ "\nCurrent P/L: $" + DoubleToStr(AccountProfit(), 2)

+ "\nStop Level: " + DoubleToStr(gd_240 / 10.0, 1) + " pips"

+ "\nVolume: " + DoubleToStr(g_lots_320, 1) + " ($" + DoubleToStr(g_lots_320 * MarketInfo(Symbol(), MODE_LOTSIZE), 2) + ")";

if (gd_312 > 0.0 && gd_304 + AccountProfit() >= gd_312) {

Comment(ls_0

+ "\n\nReached daily profit... See you tomorrow... Good night :-)");

RemoveAllOrders(1);

return (0);

}

g_ord_total_172 = OrdersTotal();

gi_192 = FALSE;

gi_196 = FALSE;

gi_200 = FALSE;

gi_204 = FALSE;

for (int l_ord_total_24 = g_ord_total_172; l_ord_total_24 >= 0; l_ord_total_24--) {

if (OrderSelect(l_ord_total_24, SELECT_BY_POS) == TRUE && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {

if (OrderType() == OP_BUY) {

gi_200 = TRUE;

Close_B(OrderTicket(), OrderLots());

}

if (OrderType() == OP_SELL) {

gi_204 = TRUE;

Close_S(OrderTicket(), OrderLots());

}

if (OrderType() == OP_BUYLIMIT) {

gd_264 = NormalizeDouble(OrderOpenPrice(), Digits);

g_ticket_176 = OrderTicket();

gi_192 = TRUE;

}

if (OrderType() == OP_SELLLIMIT) {

gd_272 = NormalizeDouble(OrderOpenPrice(), Digits);

g_ticket_180 = OrderTicket();

gi_196 = TRUE;

}

}

}

if (g_bool_188) {

g_ima_288 = iMA(NULL, 0, MA_period, 0, MODE_LWMA, PRICE_TYPICAL, 0);

Modify_order();

Open_order();

} else {

Files:
tttpp365
10
tttpp365  

TEMA and universal cross

Hi,

can TEMA be added to the universal Cross EA?

Thanks

Files:
gol
15
gol  

Any coder/programmer help code MA cross EA to trade above/below another MA?

Hi,

Any coder/programmer help me to code MA cross EA to trade above/below another MA?

thanks

fixyfixy
8
fixyfixy  

Hi Everyone,

Could somebody look at the picture and explain why the EA opened short and after 2 min changed position despite the fact there is no cross?

Thanks,

FiXy

Files:
1.gif 21 kb
sentaco
355
sentaco  

I will add this to my testing list thanks for the EA

Best regards

Robert
418
Robert  

Need To See All The Settings

fixyfixy:
Hi Everyone,

Could somebody look at the picture and explain why the EA opened short and after 2 min changed position despite the fact there is no cross?

Thanks, FiXy

Hi fixyfixy,

The UniversalMACross EA has many settings with different indicators inside.

Hard to say how that trade happened without seeing ALL the settings.

Hope this helps,

Robert

Paul
14
Paul  

Hi guys, new to EA's and new to this EA

heh.

When I drag this to my MT4 chart, Journal says the EA has been successfully loaded.

When I hit ok, it says EA removed.

Yet the EA information is still on the chart, on the top right and top left.

Is it loaded or no?

Thanks

Paul
14
Paul  

Another question, do you need to have the MA's on your chart for this to work. Or no?

And what is the difference between Fast and Slow MA? Does it matter?

Paul
14
Paul  

Yeah, theres an unhappy face on each of the EA top right corners..

Paul
14
Paul  

Having no success testing this EA on Backtest.

I get.

2011.06.04 23:53:01 2008.12.26 14:00 universalMACrossEA EURUSD,H1: OrderSend error 130

2011.06.04 23:53:01 2008.12.31 16:00 universalMACrossEA EURUSD,H1: Prev : DOWN - Curr : DOWN

Nothing works..