View Single Post
  #2 (permalink)  
Old 04-24-2006, 03:59 PM
Sonic Sonic is offline
Junior Member
 
Join Date: Apr 2006
Posts: 7
Sonic is on a distinguished road
Arrow

Quote:
Originally Posted by cardio
hi

Does anyone have an ea that splits the trade at certain profit levels, e.i. Enter trade - when 30 pips in profit sell half of trade, when at 50 pips profit sell 30% of original etc.

I am getting myself into a serious knot trying to code this.

Any help is greatly appreciated.

Thanks
hi cardio.

i am also in process creating my ea and woking for same kind of functionality.
take this as an example.

double exit1 = 30;
double exit2 = 60;
double exit3 = 90;
// above three lines are there for profit levels..
//
if(OrderType() == OP_SELL) and if(OrderType() == OP_BUY)
you must have this code for buy and sell where you close your open positions right?
below these lines you need to add the condition to close the above 3 exits

lets use for sell and only 1
///
static int lots = { number of lots } // this is just to control the lots..
if{ normal stuff}

else if ( Ask < OrderOpenPrice() - exit1 ) * Point && lots >= {number} )
{
CloseOrder{}...
lots--;
}

-- more else if'sssss

////

this is one way to do it

hope this helps..!
-sonic.
Reply With Quote