Need Help to Customizing an Order - page 2

 
LibertyCity:

1. this for sending an order without tp ans sl, am i right sir? then ...

2. how I can check it sir? as I know the code was blind and don't know the order numbers that they send before (except some memory was allocated to store order numbers for this reason) then I'll wrote this code below to modify

3. is the code right sir? how the program know the order ticket on first parameter array sir?

  1. Yes.
  2. OrderSend() 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. code *
  3. To do an OrderModify you need the ticket number, to use Orderticket() . . . "The order must be previously selected by the OrderSelect() function." do this code **

*

int OrderTicket = OrderSend(Symbol(), OP_BUY, xOrderLots, Ask, xSlippage, 0, 0, 0, xMagicNumbers, 0, Green);

if (OrderTicket = -1) Print ("OrderSend failed, error number: ", GetLastError());


**

else 
   {
   if (OrderSelect(OrderTicket, SELECT_BY_TICKET))
      if (!OrderModify(OrderTicket, OrderOpenPrice(), Ask - xStopLoss, Ask + xTakeProfit, 0, 0))
         Print ("OrderModify failed, error number: ", GetLastError());

   }

edit:  added brackets . . . .  if (OrderTicket = -1)
 
RaptorUK:

  1. OrderSend() 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. code *
  2. To do an OrderModify you need the ticket number, to use Orderticket() . . . "The order must be previously selected by the OrderSelect() function." do this code **


Please wait a moment ... I'll add it to my own code ... I'll go here with full code later ... :)
 
WHRoeder:
If you walk in to a giant cave and don't mark your turns ("I'll try to documenting all conditions later") how long until you are completely lost.
second that
 
Dude, there is a lot of methods and I myself are also super new to coding as well. MetaEditor / Dictionary / Search is super helpful
I am currently struggling with this same subject, but starting to understand.

To trade with more then one indicator as the other posters had pointed out, read their instructions closely and confirm these subjects with the Dictionary.

Regarding &&

Regarding OrderSelect

Regarding ||

These you will use to open orders
if (this>that && that>other && another==other && another && another){OrderSend,OP_BUY,x,x,x,x,x,x,x,"this did what I like",12345,0,Green)

}

if(OrderSelect(SELECT_BY_TICKET,MODE_TRADES)) Print("Order opened or some other message")

else(print "this order stinks", GetLastError())

I am currently going down each of the dictionary subjects so I can get a better idea on how to use the codes.

Read other peoples codes and also search other peoples questions sometimes you can test your skills to see how much you are learning if you can answer others questions or read others answers you will make great steps forward in my opinion.
Not pleasant, and perhaps not helpful to what you want right this moment but you will learn to love it.

Happy hacking, hope this helps
 
Agent86:

Read other peoples codes and also search other peoples questions sometimes you can test your skills to see how much you are learning if you can answer others questions or read others answers you will make great steps forward in my opinion.


Spot on . . . :-)
 
Agent86:
Dude, there is a lot of methods and I myself are also super new to coding as well. MetaEditor / Dictionary / Search is super helpful
I am currently struggling with this same subject, but starting to understand.

To trade with more then one indicator as the other posters had pointed out, read their instructions closely and confirm these subjects with the Dictionary.

Regarding &&

Regarding OrderSelect

Regarding ||

These you will use to open orders
if (this>that && that>other && another==other && another && another){OrderSend,OP_BUY,x,x,x,x,x,x,x,"this did what I like",12345,0,Green)

}

if(OrderSelect(SELECT_BY_TICKET,MODE_TRADES)) Print("Order opened or some other message")

else(print "this order stinks", GetLastError())

I am currently going down each of the dictionary subjects so I can get a better idea on how to use the codes.

Read other peoples codes and also search other peoples questions sometimes you can test your skills to see how much you are learning if you can answer others questions or read others answers you will make great steps forward in my opinion.
Not pleasant, and perhaps not helpful to what you want right this moment but you will learn to love it.

Happy hacking, hope this helps



I'm sorry sir, my references was MQL book here, and I'm Visual Basic programmers and very basic C++, and now MQL, if you copy others code that run something that you do not expect, your code was not useful, and if you copy code that will run something you expect, you'll never learn what code want to do, I'm here to ask, to read to learn and to write that code on my own project, I don't like to hijack, hack or anything that cause negative impact, CMIIW.

Now, I get error 'function isn't defined' here ... and I'm confused of where this problem arises

Alert("OrderSend error code ",Error," ",ErrorDescription(Error));


 
LibertyCity:

Now, I get error 'function isn't defined' here ... and I'm confused of where this problem arises


That function is in stdlib.mqh

Check here: https://www.mql5.com/en/forum/125042/page2

 
RaptorUK:

That function is in stdlib.mqh


Thanks! Amazing guide ... RaptorUK, after some research to 3 indicators and test to give it a signal, i need help to code about martingale:

  1. If the indicator gives a buy signal, expert will send order to buy. Otherwise, expert will send order to sell. (I can do this, thanks all!).
  2. Modify first opened order to TP 25 pips without SL. (Okay, I can do this with a few mistakes).
  3. Then, expert need to set buy limit or sell limit 10 pips from last opened order. TP 20 pips SL 160 pips Lots doubled from last opened order. (1st level).
  4. Set buy limit or sell limit again. 10 pips from 1st level. TP 20 pips SL same as 1st level Lots doubled from 1st level. (2nd level).
  5. Set buy limit or sell limit again. 10 pips from 2nd level. TP 20 pips SL same as 1st level Lots doubled from 2nd level. (3rd level).
  6. Rule for level 4th till 8th level same as point 4 - 5.

Those are the rules to open my martingale order, then:

  1. If price touched the 1st level, modify previous order, TP and SL same as this level. (TP 20 SL 160). If expert can TP on this level. Close all pending order.
  2. If price touched the 2nd level, modify all previous order, TP and SL same as this level. (TP 20 SL same as 1st level). If expert can TP on this level. Close all pending order.
  3. If price touched the 3rd level, modify all previous order, TP and SL same as this level. (TP 20 SL same as 2ndt level). If expert can TP on this level. Close all pending order.
  4. Next same as points 3 and 4 until 8th level.
I'm sorry if bothered, I thank to all who helped me to create my own expert.
Reason: