MQL4 and MetaTrader 4 - page 541

  Array Problem!  (8)
Hello everyone! I created a simple HeikenAshi pattern and every training I have to insert a horizontal line at the close up and I have to see him in the historic midnight. I can not understand, how can I add a line for each pattern that has already occurred from midnight onwards. Maybe I should use...
//+------------------------------------------------------------------+ //|                                                      MAvsRSI.mq4 | //|                        Copyright 2017, MetaQuotes Software Corp. | //|                                             https://www.mql5.com |...
Hi,  I have some strange issue while using backtester. Here is some code sample:   double ND(double val)   {    return(NormalizeDouble(val, Digits));   } void OnTick()   {    double price=Ask;    double minstoplevel = MarketInfo(Symbol(),MODE_STOPLEVEL)+10;    double...
All; I am testing a robot in Strategy Tester. I set the Max Spread on the robot to 2 pips, and the max slippage to 3 pips. I also have the spread on the tester set to 'Current'. When I run Strategy Tester on the 5 minute EURUSD, I have poor results. When I change the spread on Strategy Tester to '2'...
Trying to figure out how to get random number for use in random lot sizes. Ex: double randNumb = (MathRand()%9)/100; //randmon lot size double LotSize = 0.1 + randNumb;
  Get account info  (9)
     double MarginFree =  AccountInfoDouble(ACCOUNT_MARGIN_FREE);      double Margin =  AccountInfoDouble(ACCOUNT_MARGIN);      double MarginCheck = MarginFree / Margin; When I use this I get a division by zero error.
Hi, any help will be dearly appreciated.   So I had tested a few strategies out which ran on a single Symbol, and analysed data only from a single Period. It was coded so that positions can only be open when there is no open positions of that type already open. while (OMNS5 < T) {  when a position...
Hello guys, i'm building an ea that store PERIOD_M30 mqlRates structure for different symbol and do some statistical calcualtion,  the problem currently is that i need approx 10 000 bar laoded to make my calculation, but the graph has more or less 2000 bars when you laod it the first time or you...
i need help to understand working of EA while Auto Trading button on MT4 is in OFF status EA has three functions; one entry point strategy, move SL to break even and Exit trade at given profit/loss levels. In case trader intends to turn Auto Trading button OFF to avoid opening of excess trades...
Hello Members, This is the standard view of the indicator   Back Testing with Speed 32 shows something like this,   There is a big Gap, Trendline get drawn only for current few bars, not for previous one, is it normal with backtest? Or there is a problem with the coding?   Regards  
Hi, I've got two different EA's both profitable over 2016 on GBPJPY on the 1H timeframe, one returns 267.51 and the other 233.54 yet when amalgamated into a single EA that uses both trading strategies simultaneously (whilst allowing the extra positions to be opened) the return was 269.97. I had
The code should close all orders but not the last opened. Can anyone help me? Thank you very much My code ... void CloseOrders()   {    bool close1=false;    bool delite1=false;    int closez;    RefreshRates();    for(closez=OrdersTotal()-2; closez>=0; closez--)      {       if(OrderSelect(closez...
Hi Guys, Does anyone have an Oanda-v20 live account that has been running EURUSD for more than 6 months on MT4, and are willing to share their history file with me on google drive? I have been running mine since 1 December and the backtesting data is great from then on, but not so reliable before...
  sum of lots  (2)
hello ... at certain price level  (by example for EUR/USD  Bid = 1.0655)  I have active orders (SELL) and pending orders (SELL-STOP )- 2 pending by example  when the pending Orders activated haw i can get the sum of these orders lots ?   
Dear all, I just started learning MQL4 language to support my trades but I have a little question on how to run this very very simple script:     //+------------------------------------------------------------------+ //| OrderBuy Scripts      by ***NicoMax***                           |...
I have a function on an EA (mql4) to set price levels at which not to buy or sell. The function doesn't work correctly, once a threshold has been reached it won't trade at all. Obviously the idea is still to be able to Sell once the High_Level is breached and still be able to Buy when the Low_Level...
Hi,   I have built an expert advisor thanks to ea builder, it is based on fractals breakout strategy. I have set up an open long order when price line closes above the upper fractal line with a stop loss located on the lower fractal line. Short orders are opened when the price line closes below the...
Hello to all I'm writing an ea for mt4, I wanted to open an order with a size dimensioned to 2% risk relative to capital I wrote the following code, when I go to calculate the size, gives me a size of 14 lots, using a demo account by EUR 5,000 and a stop of 50 pips. Obviously it is wrong, you tell...
bool MySelect(int iWhat, int eSelect, int ePool=MODE_TRADES) // MySelect bool initiation, value given below // so I'm thinking to add in a myselect function for Buy and one for Sell.. as i simply dont understand 'return(OrderType() <= OP_SELL);'   {    if(!OrderSelect(iWhat, eSelect, ePool)...
  Error131  (12   1 2)
Hello, I am experiencing the error 131 by using the following code:     if(AccountFreeMarginCheck(Symbol(),OP_BUY,Lots)<=0 || /* NOT_ENOUGH_MONEY */GetLastError()==134)      {       Alert(BalanceErr);       return;      }    else      {       RefreshRates(); double OrderPrice=Ask;...
[Deleted]
  TDI Red Green EA  (10)
Hi Guys, I'm currently working on an EA. I got an TDI Red Green Indicator. Every time there's a cross of both lines, there shall be ONE trade. So if the red line crosses above the green line, there shall be Short trade and every time the red line crosses below the green line there shall be a long...
So im writing a EA that will make use of live trade historical during optimization and i thought of writing the results to a csv when running and read during optimization. Option #1: Read the scv during init and write to array? Option #2: Read from a database(sql, etc..)   Is there an easier way ?...
Hi,  I need some serious help with modifying my scripts.  I think it will take me days to months to try to understand and come up with the coding myself. I learnt a trading concept from a trader online and tested it using my live account. I would say, the probability of winning is high and I have...
void tick{ //How would I get WantedValue to test against if(CurrentAsk < PreviousAsk+WantedValue){ OrderSend(XXXXXX); } } //////////////My Functions double My_Function(double WantedValue){       WantedValue = 0.051;       return (WantedValue); }
  set 12:00 am  (6)
Hello to all. taking as an example the code iBarShift, how can I change the date in the hour 12:00 AM of the current day without having to continually change the day? thank you datetime some_time=D'2016.12.02 13:45';       int      shift=iBarShift(Symbol(),PERIOD_CURRENT,some_time);...
Hi All,   I dont know if im having a dim moment and over looking something really simple. Im not a big time MQL coder got into this quite recently but am pretty skilled in VBA.   Ive build my own EA using some Custom Indicators but these indicators could use some improving so stripped them down to...
Hi, i need a help.... This is my first EA and i am a beginner... can anyone help me to put Trailing stop for my EA ... i tried many ways but trailing stop is not activating when i am putting it on strategy tester... please help... this is my full EA(based on CCI for H4 and Daily TF, preferably...
Hi Experts, i need know when the last minute of day is running in my EA. It's for backtesting years of DAX-Index in order to close some postions at end of day. Usually it's always the same time hour=21 && minute=59. But unfortunately during years it has been changed in the DAX-Index often and my...
Is there a function for this dashed line between opening and closing arrow of one trade?