trailingstop

 
I would like to ask about Trailing Stop of MT4.

In MT4, Trailing Stop doesnt function as long as the position doesnt 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 opened price of the position ?
(In softwares of FX broker that I traded before in, It was possible.)
Is it possible to resolve this problem by EA?
 
Hi may,

It is possible to resolve your problem by EA. ))
 
Hi may,

It is possible to resolve your problem by EA. ))


Thank you , RickD.
Would you offer the EA for nothing , please ?
 
Here's some code for anyone to try in your EA and modify as you wish - of course, all the usual stuff applies: I'm not responsible for it, or it's results, test it and use it at your own risk. I did put it in a little script to make sure it at least compiled correctly. By the way, if anybody sees any way this can be improved, let me know. I'm open to comments and criticism.

int start()
{
int i = 0;
int TrailingStop = 20;
if ( OrdersTotal() > 0 && TrailingStop > 0 )
for ( i = OrdersTotal()-1; i >= 0; i-- ) // pass through orders
if ( OrderSelect( i, SELECT_BY_POS, MODE_TRADES ) && OrderSymbol() == Symbol() && OrderType() < 2 ) // if buy/sell orders exist for this symbol
{
if( ( OrderType() == OP_BUY ) && ( Bid - OrderOpenPrice() > ( Point*TrailingStop ) ) && ( ( OrderStopLoss() < Bid - ( Point*TrailingStop ) ) || ( OrderStopLoss() == 0 ) ) )
OrderModify( OrderTicket(), OrderOpenPrice(), Bid - Point*TrailingStop, OrderTakeProfit(), 0, Green );
if( ( OrderType() == OP_SELL ) && ( OrderOpenPrice() - Ask > ( Point*TrailingStop ) ) && ( ( OrderStopLoss() > Ask + ( Point*TrailingStop ) ) || ( OrderStopLoss() == 0 ) ) )
OrderModify( OrderTicket(), OrderOpenPrice(), Ask + Point*TrailingStop, OrderTakeProfit(), 0, Red );
}
return(0);
}
 
Thank you BillR.
But it may difficult for me to use this code .
I do not know how to edit it in Meta edit to make it effective as EA because I am a beginer.
But I try.
 
This is just one small script to show you an example of how to implement a trailing stop; it's not even close to an EA. To learn, I'd suggest looking at the example EAs that you have with the platform, or find some on the web. If you know some programming already, you'll see how they work.
 
This is just one small script to show you an example of how to implement a trailing stop; it's not even close to an EA. To learn, I'd suggest looking at the example EAs that you have with the platform, or find some on the web. If you know some programming already, you'll see how they work.


Thank you BillR.
Reason: