+ Reply to Thread
Results 1 to 5 of 5
 0 Attachment(s)    

Thread: Stealth TrailingStop

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    7

    Default Stealth TrailingStop

    Im looking for some code that I can place into an existing EA that will provide a stealth Trailing stop... what I need is something that does not change the take profit or stoploss that the EA places but I want it to start at a definded position... such as 10 pips profit... and the trailing stop will run something like 2 pips trailing. The code needs to be stealth since my broker has a 10 pip spread for TP and SL. Does anyone have this or can one be made?

    I appreciate you help!

  2. #2
    Junior Member
    Join Date
    Aug 2009
    Posts
    7

    Default

    well since no one helped with this... here is some code... may not be TRailing stop but could easily be made into one!

    extern bool use_hidden_stop_loss = true;
    extern int hidden_sl = 100;
    extern bool use_hidden_take_profit = true;
    extern int hidden_tp = 100;



    void hidden_take_profit()
    {
    int totalorders = OrdersTotal();
    for(int i=totalorders-1;i>=0;i--)
    {
    OrderSelect(i, SELECT_BY_POS);
    bool result = false;
    if ( OrderSymbol()==Symbol() )
    {
    if (OrderType() == OP_BUY && OrderOpenPrice()+hidden_tp*Point<=Bid ) result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
    if (OrderType() == OP_SELL && OrderOpenPrice()-hidden_tp*Point>=Ask ) result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );

    }
    }
    return;
    }



    void hidden_stop_loss()
    {
    int totalorders = OrdersTotal();
    for(int i=totalorders-1;i>=0;i--)
    {
    OrderSelect(i, SELECT_BY_POS);
    bool result = false;
    if ( OrderSymbol()==Symbol() )
    {
    if (OrderType() == OP_BUY && OrderOpenPrice()-hidden_sl*Point>=Bid ) result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
    if (OrderType() == OP_SELL && OrderOpenPrice()+hidden_sl*Point<=Ask ) result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );

    }
    }
    return;
    }




    int start()
    {
    //----
    if (use_hidden_stop_loss) hidden_stop_loss();
    if (use_hidden_take_profit) hidden_take_profit();
    //----
    return(0);
    }


    Well... I guess i should thank myself...

  3. #3
    Junior Member
    Join Date
    Sep 2009
    Posts
    1

    Default

    And I say tank you

  4. #4
    DMS
    DMS is offline
    Junior Member
    Join Date
    Jan 2009
    Posts
    2

    Default

    PLEASE _______http://www.kimiv.ru/index.php?option=com_remository&Itemid=13&func=fil einfo&id=73

  5. #5
    Junior Member
    Join Date
    Jan 2009
    Posts
    17

    Default

    thanks for this

+ Reply to Thread

Similar Threads

  1. Stealth Forex Expert Advisor
    By funyoo in forum Commercial expert advisors
    Replies: 9
    Last Post: 02-03-2011, 10:54
  2. Stealth Forex V10
    By zoop in forum Ideas for expert advisors
    Replies: 9
    Last Post: 05-05-2010, 19:24
  3. Trailingstop ea
    By forexnoobs in forum MQL programming
    Replies: 0
    Last Post: 05-09-2009, 04:50

Posting Permissions

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