Thread: Wma 5/20 - Ema
View Single Post
  #82 (permalink)  
Old 01-11-2006, 10:59 AM
Kalenzo's Avatar
Kalenzo Kalenzo is offline
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 696
Kalenzo is on a distinguished road
What time frame to use?

About tralingstop:
void TrailStop(string mySymbol) {
double StopLoss,trailing;//init variables

if ( TrailingStop>=8 ) {//ts lvl must be not less than 8 pips
trailing=TrailingStop*Point;//ts convert to pips
for (int i = 0; i < OrdersTotal(); i++) {//check every order

if ( OrderSelect (i, SELECT_BY_POS) == false ) continue;//no order - no action
if ( OrderSymbol() != mySymbol || OrderMagicNumber() != MAGICNUM ) continue;//if order was not open by EA - no action

if ( OrderType() == OP_BUY ) {
StopLoss = Bid-trailing;//count sl from current price
if ( StopLoss > OrderStopLoss() ) {//if we can move it to our profit than do it
OrderModify (OrderTicket(), OrderOpenPrice(), StopLoss, OrderTakeProfit(), 0, White);
}
}

if ( OrderType() == OP_SELL ) {
StopLoss = Ask+trailing;
if ( StopLoss < OrderStopLoss() ) {
OrderModify (OrderTicket(), OrderOpenPrice(), StopLoss, OrderTakeProfit(), 0, Gold);
}
}
}
}
return;
}


Yes I'm using that idea from some time - it has a weak points but for our system this could make a nice profit or protect. If we use that SL and TP like 10 pip this could be nice profit.
Reply With Quote