Help me find this....

 
I am trying to find a basic EA and/or script that will automatically move my T/P a preset amount of pips and start a new S/L in the old T/P original position in case the market decides to turn back around. I don't need it to open new trades, only adjust my T/P just before the market hits the one I originally set. Can anyone point me in the right direction?
 
try this: Hidden TP and SL
 

Flinders, what is the difference between your scenario and a normal trailing stop?

 
JDeel:

Flinders, what is the difference between your scenario and a normal trailing stop?

I need it to also reset the Take Profit at the same time it resets the Stop Loss'

 Basic Example with round numbers to make it easier to explain:

Buy AUDUSD at 1.0500 with TP 1.0600 SL 1.04700

Once market gets to 1.0590 ( just below my TP) it resets my TP to 1.0700 and resets SL to 1.0550 allowing price to climb even further than my original TP and if it starts to drop I still end up with profit even if it hits new SL

Lets say it continues to climb, once it gets to 1.0690 (just below the new TP) it resets my TP to 1.0800 and resets SL to 1.0650, once again allowing it to climb even further or increasing profit levels even if it starts to drop back to my new SL.

 

Currently trying similar EA's on MT4, but not exactly working as I would like.  (Hidden SL and TP was not what I was after but thank you anyway for suggestion "song song")

 

Try this:

#property copyright "meisme"
#property version   "1.00"

#include <Trade\SymbolInfo.mqh>
#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>

//User input
input double THRESHOLD_POINT_DIFFERENCE = 100;

class TPShifter{
   public:
      TPShifter(){
         m_pPosition = new CPositionInfo;
         m_pSymbol = new CSymbolInfo;
         m_pTrade = new CTrade;
         m_pSymbol.Name(Symbol());
          //Computes difference (pip or pipete)
         m_dbPointDifference = THRESHOLD_POINT_DIFFERENCE / (pow(10, m_pSymbol.Digits()));
      }
      ~TPShifter(){
         delete m_pPosition;
         delete m_pSymbol;
         delete m_pTrade;
      }
      void Run(){
         //Check if any open position?
         if (m_pPosition.Select(Symbol()) == true){
            //Yes there is an open position, get current TP and SL
            double dbPrice_TP = m_pPosition.TakeProfit();
            double dbPrice_SL = m_pPosition.StopLoss();
            //Update symbol rate
            m_pSymbol.Refresh();
            m_pSymbol.RefreshRates();
            //Check current order type
            if (m_pPosition.PositionType() == POSITION_TYPE_BUY){
               //Position BUY, use BID price
               //Check if the current bid price already meet the threshold. If yes, move TP and SL
               if (m_pSymbol.Bid() > (dbPrice_TP - m_dbPointDifference)){
                  //Move TP and SL
                  double dbNewPriceTP = NormalizeDouble(dbPrice_TP + m_dbPointDifference, m_pSymbol.Digits());
                  double dbNewPriceSL = NormalizeDouble(dbPrice_SL + m_dbPointDifference, m_pSymbol.Digits());
                  if (m_pTrade.PositionModify(Symbol(), dbNewPriceSL, dbNewPriceTP ) == true)
                     Print(Symbol(), "-(POSITION_TYPE_BUY) SUCCESS to modify TP to: ", dbNewPriceTP, ", SL to: ", dbNewPriceSL);
                  else
                     Print(Symbol(), "-(POSITION_TYPE_BUY) FAILED to modify TP to: ", dbNewPriceTP, ", SL to: ", dbNewPriceSL);
               }
            }else{
               //Position SELL, use ASK price
               //Check if the current bid price already meet the threshold. If yes, move TP and SL
               if (m_pSymbol.Ask() < (dbPrice_TP + m_dbPointDifference)){
                  //Move TP and SL
                  double dbNewPriceTP = NormalizeDouble(dbPrice_TP - m_dbPointDifference, m_pSymbol.Digits());
                  double dbNewPriceSL = NormalizeDouble(dbPrice_SL - m_dbPointDifference, m_pSymbol.Digits());
                  if (m_pTrade.PositionModify(Symbol(), dbNewPriceSL, dbNewPriceTP) == true)
                     Print(Symbol(), "-(POSITION_TYPE_SELL) SUCCESS to modify TP to: ", dbNewPriceTP, ", SL to: ", dbNewPriceSL);
                  else
                     Print(Symbol(), "-(POSITION_TYPE_SELL) FAILED to modify TP to: ", dbNewPriceTP, ", SL to: ", dbNewPriceSL);
               }
            }
         }
      }
      
   private:
      CPositionInfo *m_pPosition;
      CSymbolInfo *m_pSymbol;
      CTrade *m_pTrade;
      double m_dbPointDifference;
};

TPShifter *pTPShifter;
int OnInit(){pTPShifter = new TPShifter;return(0);}
void OnDeinit(const int reason){delete pTPShifter;}
void OnTick(){pTPShifter.Run();}

Don't forget to test and verify it before u use it in your real account. Cheers!

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
 
meisme:

Try this:

Don't forget to test and verify it before u use it in your real account. Cheers!

I need more help, all I'm getting is this message

 

 
Flinders:

I need more help, all I'm getting is this message

 

You used the wrong version of MetaTrader.

Used version 5.

look here https://www.metatrader5.com/en 

MetaTrader 5 Trading Platform for Forex Trading
  • www.metatrader5.com
The MetaTrader 5 Trading Platform is designed to provide brokerage services to traders in Forex, CFD, Futures, as well as stock markets. Become a broker and start rendering services to traders on the financial markets.
Reason: