Expert Advisors and Automated Trading - page 352

How do I code my EA to collect the last closed order's profit/loss? I can track the p/l for live orders, and if I close the order, I can collect the data... but if the system closes the order... for whatever reason... I don't know how to collect the data. Chuck
Hello friends, I'm looking for some custom codes, it will be very helpful for me if any one provides me. I have already created an EA but I'm have to make some changes in it. I'm looking for simple codes. 1) The order should open only if LAST CLOSED TRADE LOT size is X (Variable). 2) The order...
Good morning, I have an EA that I created and have been using it for the past year but now I'm trying to make it "better" and one of the things that I need to do is find a better way to add orders. Today, I use the MqlTradeRequest and MqlTradeResult so I can add order, but by using that, sometimes a...
Hi everyone, I am completely new to the idea of coding. I have tried to look at videos and learn it myself, but it will take some time. I am trying to figure out if the following is possible to be coded: An EA that works on any time frame,, An EA that works on all currencies,, Utilising the...
Hello.... I recently started experimenting with MQL5 and the following happens to me ... According to what I know ... it should be in 1, but it never leaves 2. OnInit()   ObjectCreate(StringToInteger(_Symbol),"1EstadoSuperiorLavel",OBJ_LABEL,0,0,0);   ObjectSetString(0,"1EstadoSuperiorLavel"...
Is there any EA that can close (or move the stop loss) to a level when all my open trades have reached a certain % profit for the day. Let's say I have $500 in my account and make some manual trades or EA's. I want them to secure all trades when they have reached more than 2% profit. So, if the...
Hello, i am using Dukascopy files exported with tickstory in MT5 with custom Symbol. Now when i want to start testing in Strategy Tester i get following error: 2018.04.10 22:56:53.525 Core 1  EURUSD_test: symbol to be synchronized2018.04.10 22:56:53.525 Core 1  EURUSD_test: symbol synchronized, 3464...
Is this normal that OnTick (and start) function in EA does not work on weekend ? OnTick (and start) works fine in Strategy tester but not in live mode. I expected it to work at least once even it is weekend. I am not sure if this is normal behaviour or particular to my own MetaTrader. I checked...
Hello friends, I am running an EA on one of my accounts on activtrades, and at least once a week I get a "4752 error" message, I searched and the error means "Trading by Expert Advisors prohibited" I contacted  activtrades and they did not inform me anything besides that the problem is not with them...
Hi can anyone share the code for the following problem Problem statement :  Need to place a SL on new high (when candle closes at new high ) the sell position must be close
Hi, my EA moves stop levels. However, once the stop level is very close to POSITION_PRICE_OPEN, any further attempt to move the stop level results in ERROR 4756 Trade request sending failed. I assume the problem has something to do with either SYMBOL_TRADE_STOPS_LEVEL or SYMBOL_TRADE_FREEZE_LEVEL...
Good day to everyone. I have an indicator here that shows arrows in my chart. If the arrows pointin up then i will buy and if the arrows pointing down then i will sell. I try to attach it in my EA but when i try it on the tester, when the arrow appears and pointing up...it Opens a multiple buy...
Before I submit this to Help-desk can someone tell me if this is a legitimate a compiler bug? This only happens on MQL5, not on MQL4. #include <Strings\String.mqh>//+------------------------------------------------------------------+class String1 : public CString {public:   template<typename...
  CopyTicks question  (12   1 2)
Hello all, I'm trying to get the TICK_FLAG_BUY and TICK_FLAG_SELL information from 'flags' in MqlTick struct provided by the CopyTicks fuction on a custom indicator but it seems I never get that information from this function. The Symbol I'm testing it has Times & Sales enabled and this information...
Hi I'm getting the following errors when declaring a multi dimensional array, And I don't now why, Just started coding with MQL5 Thank you
Hi, I am trying to overload the Assignment Operator as this demonstrates, but regardless of what I have tried, my overload in my class is completely ignored. Here is the Object class that I have defined... class Object{    public:        Object();        ~Object();        int value;        void...
Dear all, please help me with an issue I faced in the very beginning of my code. Please, have a look at the image below. When I try to declare a global variable  (type bool) and compile the program, I receive a strange error: 'bool' - name expected I tried to search more info about that error in the...
  GoldWarrior EA (Zigzag Trading System)  (90   1 2 3 4 5 ... 8 9)
Please find attached the GoldWarrior EA created by Tartan, Nemo and others for MT3, converted to MT4 by Star and improved and fixed the errors by Beluck. And be informed that this EA is working together with DayImpuls indicator attached. There are many versions of DayImpuls indicator. This EA is
Hello, I have an EA which slow but steady turns buy/sell trades into losses. I want to switch buy orders into sell and sell into buy. there is that search function in the meta editor. if I know rewrite all 'buy' into 'sell' and the other way round, will that be enough?! -I have standard market...
[Deleted]
Dear Metatraders,  I am trying to write a code in MQL5 that will allow me to calculate the current profit on all my open trades, In back-testing, the OrdersTotal() is giving me 0 knowing that I have multiple open trades,  Any idea what seems the problem ? Many Thanks
Hello, I created a Custom Symbol and imported BARS and TICKS. That's okay then. But when running a backtest I noticed that the High Ask and Low Bid lines were not correct and when checking the High Ask and Low Bid values ​​are always ZERO. But if I did the same with a Symbol other than...
[Deleted]
  Ghost-functions?  (11   1 2)
It sounds a bit sarcastic, maybe impossible to do as well, but if you can give any trick/workaround, please have a look!  (the red-colored lines gives you details of the areas in discussion). The goal is to : not to import functions, not to define functions in global scope, either....
I am trying to typify a template function with an object pointer like you can see below. But I always get "invalid pointer access". //+------------------------------------------------------------------+//| Class...
When I include symbolInfo.mqh, it causes errors (attached).  Most of the errors says, "const modifier not allowed for nonmember functions".  So far, I have the below: #include <Trade\Trade.mqh>#include <Trade\SymbolInfo.mqh>#include <Trade\PositionInfo.mqh>#include <Trade\AccountInfo...
I have developed a 1 hour ea that works fine, however I am looking to add to positions if they are trade positive by x pips over the 5 minute time frame. I am having trouble trying to work out a simple way of configuring this: double PriceAdjust=(iHigh(NULL,PERIOD_M5,1)+iLow(NULL,PERIOD_M5...
For some reason I can't find a solution. I am trying to declare an optional MqlParam parameter In a method: void F(MqlParam &parm=NULL)    // here the = is not accepted because it's a reference parameter. I try to make the parameter optional { } but the compiler will not accept an assignment to a...
Hello, English isn't my native language, but I'll try to get by.. I'm a little bit new to mql4, but have been trying to get everything going, I was testing an idea, then I needed to test a progressive lot size, my EA opens one trade at a time, so I wanted to check if the previous closed trades hit...
I get the following warnings when I try to run a backtest on a simple EA. If you have any ideas about why I am getting these messages please let me know. Is there a resource that defines these error messages? Thank You
Hi, I wrote an ea and have run an optimization on Period 1 ( In Sample)   How can I test all the strategies on Period 2 (Out of Sample) at once, without having to do it manually for each of them. Is there a tool, software etc.. tha provides this feature ? Thank You,
Hello, I have this EA that auto change the timeframe every 5 seconds (M1-M5-M15-M30-H1) This is almost perfect, but I have one request, can you please help me edit this so that it change the timeframe of all pairs. Because apparently it only change the timeframe of attached pair. Thank you very much...