Watch how to download trading robots for free
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Scripts

Trailing Step Function - script for MetaTrader 4

Kailash Bai Mina
Published by:
Kailash Bai Mina
Views:
3519
Rating:
votes: 19
Published:
2021.11.09 00:52

Function : 

//+------------------------------------------------------------------+
//|Trailing Step                                                     |
//+------------------------------------------------------------------+
void TrailingStep(int Trailing_Step_Pips)
 {
  for(int i=OrdersTotal()-1; i>=0; i--)
   {
    if(OrderSelect(i,SELECT_BY_POS))
     {
      if(OrderType()==OP_BUY)
       {
        if(OrderStopLoss()>=OrderOpenPrice())
         {
          if(Bid-OrderStopLoss()>Trailing_Step_Pips*Point()*10)
           {
            int OM = OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss()+Trailing_Step_Pips*Point()*10,OrderTakeProfit(),0);
           }
         }
        else
         {
          if(Bid-OrderOpenPrice()>=Trailing_Step_Pips*Point()*10)
           {
            int OM = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0);
           }
         }
       }
      if(OrderType()==OP_SELL)
       {
        if(OrderStopLoss()<=OrderOpenPrice())
         {
          if(OrderStopLoss()-Bid>Trailing_Step_Pips*Point()*10)
           {
            int OM = OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss()-Trailing_Step_Pips*Point()*10,OrderTakeProfit(),0);
           }
         }
        else
         {
          if(OrderOpenPrice()-Bid>=Trailing_Step_Pips*Point()*10)
           {
            int OM = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0);
           }
         }
       }
     }
   }
 }
    Trailing Function Trailing Function

    This Is a Normal Trailing Function For All Open Order In MT4.

    Correlation Calculator Panel Correlation Calculator Panel

    Calculator

    DMH DMH

    Directional Movement using Hann windowing - metatrader 4 version

    Limit channels Limit channels

    ATR based limit channels - metatrader 4 version