Download MetaTrader 5

mql4 to mql5 pls help

To add comments, please log in or register
hikary3
31
hikary3  

Can someone help me and convert my indicator from mql4 to mql5.I want add socket comunication with my program in C# but to this i need to convert to mql5. Because sockets dont work in mql4 :/ Would anyone be so nice?

Files:
Moje.mq4 4 kb
Fernando Carreiro
3916
Fernando Carreiro  
hikary3: Can someone help me and convert my indicator from mql4 to mql5.I want add socket comunication with my program in C# but to this i need to convert to mql5. Because sockets dont work in mql4 :/ Would anyone be so nice?

You are mistaken! Sockets work in both MQL4 and MQL5:

Socket library for MT4 and MT5
Socket library for MT4 and MT5
  • 2017.09.06
  • JC
  • www.mql5.com
For anyone not used to socket programming: the model is that you create a server socket; you accept connections on it; and each acceptance creates a new socket for communicating with that client. No data is sent or received through the server socket itself. You create a server socket using an instance of ServerSocket(), telling the constructor...
hikary3
31
hikary3  
Fernando Carreiro:

You are mistaken! Sockets work in both MQL4 and MQL5:

I have small problem. MT4 throws it to me - "Cannot call 'ws2_32.dll::socket', DLL is not allowed" and idk how to fix it. Can u help me?
Mladen Rakic
71043
Mladen Rakic  
hikary3:
I have small problem. MT4 throws it to me - "Cannot call 'ws2_32.dll::socket', DLL is not allowed" and idk how to fix it. Can u help me?
Enable dll calls in the expert properties (if you are using the expert from that link)
hikary3
31
hikary3  
Mladen Rakic:
Enable dll calls in the expert properties (if you are using the expert from that link)

Still dont know. I want use socket and I do as it is here - https://www.mql5.com/en/blogs/post/706665.

Fernando Carreiro
3916
Fernando Carreiro  
hikary3: Still dont know. I want use socket and I do as it is here - https://www.mql5.com/en/blogs/post/706665.

You have to enable DLL calls in both your main "Options" as well as when you attach the Indicator/EA to the chart ...


hikary3
31
hikary3  
Fernando Carreiro:

You have to enable DLL calls in both your main "Options" as well as when you attach the Indicator/EA to the chart ...


OMG  thanks now tis working <3

Fernando Carreiro
3916
Fernando Carreiro  
hikary3: OMG  thanks now tis working <3

That was what @Mladen Rakic also told you to do ...

Forum on trading, automated trading systems and testing trading strategies

mql4 to mql5 pls help

Mladen Rakic, 2018.01.02 12:50

Enable dll calls in the expert properties (if you are using the expert from that link)
hikary3
31
hikary3  
Fernando Carreiro:

That was what @Mladen Rakic also told you to do ...

i understood this after your post :/ but i have one more problem with alert.

I did something like that to have alert when bar is closing. But sometimes this make me 2 or 3 alerts, sometimes i dont have alert :/ however i need only one alert when bar is closing can u help me with this?

m=Time[i]+Period()*60-CurTime();
s=m%60;

if(s==0){
Alert("alert");
}


Fernando Carreiro
3916
Fernando Carreiro  
hikary3: i understood this after your post :/ but i have one more problem with alert.

I did something like that to have alert when bar is closing. But sometimes this make me 2 or 3 alerts, sometimes i dont have alert :/ however i need only one alert when bar is closing can u help me with this?

Please understand that the OnTick() event handler is called on every tick, just as the name states. That means that there can easily be 10s or more calls per second. If your alert condition is based on Time (seconds), you can easily have it being triggered multiple times within the same second, nor is there a guarantee that a tick will arrive at the zero second in order to trigger the alert.

Consider a flag to determine if the alert has been triggered or no,t or maybe a different type of trigger, or using the OnTimer() event handler instead.

However, I suspect that your understanding of MQL4 is still somewhat "green" and in that case I suggest some extra reading may help you out:

Forum on trading, automated trading systems and testing trading strategies

Something Interesting to Read

Sergey Golubev, 2017.09.16 05:40

Expert Advisor Programming for MetaTrader 4


This book will teach you the following concepts:

  • The basic of the MLQ4 language, including variables and data types, operations, conditional and loop operators, functions, classes and objects, event handlers and more.
  • Place, modify and close market and pending orders.
  • Add a stop loss and/or take profit price to an individual order, or to multiple orders.
  • Close orders individually or by order type.
  • Get a total of all currently opened orders.
  • Work with OHLC bar data and locate basic candlestick patterns.
  • Find the highest high and lowest low of recent bars.
  • Work with MetaTrader’s built-in indicators, as well as custom indicators.
  • Add a trailing stop or break even stop feature to an expert advisor.
  • Use money management and lot size verification techniques.
  • Add a flexible trading timer to an expert advisor.
  • Construct several types of trading systems, including trend, counter-trend and breakout systems.
  • Add alert, emails, sounds and other notifications.
  • Add and manipulate chart objects.
  • Read and write to CSV files.
  • Construct basic indicators, scripts and libraries.
  • Learn how to effective debug your programs, and use the Strategy Tester to test your strategies.

All of the source code in this book is available for download, including an expert advisor framework that allows you to build robust and fully-featured expert advisors with minimal effort.

yogesh kshirsagar
91
yogesh kshirsagar  

 hi 

  can  anyone help me . today  i got  monster harmonic indicator  for one month rent   but this  indicator not  working here in mt4  as im just watching  mt4 for  charting  in indian stock market  can  any one help me  to install this indicator in my mt4 

12
To add comments, please log in or register