MetaTrader 5 for Android - Enjoy Convenient Mobility
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?

 
Max Keiser: Capitalism without capital? - Video
Max Keiser: Capitalism without capital? - Video
Alice F | 28 March 2015, 15:33 | Views: 107
"Capitalism without capital" - that's how the recent conversation between Max Keiser and Stacy Herbert is called. This time the two analysts discuss why a French may work 20 percent less to produce the same output an average British worker produces, and why an overly burdened UK household in a speculative economy is producing less and less value.
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