Results 1 to 5 of 5
 0 Attachment(s)    

Thread: Open Reverse Position after SL

  1. #1

    Default Open Reversal Position after SL

    Hi Funyoo,

    What's the code for opening reversal position after StopLoss?
    For example, Open Buy order at 1.600 with SL 100 Point, then if price hit SL (at 1.500) the EA to open a new Sell order at 1.500.

    Thanks in advance

    Regards,
    Jidonk
    Last edited by jidonk; 01-10-2010 at 06:36.

  2. #2
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by jidonk View Post
    Hi Funyoo,

    What's the code for opening reversal position after StopLoss?
    For example, Open Buy order at 1.600 with SL 100 Point, then if price hit SL (at 1.500) the EA to open a new Sell order at 1.500.

    Thanks in advance

    Regards,
    Jidonk
    Hi jidonk,

    You can use pending orders set on sl, it will be easier.

  3. #3

    Default

    Funyoo,

    Thanks for your quick reply.

    That is exactly what I have in my EA, but unfortunately I am now using an ECN broker (not allow hedge position), so need to change the code. Please help...tq

    Regards,
    Jidonk

  4. #4

    Default

    Hi Funyoo,

    I think I found the solution:

    set the first order without SL.
    If the price reach OrderOpenPrice() -/+ SL:
    send:
    CloseOrder() ....to close 1st order
    Ordersend() ....for the reverse order.

    Works for me...

    Thanks

  5. #5

    Default

    This is my own function I use. It works fine.

    To check if last order was in profit or not, alst order type and last order lots.
    This function is perfect for your need (I guess) and any martingale system.

    Good luck,
    Osama Shaban
    Code:
    void LastClosedTrade(){ 
       int cnt, total; 
       total = OrdersHistoryTotal(); 
       for(cnt=0;cnt<total; cnt++){ 
          OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY); 
       
          if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC && OrderProfit()!=0){
             LastOrderType = OrderType(); 
             LastOrderLots = OrderLots(); 
             LastOrderProfit = OrderProfit(); 
          }
       }
    }

Similar Threads

  1. Replies: 1
    Last Post: 09-03-2011, 21:22
  2. Replies: 1
    Last Post: 03-05-2011, 20:03
  3. Open Position at Close Candle
    By Xandra in forum Ideas for expert advisors
    Replies: 1
    Last Post: 12-30-2009, 06:50
  4. Add Close previous order when open new position
    By darkkiller in forum MQL programming
    Replies: 1
    Last Post: 03-21-2009, 05:55

Tags for this Thread

100, broker, change, ecn, funyoo, hedge, martingale, profit, stoploss, system

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •