MQL4 - automated forex trading   /  

Code Base

Read Financial Magazines in MetaTrader 4 and MetaTrader 5!

Code Base  Expert Advisors  Tool to auto-Insert Take-Profit & Stop-Loss limits. To post a new code, please log in or register

Download MetaTrader 5 and visit MQL5.community Code Base
and Trade on the Go!
and Trade on the Go!
Couldn't find the right code? Order it in the Jobs section

This Expert Advisor is for
MetaTrader 4
Download MT 4 - 455 Kb

and Trade on the Go!

and Trade on the Go!

Name:
Tool to auto-Insert Take-Profit & Stop-Loss limits.
Author: Emaan (2010.12.24 09:51)
Downloaded: 10931
Download:
 TPSL-Insert.mq4 (2.9 Kb) View

Description:

A tool to auto insert preset Take-Profit and Stop-Loss limits when an order is executed.

Specially when doing scalping manually where you need quick setting of stop limits.

7 comments  To post a new comment, please log in or register
Please guide me how can i run this indicator ??????????
18.12.2013 14:45 karimfayazi
Work Good For Me ..
Thanks..
12.11.2013 10:09 Alonedevils
Hi, where i can put the file to make it work?
30.03.2012 13:15 allan889

Hi,

I could not make it to work...

Can anyone help?

Thanks

24.06.2011 18:43 Pipkeep
Excellent works very well. For those with problems modifying open orders, well this is the script. It can be easily incorporated into any EA
14.01.2011 04:14 Limitx
insted of
if(Close[0]>10)  {Faktor=1000; Digt=3;}  else
if(Close[0]<10)  {Faktor=100000; Digt=5;}


You could do sth like this:

//---------------Modify Order--------------------------
if ( (OrderType()==OP_BUY || OrderType()==OP_SELL) && (OrderStopLoss()==0 || OrderTakeProfit()==0) && OrderSymbol()==Symbol() )   
{
        if( OrderTakeProfit()==0 && TakeProfitPips !=0 )
        {
                TPp = 0;
                if(OrderType()==OP_BUY )
                TPp = OrderOpenPrice()+TakeProfitPips*Point;
                else if(OrderType()==OP_SELL)                     
                TPp = OrderOpenPrice()-TakeProfitPips*Point;

                TPp = NormalizeDouble(TPp, Digits);
        }

        if(OrderStopLoss()==0 && StopLossPips !=0)
        {
                SLp = 0;
                if(OrderType()==OP_BUY)
                SLp = OrderOpenPrice()-StopLossPips*Point;
                else if(OrderType()==OP_SELL)
                SLp = OrderOpenPrice()+StopLossPips*Point;

                SLp = NormalizeDouble(SLp, Digits); 
        }
        
        OrderModify(OrderTicket(),OrderOpenPrice(),SLp,TPp,0);
}
28.12.2010 00:38 karcewzrokiem
  1. if(Close[0]>10)  {Faktor=1000; Digt=3;}  else
    if(Close[0]<10)  {Faktor=100000; Digt=5;}
    
    EA's should auto adjust for tp, sl, and slippage
    //++++ These are adjusted for 5 digit brokers.
    double  pips2points,    // slippage  3 pips    3=points    30=points
            pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int init(){
        if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
        // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
    

  2. if(OrdersTotal()!=0)
             {
             for(cnt=0; cnt<OrdersTotal(); cnt++)
                {
                OrderSelect(cnt,SELECT_BY_POS);
    
    Always count down, check return codes. The IF is redundant.
    for(int pos = OrdersTotal()-1; pos >= 0 ; pos--) if (
        OrderSelect(pos, SELECT_BY_POS)             // Only my orders w/
    //&&  OrderMagicNumber() == Magic.Number          // my magic number
    &&  OrderSymbol()      == Symbol() ){           // and period and symbol
    

24.12.2010 19:51 WHRoeder