Results 1 to 4 of 4
 0 Attachment(s)    

Thread: Hidden take profit idea

  1. #1

    Default Hidden take profit idea

    hi funyoo, do you think it is possible in order to optimize closing position to modify the hidden take profit using this strategy :

    for a sell position :

    once the take profit is reached we monitor the ask comparing each tick to previous one and we wait until the ask move up and send the order close at this moment.

    same idea for buy position bid<previous_tick_on_bid => order close

    We can also build an ea for manual traders where you put your take profit level and the ea close the position following this rules. thank you in advance.

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

    Default

    Quote Originally Posted by logan113 View Post
    hi funyoo, do you think it is possible in order to optimize closing position to modify the hidden take profit using this strategy :

    for a sell position :

    once the take profit is reached we monitor the ask comparing each tick to previous one and we wait until the ask move up and send the order close at this moment.

    same idea for buy position bid<previous_tick_on_bid => order close

    We can also build an ea for manual traders where you put your take profit level and the ea close the position following this rules. thank you in advance.
    Hi logan113,

    Before the init function, add :

    Code:
    double price;
    In the init function, before return()0;, add :

    Code:
    price=NormalizeDouble((Ask+Bid)/2,dg);
    At the end of the Start() function, before return(0);, add :

    Code:
    price=NormalizeDouble((Ask+Bid)/2,dg);
    Replace :

    Code:
    void hideclosebuy(){
       RefreshRates();
       if(OrdersTotal()>0){
          for(i=OrdersTotal();i>=0;i--){
             OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
             if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_BUY
             && (hidesl && stoploss>0 && OrderProfit()<=(-1)*stoploss*OrderLots()*10-MarketInfo(Symbol(),MODE_SPREAD)*OrderLots()*10/mt)
             || (hidetp && takeprofit>0 && OrderProfit()>=takeprofit*OrderLots()*10)){
                OrderClose(OrderTicket(),OrderLots(),Bid,slippage*mt);
             }
          }
       }
    }
    By :

    Code:
    void hideclosebuy(){
       RefreshRates();
       if(OrdersTotal()>0){
          for(i=OrdersTotal();i>=0;i--){
             OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
             if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_BUY
             && (hidesl && stoploss>0 && OrderProfit()<=(-1)*stoploss*OrderLots()*10-MarketInfo(Symbol(),MODE_SPREAD)*OrderLots()*10/mt)
             || (hidetp && takeprofit>0 && OrderProfit()>=takeprofit*OrderLots()*10 && NormalizeDouble((Ask+Bid)/2,dg)-price>0)){
                OrderClose(OrderTicket(),OrderLots(),Bid,slippage*mt);
             }
          }
       }
    }
    Replace :

    Code:
    void hideclosesell(){
       RefreshRates();
       if(OrdersTotal()>0){
          for(i=OrdersTotal();i>=0;i--){
             OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
             if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_SELL
             && (hidesl && stoploss>0 && OrderProfit()<=(-1)*stoploss*OrderLots()*10-MarketInfo(Symbol(),MODE_SPREAD)*OrderLots()*10/mt)
             || (hidetp && takeprofit>0 && OrderProfit()>=takeprofit*OrderLots()*10)){
                OrderClose(OrderTicket(),OrderLots(),Ask,slippage*mt);
             }
          }
       }
    }
    By :

    Code:
    void hideclosesell(){
       RefreshRates();
       if(OrdersTotal()>0){
          for(i=OrdersTotal();i>=0;i--){
             OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
             if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_SELL
             && (hidesl && stoploss>0 && OrderProfit()<=(-1)*stoploss*OrderLots()*10-MarketInfo(Symbol(),MODE_SPREAD)*OrderLots()*10/mt)
             || (hidetp && takeprofit>0 && OrderProfit()>=takeprofit*OrderLots()*10 && NormalizeDouble((Ask+Bid)/2,dg)-price<0)){
                OrderClose(OrderTicket(),OrderLots(),Ask,slippage*mt);
             }
          }
       }
    }

  3. #3

    Default

    Thank you very much funyoo i'll try this right know.

  4. #4
    Junior Member
    Join Date
    Dec 2016
    Posts
    1

    Default

    Can u plz be more clear..bcoz i didnt understand a little in it...as well i had a glance on few fourms realted to quick fast scalping method ( something realted to bid price & ask price only)..can u plz help me in coding on bid price & ask price stratgey..like to take profit & close..

Similar Threads

  1. Add Hidden TP and SL into code
    By ivowetters in forum MQL programming
    Replies: 26
    Last Post: 11-11-2015, 21:14
  2. The hidden face of the Moon
    By fxtester in forum General discussion
    Replies: 1
    Last Post: 02-27-2015, 18:13
  3. Take Profit Idea EA
    By mike2star in forum Expert advisors live statements
    Replies: 3
    Last Post: 12-12-2009, 18:51
  4. Hidden SL & TP
    By jidonk in forum MQL programming
    Replies: 2
    Last Post: 04-20-2009, 17:35

Tags for this Thread

closing, funyoo, level, manual, profit, slippage, spread, stoploss, strategy, thank you

Posting Permissions

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