MT4 "Once x pips gained, trail for x pips" ?

Discussion in 'Trading Software' started by Z2TT, Jun 23, 2019.

  1. Z2TT

    Z2TT

    Hello.

    I'm wondering is there any add-on for MT4 or setting that allows to activate a trailing stop loss, only once a certain amount of pips are gained, that the user can define when opening a position?

    Cheers.
     
  2. expiated

    expiated

    My understanding is that you have to have an active trade (open position) or pending order first. Once you do, you can right click on the Stop Loss (S/L) cell and select Trailing Stop from the subsequent drop down menu. You have to be careful though, because the platform will be using points rather than pips. So for example, if if you want a trailing stop of 100 pips, you might have to enter 1000 in the "Custom" window (which you can select from the bottom of the default list of point settings that the program offers automatically).
     
  3. Z2TT

    Z2TT

    Yes I make a market order and get filled. But then I must go out and not be at the computer for a while so I want the trade to begin without having a trailing stop (only a fixed one).

    But I want to specifcy at the time I enter the market, that once it gains say 50 pips in my way, to active a trailing stop loss of 15 pips indefinitely until I get stopped out.

    I'm unsure whether I need an add-on to be coded by somebody for this or if I can specify this within MT4 to happen.

    I know Ctrader can do this but unsure about MT4

    Keep in mind, I don't want it to trail immediately after I enter market. I want to have a fixed stop loss until the trade goes 50 pips in profit, then it activates a trailing stop loss of 15 pips automatically once in profit by my specified amount (50 pips)
     
  4. expiated

    expiated

    These videos explain it. It seems like you have a couple of different options...



     
  5. Peter10

    Peter10

    MT4 has that feature, but it will only work if the software is in use. If you close the software or you log in another account, it will stop trailing your trade.
     
    expiated likes this.
  6. expiated

    expiated

    Yikes!!! That sucks!
     
  7. Turveyd

    Turveyd

    Mt4 you can code what you want, I'll post my Auto SL when i get on the pc later to get you started.

    Mine keeps the SL to a ema +/- 0.04%
     
    expiated likes this.
  8. Turveyd

    Turveyd

    This will get you started, if it's running on the PC and you trade off phone / tablet it'll still work, version that moves is being tweaked at the moment, send that over later.


    extern string Product="Overwatch V2.16 - 24Esma 0.04%";
    extern double MinStopLoss=8;
    extern double MaxStopLoss=12;

    int start()
    {
    if(OrdersTotal()>0){
    for(int i=1; i<=OrdersTotal(); i++)
    {
    if (OrderSelect(i-1,SELECT_BY_POS)==true)
    {
    if((OrderType()==OP_BUY)&&(OrderStopLoss()==0)&&(OrderSymbol()==Symbol())) {
    RefreshRates();
    double slb=NormalizeDouble(iMA(NULL,0,24,0,MODE_EMA,PRICE_MEDIAN,0)*0.9996,Digits);

    double sla=Bid-slb;
    if (sla<MinStopLoss){
    slb=NormalizeDouble(Bid-MinStopLoss,Digits);
    }

    if (sla>MaxStopLoss){
    slb=NormalizeDouble(Bid-MaxStopLoss,Digits);
    }


    OrderModify(OrderTicket(),0,slb,0,0,CLR_NONE);
    }

    if((OrderType()==OP_SELL)&&(OrderStopLoss()==0)&&(OrderSymbol()==Symbol())) {
    RefreshRates();
    double sls=NormalizeDouble(iMA(NULL,0,24,0,MODE_EMA,PRICE_MEDIAN+Ask-Bid,0)*1.0004,Digits);
    double slc=sls-Ask;
    if (slc<MinStopLoss){
    sls=NormalizeDouble(Bid+MinStopLoss+Ask-Bid,Digits);
    }
    if (slc>MaxStopLoss){
    sls=NormalizeDouble(Bid+MaxStopLoss+Ask-Bid,Digits);
    }

    OrderModify(OrderTicket(),0,sls,0,0,CLR_NONE);
    }
    }
    }
    }

    int Error=GetLastError();
    if(Error==130){Alert("Wrong stops. Retrying."); RefreshRates();}
    if(Error==133){Alert("Trading prohibited.");}
    if(Error==2){Alert("Common error.");}
    if(Error==146){Alert("Trading subsystem is busy. Retrying."); Sleep(500); RefreshRates();}


    return(0);
    }
     
    expiated likes this.