Expert Advisors and Automated Trading - page 509

Hi guys, I'm still having problem with my trailing stops. The stoploss level is supposed to be changed only if the price minus the trailing stop point is greater than the existing stoploss point. But in my program, the stop loss is being adjusted as I can see it in the visual tester. The problem...
Hello, my question is about the order of prices in price arrays passed to OnCalcuate. I know, there are many tags for this subject, however, my problem is this: Now the problem: The sample below outputs on each tick CURRENT close and also "as series". I thought §as series§ means that LATEST...
Hello, within an indicator i tried to use CiMomentum. #include <Indicators\Oscilators.mqh> CiMomentum cMomentum;void OnInit(){     cMomentum.Create(Symbol(),Period(),my_period,PRICE_MEDIAN);}int OnCalculate (const int rates_total, // size of input...
Hey Guys i have a little piece of code thats saving the current position open price on a text file with the following code: int file = FileOpen(BOTMagic_Number+".txt", FILE_WRITE|FILE_ANSI, ','); if (file != INVALID_HANDLE) { FileWrite(file, pricenow.bid);...
Hello MetaQuotes, - when i do a backtest, TERMINAL_DATA_PATH returns a location below tester -> tester..../mql5/.. where no expert advisor located. - when applying EA to a chart, TERMINAL_DATA_PATH  returns a location below terminal -> terminal   So in different situations  TERMINAL_DATA_PATH...
Hello MetaQuotes, I am currently preparing a flexible framework for multicurrency EA for the ATC2012 and therefore I would like to ask for clarification on event handling mechanism in MT5. The general info about the event handling is: A client terminal sends new events to the corresponding open...
StringConcatenate error in MetaTrader 5.00 Build 687, when output string was not initialized yet, and at least one of the parameters is an imported function with string return type. (tested with Strategy tester) example code fragment #import ...string getCmdStr( int cmd);// ...string s1;...
Hey all, I'm a total noob and just experimenting for now. Been playing with, and learning strategies, but I am having issues with using the envelopes indicator . Given the following code, my upper and lower values are getting output as exactly the same. Any help would be really appreciated
Hey there, Ive been writing EAs for some time now, i was programming a new MTF EA, I was trying to test it in the visualization mode cuz its easier to spot wrong entries there, but when i start testing and get to 2012.01.02 23:45 (M15) it just stops creating bars.. heres the screenshot hope anyone...
Hey there: Before this build i was able to copy indicator buffers the way the first code is written, after this build i starteg getting the error 4807 when i ran the strategy tester, so i decided to debug the code to see which one of the indicators i was having trouble with, so i re wrote the code...
Hello MetaQuotes, What is a practical difference when symbol has either SYMBOL_TRADE_EXECUTION_MARKET or SYMBOL_TRADE_EXECUTION_EXCHANGE? The other question is - what is the proper price that I should use for them? SYMBOL_LAST?
Hello, Could anyone please clarify when exactly are the following deal types used?? I have searched the forum, articles and reference, but didn't find an exact answer. DEAL_TYPE_BALANCE DEAL_TYPE_CREDIT DEAL_TYPE_CHARGE DEAL_TYPE_CORRECTION In particular I am...
How do I write a script of lots in the EA to comply with the rules of the ATC 2012. That rule no IV.6 and IV.6. IV.4. The minimum trading amount is 0:01 lots, and the maximum is 5 lots, with an increase of by 0.01 lot on every order. IV.6. The maximum allowed total volume of an open positions...
Hello, is it possible to get a list of all trades from along with profit (wihout having set a stop or profit target) and then to double click on trade and chart scrolls to this trade ? I found list of trades only when visualization enabled but no method to find trade in chart automatically. Also...
Good! I'm new to MQL4 programming and mql5 and I liked to obtain values ​​for purchase / sale of the EURUSD. I wanted to show these values ​​in the graph window EURUSD currency. Is this possible? I tried obtrer values ​​using the following code:   MarketInfo double price = ("EURUSD", Bid); double...
  Sad story  (71   1 2 3 4 5 ... 7 8)
Dear friends, programmers. A sad story has happened to me. I have a trading strategy that I have been using for a long time. So I decided that it's time to create an EA using it. But! Shit. If I am so stupid that I can't explain how it works, or the programmers I have written to are not so sure
Hello, i thought that strategy tester automatically loads data from server which are needed for backest and stores those data locally and permanently (so new download of same data not required). This seems not to be the case. When do a backttest for EURUSD 5 Minutes from 2005 to today, i get data...
Hi everyone, I just modified my first EA from a tutorial. Everything went smoothly, it compiled with no errors, and it places trades! (yay!) However the STP and TKP values are never triggered in the strategy tester (which means that all trades are closed at the end of the experiment). I've looked...
  question  (1)
In an expert adviser, in the OnTick() function, is there a way to set a global variable that will retain its value it had during the previous call? I'm looking for a variable that won't re-initialize with each new tick.
I'm just wondering if there is any difference between the two lines of code below.... (for calculating the spread) 1: double Spread_1=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK) - SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); _______________ 2: MqlTick current_price; double...
I've been encountering problems with backtesting in the metatrader 5 platform specifically entering Stoploss and take profit levels similar to the problems raised by some members before: https://www.mql5.com/en/forum/7012 I'm currently using Alpari's MT5 platform and couldn't backtest properly...
Like in the topic - does anyone know? Unfurtunately CList and CArrayObj from the standard library don't allow struct type.
Hello MetaQuotes, Just came up with a suggestion - could you consider ehancing the OnTrade() event handler? The solution that I propose is having OnTrade(ENUM_TRADE_EVENT_TYPE &event_type), which would allow MQL5 programmers to handle particular trade events (e.g. stop loss/take profit...
I've read the documentation, and looked at some examples of code, but still not sure what this guy does. Help! Is it the same as _Digits?
Hello, how to obtain datetime from currently simulated bar when backtesting EA. Thank you 
Function OnTest allows to retrieve some results from backtest by calling function TesterStatistics. I miss some properties, like: a) start -and end date (custom period) b) optimization c) simulation (tick, OHCL,etc..) d) execution Anyone knows how to get this programmatically ? Thank...
Dear all, I have difficulty to write this martingale function from MQL4 to MQL5. Please help me to convert this script to MQL5. double Calculate_Lots(){   double lots=Lots;   double MinLots=NormalizeDouble(MarketInfo(Symbol(),MODE_MINLOT),2);   double MaxLots=NormalizeDouble(MarketInfo(Symbol()...
I am looking for a developer to create a customized Expert Trader that I can utilize while not at my desk. It is based on the convergence/divergence of two MA levels, while having the ability to buy/sell in various increments using a couple of indicators as support. I would also like the ability for...
Hi guys, I've been exploring the strategy tester and playing with some EAs in the article and code base sections. When I backtest an EA for the first time and change the parameters for the second backtesting (e.g. stoploss,takeprofit,etc) the outcome does not change. Here's the screenshot of the...
I'm just confused, it appears to me that both CTrade and MqlTradeRequest can be used to place a trade independently. Is this true? And if so, is one better that the other?