MQL4 - automated forex trading   /  

Code Base

Lilith goes to HollywoodExpert
Lilith goes to Hollywood
Author: BlueSkyThinking
Subscribe to signal
Mts 4
188 405.66%, 5 655 169.82 USD
Screenshot
LLG, M1
Real
All about Automated Trading Championship: Additional Materials of Championships 2006-2007All about Automated Trading Championship: Additional Materials of Championships 2006-2007 EA microMoney EURUSDEA microMoney EURUSD Try product
EA microMoney EURUSD
Author: kpdabiao

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!
Prepare for the Championship
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: 9461
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.

5 comments  To post a new comment, please log in or register
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