View Single Post
  #1 (permalink)  
Old 07-02-2006, 11:12 PM
DaytrSuccess DaytrSuccess is offline
Junior Member
 
Join Date: Jun 2006
Posts: 23
DaytrSuccess is on a distinguished road
need help coding a simple trailing stop

hello,

I am a newbie for this.

I tried to code a simple trailing stop but something is wrong.
When I compile the result is : unbalenced parenthesis (at the end.)

Please tell me the mistake(s) and if you are kind enough to explain : use simple words I am not a native english speaker.

Thank you.

Here is rhe code :
-----------------------------------
int start()
{
int cnt, totalOrders;
totalOrders = OrdersTotal();

if (totalOrders>0) // open orders identified
{
for (cnt=1;cnt<totalOrders;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_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);
}
}
}
}
}
Reply With Quote