Trading Code Tip (HELP!)

 

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?

 
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.
 
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

 
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.
 

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.

 
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.