Download MetaTrader 5

mediate the price

To add comments, please log in or register
Giovanni Guastella
138
Giovanni Guastella  
Hello everyone, I explain this problem now ... how should I do to open a position, in the same direction of the first position, only after another loses for example 100 pips? I do not take the stoploss, I just need to open a position that you will close to target or if it goes back again to 100 pips I opened another position that will always go in the same direction of the first position. Can anyone help me?
whroeder1
16058
whroeder1  
Giovanni Guastella: I explain this problem now
If you can't explain the problem, you can't code a solution. Your post is unintelligible to me.
Giovanni Guastella
138
Giovanni Guastella  
ok, I try again, sorry but I do not speak English well.
I need that if I buy order goes in negative 200 pips: ticket = (OrderSend (Symbol (), OP_BUY, Lotto, Ask,3,0, Ask + (TakeProfit * Point), "go long", MagicNumber, 0, clrGreen));
My Bot  will to open another buy order.
how can I do? Please?
Thnak you
whroeder1
16058
whroeder1  
  1. Compare market to open price and open another.
    learn to code it, or pay (Freelance) someone to code it.
    We're not going to code it for you.
    We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
  2. No stop loss means you have infinite risk.
    • You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
    • Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
    • Do NOT use TickValue by itself - DeltaPerLot
    • You must normalize lots properly and check against min and max.
    • You must also check FreeMargin to avoid stop out
Giovanni Guastella
138
Giovanni Guastella  
I thank you for your answer, but I have not asked for the trading lesson, I have my strategies, I'm making an EA, but I was stuck on this step.
No one can help me?
I need this: if  opened trade  is 200 pips in negative. it open another trade  same  first trade.

I'm not telling anyone to make me an EA. Just a little hand for this step.

Thank you 

Fernando Carreiro
2947
Fernando Carreiro  
Giovanni Guastella: I thank you for your answer, but I have not asked for the trading lesson, I have my strategies, I'm making an EA, but I was stuck on this step.
No one can help me?
I need this: if  opened trade  is 200 pips in negative. it open another trade  same  first trade.

I'm not telling anyone to make me an EA. Just a little hand for this step.

WHRoeder has already answered in step 1 - "Compare market to open price and open another".

You select the order with "OrderSelect()" and you compare the "OrderOpenPrice()" with the current market price "OrderClosePrice()" and if they differ by more than what you have defined, you place a new "OrderSend()".

You should read the documentation and familiarize yourself will all the aspects of MQL and all the possible functions and parameters. That is why WHRoeder, stated that you need to "learn it" or "hire someone" to do it for you if you are unable to.

Giovanni Guastella
138
Giovanni Guastella  
Fernando Carreiro:

WHRoeder has already answered in step 1 - "Compare market to open price and open another".

You select the order with "OrderSelect()" and you compare the "OrderOpenPrice()" with the current market price "OrderClosePrice()" and if they differ by more than what you have defined, you place a new "OrderSend()".

You should read the documentation and familiarize yourself will all the aspects of MQL and all the possible functions and parameters. That is why WHRoeder, stated that you need to "learn it" or "hire someone" to do it for you if you are unable to.

Thank you, i will try it
Keith Watford
Moderator
10619
Keith Watford  
You also need to take steps to make sure that you don't repeat the action once the order is opened.
whroeder1
16058
whroeder1  
Giovanni Guastella:, but I was stuck on this step.
Asked and answered: "We are willing to help you when you post your attempt (using SRC) and the nature of your problem."
Giovanni Guastella
138
Giovanni Guastella  
void Cross()
{

  double PreviousChipmunk = iMA (Symbol(),0,Cperiod,Cscostamento,Cmetodo,Capplica,2);
  double Chipmunk = iMA (Symbol(),0,Cperiod,Cscostamento,Cmetodo,Capplica,1);
  double PreviousTurtle = iMA (Symbol(),0,Tperiod,Tscostamento,Tmetodo,Tapplica,2);
  double Turtle = iMA (Symbol(),0,Tperiod,Tscostamento,Tmetodo,Tapplica,1);



   if (PreviousChipmunk<PreviousTurtle && Chipmunk>Turtle)
   {
    if (OrdersTotal()==0 )
      ticket=(OrderSend (Symbol(),OP_BUY,Lotto,Ask,3,0,Ask+(TakeProfit*Point),"buy",1234,0,clrGreen));
      }

      
  
    if (OrdersTotal()==1)
   {
   OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES);
   if( OrderOpenPrice() > 200*Point) {
   ticket2=(OrderSend (Symbol(),OP_BUY,Lotto,Ask,3,0,Ask+(TakeProfit*Point),"buy 2",12345,0,clrGreen));
    
     }
}

// in this way does not work ... I can not find an example that can help me (of course we all understand that I'm a newbie on mql :))
// maybe i will do a bool?  loss=(OrderOpenPrice() - OrderClosePrice())?
// i have need him open the trade after 200  pips down, but not work fine
Giovanni Guastella
138
Giovanni Guastella  
whroeder1:
Asked and answered: "We are willing to help you when you post your attempt (using SRC) and the nature of your problem."
Thank you 
12
To add comments, please log in or register