Can EA get coordinat of a line that user draw by herself?

 

Hi guys,

as title...

I want to implement a function that close all orders when price touch the line i draw by myself...

Is that possible?

What can i do?

thanks for any reply :)

 
shuenmeau: Hi guys, as title... I want to implement a function that close all orders when price touch the line i draw by myself... Is that possible? What can i do? thanks for any reply :)

Yes it is possible, but you will have to either learn how to do it yourself or hire someone to code it for you.

Forum on trading, automated trading systems and testing trading strategies

Can you help modify this indicator?

Alain Verleyen, 2017.08.29 12:34

Welcome,

Usually people who can't code don't receive free help on this forum, though it could happen if you are lucky, be patient.

Programmers (any programmers) are coding for free:

  • if it is interesting for them personally, or
  • if it is interesting for many members of this forum.

other options :

  • If you show your attempts and describe well your problem, you will most probably receive an answer from the community.
  • If you don't want to learn to code, nothing bad, you can either look at the Codebase if something free already exists, or in the Market for paid products (sometimes free also).
  • Finally, you also have the option to hire a programmer in the Freelance section.

Good luck.

Forum on trading, automated trading systems and testing trading strategies

Is it easy (or difficult) to …?

Fernando Carreiro, 2017.08.30 21:43

This post could be considered a “rant”, but I would like to take the opportunity to relay to those that ask similar questions, the difficulty involved in answering such a simple query – “Is it is easy (or difficult) to …?”

  • “Easy” would imply that anyone can do it, but that is obviously not the case.
  • “Easy” depends on the ability, skill, knowledge and experience of the one that is tasked to do it.
  • That ability, skill, knowledge and experience took time to establish and it had a cost, and if you sum it all up, it can be quite high.
  • So, “easy” means that if you don’t know how to do it yourself (or not able to do it yourself), then you will have to “compensate” someone else to do it for you.
  • You will be “compensating” him or her for all the effort and cost that went into acquiring the ability, skill, knowledge and experience and NOT for the actual time spent carrying out the task.

So, even if the task is just changing one line of code; remember that you are “compensating” the person for his knowledge and skills and not for just one line of code.

The same applies to those that request for something “simple” to be done for free. It is NEVER “simple”. If it were that “simple” then you would be able to do it yourself.

So, respect the hard work and effort the coder went through to gain his skills and knowledge and “compensate” him/her for it. Wanting it for free is being totally disrespectful!

PS! In conclusion, learn to use the Freelance Jobs section and recognise and respect those more skilled, knowledgeable and experienced than you!

EDIT: Please note that I use the term "compensation" and not "payment", because there are many ways to "compensate" for work done. Sometimes a coder will be "compensated" with gained or shared knowledge instead of money, or by an exchange of ideas or other things. It is not always about the money but it is about the "compensation"!

 
shuenmeau:

Hi guys,

as title...

I want to implement a function that close all orders when price touch the line i draw by myself...

Is that possible?

What can i do?

thanks for any reply :)


Hi, yes, you can find or get properties of any object on the chart by its name, try using unique name and get desired property (Price, in this case) by ObjectGetDouble.

 
shuenmeau: I want to implement a function that close all orders when price touch the line i draw by myself...
You can also just move the SL/TP lines to that price and the server will close it for you.
 

are you want when sum of profits from many your position received to example 30$ close all of them?

 
Fernando Carreiro:

Yes it is possible, but you will have to either learn how to do it yourself or hire someone to code it for you.

thanks

I just want to know which Mt4 function can help me to do this stuff

If it's possible, i'll do it by myself :)

 
Mohammad Hossein Sadeghi:

Hi, yes, you can find or get properties of any object on the chart by its name, try using unique name and get desired property (Price, in this case) by ObjectGetDouble.


thank you, i'll try it :)

 
Seyed Yasin Hamzehpour:

are you want when sum of profits from many your position received to example 30$ close all of them?


No ! i want to draw a trend line at main chart, and if market price below( or above)the trend line, i hope that EA can close all long (or short )orders

 
shuenmeau:

No ! i want to draw a trend line at main chart, and if market price below( or above)the trend line, i hope that EA can close all long (or short )orders

For horizontal lines use objectgetdouble function. For trendlines use getvaluebyshift with shift equal 0
Here is example https://docs.mql4.com/objects/objectgetvaluebyshift
 

It is easy, only two functions to use.


Draw the line on the chart, double click the line, give it a name, say : "line_up".


then in the EA look for the line : if( ObjectFind("line_up") > - 1 ) //line is found


Then, if( close[0] > ObjecGetValueByShift( "line_up",0 )  // mean line is touched with price going up


Check for exact formulation of fonction, (this is MT4)

 

There is an article with a ready-made EA with sources which does what you want. Unfortunately it's not yet translated to English. Only Russian and German versions are available.

Reason: