Download MetaTrader 5

MQL4 and MetaTrader 4 - page 150

To post a new topic, please log in or register
Using MQL4, how can I execute a BUY order (seen below) if one variable x has a value of 1 and another variable y has a value of 3? I need it to work like this: Variable x = 1 Variable y = 3 So if x is MORE THAN y, execute this script: extern int TakeProfit = 10;extern int StopLoss = 10;void...
Hi guys! I’m looking for a function that returns if the last trade was a win or lose trade. In other words, if the price hit the take profit or the stop loss of the last trade. If someone decide help me, so, PLEASE, give-me a function that you have sure that work correctly, because I’m not...
Hello guys.   I need to change the computer clock to the broker time automatically.  I now i  has to import kernel32.dll and use SetSystemTime function, but don't know about the parameters of this function.  Does anyone know how to use it? 
Hi guys! I’m looking for a function that returns the number of consecutive profitable trades until X victories. When the number of profitable trades hits the X value, so the count is restarted. If someone can help me... thx!!!
How can I fetch a newly released economic calendar value and set it as an 'extern int'? Is it possible in MQL4? For example, if I needed the latest value of the UK Bank of England Interest Rate, could I fetch the latest figure the second (or near the time) it was released? 
double last_order_profit(int magic){    for(int i=OrdersHistoryTotal();i >= 0;i--)     {              OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);          if (OrderMagicNumber() == magic){                        break;         }      }    return OrderProfit();}  
Hi,   my EA does not write all logged-defined entries in the expert log files. The curious is this: (1) In the strategy tester all log entries are 100% correctly and 100% completely entered into log files (expert/logs). (2) But most log entries on demo or live accounts are simply omitted. Maybe 90%...
Hello, fellow coders! I have an indicator that shows me the price difference between the newest candles open and 21st candle close. This is working fine except for one crucial thing - it doent update with the chart. It keeps showing the value for when it was first added to the chart. I have tried to...
double last_order_Type(int magic){    for(int i=OrdersHistoryTotal();i >= 0;i--)     {              OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);          if (OrderMagicNumber() == magic){                        break;         }      }    return OrderType();}  
hi i   need   30   20  sec,  chart   in   meta4   how  i can get  this  plz   reply
//+------------------------------------------------------------------+#property version   "1.00"#property strict#property indicator_chart_window#property indicator_buffers 5//---Indicator Colours#property indicator_color1 clrGreen//up arrow#property indicator_color2 clrRed//down arrow#property...
Right click chart window > Properties > Common > Scale Fix One to One I assumed this chart feature is new, possibly in the latest 1010 build of MT4.  I have always had issues when I leave my charts unattended, I come back and the market has made a huge move up or down, and the candles are partially...
Hi guys, here i am again to ask you an help. As in subject i wish EA close trades after X minute if position is in loss. So i write the following code: void exitloss(){  int ExpireX=60*MaxHour;   for(int cnt=0; cnt<OrdersTotal(); cnt++)      {        if(OrderSelect(cnt,SELECT_BY_POS...
Hi   i'm trying to create a virtual multi-currency backtesting tool in MT4.   I have an issue with iMA(). as far as i know, iMA uses Close[0] in its computation, meaning the tick data, but when i try to compute iMA on other pair than the one selected in the Strategy Tester, i have constant outputs...
I am using SMA 50 and SMA 200 on Daily Time frame. I want to use the same SMA 50 and 200 values from opening 15 min time frame. Is this possible? if yes, please let me know the exact value for 50SMA and 200 SMA? Thanks in Advance!
Good day, I'm beginner in MQL 4 and building my first EA. I want that the EA will buy or sell everyday from 9:00 to 10:59 depends on High and Low of H1 candle starting at 8:00 same day and sell it if it reaches the stoploss or profit target. It is actually working in that time, but sometimes it is...
Hello guys, good day all. I want to assign economic data to a variable as soon as they are released in order to incorporate same to my auto trading strategy. By so doing I want to be able to program my EA to either buy or sell when a number of released economic data meet certain conditions. This is...
Hi ,   I work on EA and I block and I hope your help how to find the maximun price between the point where it hit take profit level  and the stop loss level  as shown in the picture thank you very much    
<Spam content removed>
Please help add text to the line on the right side. Thank you in advance for your help.  
Hi all, Which broker provides the furthest historical data? i am using a broker now but it only provides till year 2000 on Monthly time frame. Thank you!
Hi guys, This code #define N_ARRAY 5   int myArray[];   ArrayResize(myArray,N_ARRAY);   Print("Before: ",myArray[0],"/",myArray[N_ARRAY-1]);   ArrayFill(myArray,0,WHOLE_ARRAY,7);   Print("After: ",myArray[0],"/",myArray[N_ARRAY-1]);  gives 0/0 in "After" line. But this code #define N_ARRAY 5   int...
Hi guys, i'm new and I need your help. I'm writing an EA and I want close position at market after xx hours (maxHour value) if i'm NOT at breakeven..So i wrote like this (long example) for (int i = OrdersTotal() - 1; i >= 0; i--)         {if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))...
Hi,   I have this MT4 indicator that shows me Open to High difference at top of the candlestick. What I need is that it should also show me Open to Low  difference at the bottom of the candlestick. Is there someone who could do this for me and may be suggest an Indicator that already has this...
I have an EA that only works on H1 timeframe, is there a way to: - Automatically change timeframe to H1 when EA is attached succesfully to a chart? - Disable the abiility to change timeframe while the EA is attached to a chart. Thank you very much!
Hi, İf I use ordersend via EA. I take 4112 error. Is there any way to hide auto trading from server. So server would not be unerstand that trade process is from manuel or auto
Hi   I use Rate of Change ( RoC ) in my trading and have recently had to delete and then reload MT4 to my pc due to some issues I was experiencing with my PC.   However since then, when I draw trendlines over the RoC in the bottom pane of my chart the trendline only stays for a couple of seconds...
"I've learned more about online trading of forex and stocks through Ask Mario Singh blog. He personally answers questions daily and give great insights for anyone to learn stock market easily. You may want to check him out. Edited by moderator: Please respect the rules : "Posting of advertising...
Hi For real trading the answer is obvious - fixed risk per trade, but what with backtesting? Wont it distort the results of EA? For the purpose of rating the EA which method is better?