Download MetaTrader 5

MQL4 and MetaTrader 4 - page 305

To post a new topic, please log in or register
error 131. This is the ordersend: OrderSend(Symbol(),OP_BUY,0.01,Ask,3,Ask-500*Point,Ask+500*Point,NULL,0,0, clrNONE); Somebody know what is the error?
Hello, in the working source code below, on lines 74 we see:      ObjectCreate("H4_SMA", OBJ_LABEL, 0, Time[1], H4_SMA);   ObjectSetText("H4_SMA","H4 SMA",14,"Tahoma",Gold);   I would like to modify these lines such that the label is right-justified and all the way to the right on the chart at...
I hav erecently go some invalid stops occurring (Error 130) so thought I'd try the Market info stoplevel command as shown below. I just seem to be getting a value of zero 0.00000000 to be precise. The following code is the 'entire' EA I expect to return a integer number of points. void...
For some reason, the labels "H4 SMA" and "H1 SMA" are not being rendered on the y-axis where the H1 SMA has been calculated.   Instead, they are always rendered at the exact same place on every chart that I put this EA on. How can I get the labels to render at the computed value of the SMA? Source...
Hello everybody, I'm trying desperatedly to get the value of past stochastic values over n amount of bars. The error i get is "'[' array required". Could you please explain me why iStochastic function wouldn't start on a simple for loop? Here is my code. int init(){int i;  int...
I need some help to formulate a code which will close the order exactly at the bar's end.It is for a special scalper EA, so it needs pinpoint precision.Let me illustrate what i mean: Here you can see for example an M15 EUR/USD chart.Now imagine if i had any indicator that took me into a long trade...
Good afternoon, I hope you are fine. I would like to ask wether closing all trades with the following function is FIFO compliant, just to check. Is it enough to iterate trades backwards? For some reason it does not close all trades at the same time. for(int i = 0; i <= OrdersTotal(); i++) Thanks in...
Please let me know how i can post an article into this web site
Hello, I was looking at the backtesting results (1H, every tick) for an EA that performed exceptionally well and saw trades with impossible exit points. I only enter trades on candle closes and let them run until tp/sl. It seemed as though the EA both placed the trade **and took profit** at exactly...
What is the general structure of an EA?   What is wrong in that code? How it is done correctly? when I do the testing, using  "Print (" error ", GetLastError ());" it say "error 4054". But when I give opening that message, the txt says "Error 131". I'm doing this: void OnTick()   {    double TEND1,...
I am using PF12 to scroll forward one bar on my chart and would like to be able to capture that event in an indicator or expert in order to control a second chart to keep them in sync. However, I find that there is no keypress event generated for the pressing of PF12. Is there any way to capture...
Hi all, It's my first post here. I'm starting to learn about EA recebtly, and I've a doubt about time functions. I've been looking for a code that allow to buy/sell at a specific time, but I only found examples that work with a time value of HH:MM. What about seconds? Is it possible to define a...
Could someone link me to the docs for drawLine()? I have searched both this site and google and can find no docs. Thank you.  
Hi, i am trying to write a simple EA, which will close two specified trades when net profit from them both reach specified value. For example i bought EURCAD and sold USDCAD and i want EA to close them both when overall profit would reach 10 pips. I have written that code below but there is a...
From the TimeCurrent() help: "Returns the last known server time, time of the last quote receipt for one of the symbols selected in the "Market Watch" window. " If I understood correctly, I cannot get current time on the broker's server when market is closed.   I would like to calculate time...
Please, anybody know write code EA - "write current price to file"? For example: Pair: EURUSD Filename: EURUSD.txt At all time, on every change (=every second/milisecond) must EA write current sell price of EURUSD to txt file. In file can not be other as price only. For example 1.3520. No more....
hi guys, maybe someone could  tell me please how to do only one trade per bar ? when tp are taken, ea opens another trade on the same bar, I need it to do only one trade per bar... thanks!
With an open trade, you can - with right click - open the trailing stop window and set the trailing stop in points. Does anyone here know, where those settings are stored and how it's possible to read them? I found a file named "trailingstop.ini" in the profiles-folder, but even in case I would read...
Hi I can assign the ticket numbers to the variables and continually check them against the OrderProfit of all the other open orders, but my problem is this.......What if a 2nd hedge group opens while hedge1 is still open? my variables hedge1ticket1 and hedge1ticket2 are already assigned; or worse...
After upgrading to the latest build (604), I am unable to attach my EA's to my charts after a re-compile.
  OrderModify (7)
I am using OrderModify for trailing stops.   The problem is when the stop is => the OrderOpenPrice the order closes at the stop.  How do I get the order to stay open past the order open price?           if(OrderType()==OP_BUY)          {                if(Bid>OrderOpenPrice())                  {...
Hello, after 1.5 Years of programming my EA is ready to start, but i'm still a beginner. Now: I want to trade serveral pairs. How do i manage this ? I think, i have to copy my EA and rename it for every single pair and then open all the Charts and attach the new EAs to them, is that right ? (i.e....
Dear Guys I wrote a code below : extern datetime   TradeOpenDate_1          = "2013.01.02 00:00:00";   It show warring : implicit conversion from 'string' to 'number' Pending.mq4 81 46   How to i am write above code in correct.  Please help me.
Hi, This question, or variants on the theme, seem to keep coming up but I can't find a comprehensive (or correct?) answer. I've looked through the example in the experts\samples directory, but it doesn't really address my specific question. I can see an array of strings being sorted, but I can't...
Could someone help with the following: I want to be able to take a trade and then the following information automatically gets emailed to the email addresses i have placed in the parameters of the script or indicator (maybe room for 10 would be good). It should auto email them the following...
Hello ... I want to ask is there system or ea to send signals from MT4 to several Emails and SMS just when new orders opened or closed ? Thanks
  Ask/Bid line (2)
Morning,  I have the bid and the ask line (red and white) on my currency charts - however, when I open a trade, the price I open at is neither the ask or the bid price.  Is there a way I can get the actual price that the trade will be processed at on my currency charts? Thanks 
Dear Traders & Coders, I am creating a custom indicator with "Bollinger Bands %b" a Trade Should take Above "Bollinger Bands %b" Value 0.8 Level. But I am little confused in coding part , Can any one confirm I did call this indicator in a right way ? iCustom(Symbol(),0,"Bollinger Bands %b",BBPeriod...
orders opened on the screen listing the code numbers ?? I want to help. 
Hi I'm writing an EA that generates a HST in real time. This HST is displayed in a Offline Chart window. When the EA generates a new bar, I'd like to display it to the Chart. So I need to refresh that chart with the new data. Each existing script (based on PeriodConverted) I've read...