how to get the EA to open trades when askprice is above trendline

 

good day

i need help am having difficult with coding my EA to open order when askprice is on trendline, eg sell orders to be opened when askprice is on upper trendline, buy order to be opened when askprice is on lower trendline and no orders are to be opened if price crosses over the trendline what command instruction should i give the EA

any help i will apreciate

 
Help you with what? You haven't stated a problem, you didn't even state a want.
     How To Ask Questions The Smart Way. 2004
          Prune pointless queries.

You have only four choices:
  1. Search for it. Do you expect us to do your research for you?

  2. Beg at:

  3. MT4: Learn to code it.
    MT5: Begin learning to code it.
    If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

  4. or pay (Freelance) someone to code it. Top of every page is the link Code Base.
              Hiring to write script - General - MQL5 programming forum 2019.08.21

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help 2017.04.21

 
the problem is i cant get the EA to open orders when askprice is on trendline, 
 
what command instructions should i use
 
Martinisrael Israel:
what command instructions should i use

Hi Martinisrael, if you are running MT4/MQL4, the command is OrderSend.  It requires a number of parameters.  If you type "OrderSend" (it's case sensitive), highlights it, and press F1 in your EA editor, it should bring a detail help similar to the link below.  Or, as you type OrderSend(, once you open the left parenthesis, the editor shows you the required parameters, highlighting what is the next parameter, and as long as you continue typing and press comma (the "," character) the editor helps again with the next parameter.  Very straightforward.

https://docs.mql4.com/trading/ordersend

If your question is different, share your code and I may highlight where to add the OrderSend command, or perhaps other people could better understand your question.

The other option is to around the CODEBASE section to see full code of simple EA's, or browse the MQL4 help that holds sections with good examples.

OrderSend - Trade Functions - MQL4 Reference
OrderSend - Trade Functions - MQL4 Reference
  • docs.mql4.com
Returns number of the ticket assigned to the order by the trade server or -1 if it fails. To get additional error information, one has to call the GetLastError() function. At opening of a market order (OP_SELL or OP_BUY), only the latest prices of Bid (for selling) or Ask (for buying) can be used as open price. If operation is performed with a...
 
Martinisrael Israel:

good day

i need help am having difficult with coding my EA to open order when askprice is on trendline, eg sell orders to be opened when askprice is on upper trendline, buy order to be opened when askprice is on lower trendline and no orders are to be opened if price crosses over the trendline what command instruction should i give the EA

any help i will apreciate

your trend line have a name

you have to use ObjectGetValueByShift to get your line price

double lineprice = ObjectGetValueByShift("your trend line name", "Bar number");

and compare it with ASK,BID or any other number in your desire algorithm

if ( Ask > lineprice ) {
 // buy condition
}
 
OK thank you very much, it has finally worked, issue was indicator name 
Reason: