Download MetaTrader 5

Trading Code Tip (HELP!)

To add comments, please log in or register
Alessandro Faggioni
21
Alessandro Faggioni  

Hello everyone

I'm trying to setup a new trading strategy

It's my first, so I have a question.

Let's say I start with OP_BUY with a TakeProfit of 2 pips

If the martket goes down, so taking no profit, I want to do something else

So


{ OrderSend(Symbol(), OP_BUY, etc...)

if(the market goes down open another order)

}


With what code can I do that?

whroeder1
15917
whroeder1  
Alessandro Faggioni: With what code can I do that?
  1. With code the you will have to write (or have written.) Find if you have an open order(s,) get the (lowest) entry price. See if the market has gone the wrong direction by a large enough distance, then do what you want.

  2. You can only place stops closer to the market than the minimum (MODE_STOPLEVEL * _Point.) Requirements and Limitations in Making Trades - Appendixes - MQL4&Tutorial
    Is that more than 2 pips?

  3. You have only four choices:
    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 SRC) and the nature of your problem. No free help
    urgent help.
Alessandro Faggioni
21
Alessandro Faggioni  
whroeder1:
  1. With code the you will have to write (or have written.) Find if you have an open order(s,) get the (lowest) entry price. See if the market has gone the wrong direction by a large enough distance, then do what you want.

  2. You can only place stops closer to the market than the minimum (MODE_STOPLEVEL * _Point.) Requirements and Limitations in Making Trades - Appendixes - MQL4&Tutorial
    Is that more than 2 pips?

  3. You have only four choices:
    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 SRC) and the nature of your problem. No free help
    urgent help.

Are you in your period lol?


I just asked for the name of a command that can check the direction of the Market, not to give me a 100% profitable EA

whroeder1
15917
whroeder1  
Alessandro Faggioni:

Are you in your period lol?

I just asked for the name of a command that can check the direction of the Market,

  1. Now on the do not help list.
  2. You did not and there isn't any.
honest_knave
Moderator
2326
honest_knave  

Select the OP_BUY order and compare OrderOpenPrice() to OrderClosePrice(). Or look at OrderProfit().

That will tell you if the market has moved against your position.

Remember to take into consideration spread i.e. the position might be moving in your favour but still negative.

Or you can just store the opening price as a variable for later comparison. But that won't recover well from terminal restarts etc.

Alessandro Faggioni
21
Alessandro Faggioni  
honest_knave:

Select the OP_BUY order and compare OrderOpenPrice() to OrderClosePrice(). Or look at OrderProfit().

That will tell you if the market has moved against your position.

Remember to take into consideration spread i.e. the position might be moving in your favour but still negative.

Or you can just store the opening price as a variable for later comparison. But that won't recover well from terminal restarts etc.


Thank you really much.

To add comments, please log in or register