Freelancer services needed to perform 150+ jobs of traders
MQL4.com is moving to MQL5.com. Sign up for the new web portal for traders!

Trailing Stop

Back to topics list To post a new topic, please log in or register
avatar
22
maymay 2007.05.30 08:35
 

I would like to ask about Trailing Stop of MT4.
In MT4, Trailing Stop doesn`t function as long as the position doesn`t gain
as much profit as the number of Trailing Stop ( 15pips, 20pips...) first of all.
Is it possible to make Trailing Stop function from the open price of position ?
(In softwares of FX broker I traded before in , it was possible .)
Is it possible to resolve this problem by EA?

 
Trading News Events: U.S. Gross Domestic Product (GDP) - Slowest Pace of Growth Since the Contraction in 1Q 2014
A marked downward revision in the U.S. growth rate may generate a short-term rebound in EUR/USD should the preliminary 4Q Gross Domestic Product (GDP) report dampen bets for a mid-2015 Fed rate hike. What’s Expected: Why Is This Event Important: Despite bets for higher borrowing-costs, further weakness in the core Personal Consumption Expenditure (PCE), the Fed’s preferred gauge for inflation, may push Chair Janet Yellen to endorse a wait-and-see approach and further delay the normalization cycle as the central bank struggles to achieve the 2% target for price growth.
avatar
231
fireflies 2007.05.31 05:56 #
 
if( OrderSelect(ticket,SELECT_BY_TICKET) && OrderCloseTime()==0 ) {
    if( OrderType()==OP_BUY ) {
        OrderModify(OrderTicket(),OrderOpenPrice(),Open[0]-Point*TrailingStop,OrderTakeProfit(),0);
    }
    else if( OrderType()==OP_SELL ) {
        OrderModify(OrderTicket(),OrderOpenPrice(),Open[0]+Point*TrailingStop,OrderTakeProfit(),0);
    }
}
Look at the OrderModify documentation for more explanation and sample.
avatar
22
maymay 2007.05.31 14:38 #
 
fireflies wrote:
if( OrderSelect(ticket,SELECT_BY_TICKET) && OrderCloseTime()==0 ) {
    if( OrderType()==OP_BUY ) {
        OrderModify(OrderTicket(),OrderOpenPrice(),Open[0]-Point*TrailingStop,OrderTakeProfit(),0);
    }
    else if( OrderType()==OP_SELL ) {
        OrderModify(OrderTicket(),OrderOpenPrice(),Open[0]+Point*TrailingStop,OrderTakeProfit(),0);
    }
}
Look at the OrderModify documentation for more explanation and sample.
Thank you firefiles.
But it may be difficult for me to use it because it is a script ,not EA.
I don`t know where to write the number of Trailing Stop and how to edit this script in Meta edit .
I am a beginer.
But I try.
 
avatar
231
fireflies 2007.06.01 05:38 #
 
maymay wrote:

Thank you firefiles.
But it may be difficult for me to use it because it is a script ,not EA.
I don`t know where to write the number of Trailing Stop and how to edit this script in Meta edit .
I am a beginer.
But I try.

It's not a script or EA, just a snippet of codes that may solve your problem.
If you're not yet familiar with programming, MQL4 in particular, you better try to use and tweak some existing EAs.
Look in CodeBase tab above for the repository.

 
avatar
22
maymay 2007.06.01 08:54 #
 
fireflies wrote:
maymay wrote:

Thank you firefiles.
But it may be difficult for me to use it because it is a script ,not EA.
I don`t know where to write the number of Trailing Stop and how to edit this script in Meta edit .
I am a beginer.
But I try.

It's not a script or EA, just a snippet of codes that may solve your problem.
If you're not yet familiar with programming, MQL4 in particular, you better try to use and tweak some existing EAs.
Look in CodeBase tab above for the repository.


Thank you , firefiles.
But I could not find EA which mached to my desire in CodeBase tab.
In fact , I could find such EA in the different forum of MT4.
http://www.forex-tsd.com/metatrader-4/7861-possible-make-trailing-stop-function-open-price-position. html
It may be  precious for many FX traders. 
 
avatar
1
anup1965 2008.12.30 07:38 #
 

The correct thread is

Trailing Stop EA

http://www.forex-tsd.com/expert-advisors-metatrader-4/4844-help-needed-making-perfect-trailing-stop-ea-2.html


Really a very nice trailing stop EA.

 
avatar
1
insanitysnake 2012.12.10 23:15 #
 

Thanks.... Very nice useful script...

My EA very good now... I testing others configs now... Thanks a Lot! 

 
Back to topics list  

To add comments, please log in or register