View Single Post
  #2 (permalink)  
Old 07-03-2006, 12:31 AM
firedave's Avatar
firedave firedave is offline
Senior Member
 
Join Date: Nov 2005
Location: Jakarta, Indonesia
Posts: 416
firedave is on a distinguished road
Try this :

PHP Code:
int start()
{
int cnttotalOrders;
totalOrders OrdersTotal();

if (
totalOrders>0// open orders identified
{
for (
cnt=1;cnt<totalOrders;cnt++)
{
OrderSelect(cntSELECT_BY_POSMODE_TRADES);
if ((
OrderType() == OP_BUY) && ((Bid-OrderOpenPrice())>TrailingStop))
{
if(
OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*Point,OrderTakeProfit(),YellowGreen); 
return(
0);
}
}
else ((
OrderType() == OP_SELL) && (OrderOpenPrice()-Ask)>(TrailingStop))

if ((
OrderStopLoss()>Ask+TrailingStop*Point) || (OrderStopLoss()=0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Tra ilingStop*Point,OrderTakeProfit(),Red);
return (
0);
}
}
}
}

Hope this help
__________________
David Michael H
"Trader helps traders with sincerity, honesty and integrity"
Reply With Quote