# any close at equity and rise after x pips ea pleace

182

any close at equity and rise after x pips ea pleace
Moderator
10569

amitkk:
any close at equity and rise after x pips ea pleace

I've no idea what you are asking ???
182

```//|\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$
//|              Close
//|   Last Updated 12-12-2006 10:00pm

//UseEquityRaiseAfterClose
//When this is set to true, it will utilize this "Equity Raise After Close" function.

///EquityRaisedByXAfterClose
//This indicates how much equity that will be raised after the it closes all positions.

//Calculation for this is:
//New Equity Target = Original Equity Target + EquityRaisedByXAfterClose.

//RunEquityRaiseContinuously
//When this is set to true, it will run this new "Equity Raise" continuously after each "Close All Positions" function is performed. When this is set to false, it will run this new "Equity Raise" just once after a "Close All Positions" is performed.
//|\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$
#define     NL    "\n"

extern int    EquityTarget     = 25;             // closes all orders once Equity hits this \$ amount
extern bool UseEquityRaiseAfterClose = true;
extern bool EquityRaisedByXAfterClose = 25;
extern bool RunEquityRaiseContinuously = true;

extern bool   CloseAllNow      = false;          // closes all orders now
extern double ProftableTradeAmount      = 1;     // Only trades above this amount close out
extern bool   ClosePendingOnly = false;          // closes pending orders only

bool run_status = false;
//+-------------+
//| Custom init |
//|-------------+
int init()
{

}

//+----------------+
//| Custom DE-init |
//+----------------+
int deinit()
{

}

//+------------------------------------------------------------------------+
//| Closes everything
//+------------------------------------------------------------------------+
void CloseAll()
{
for(int i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
bool result = false;
if ( OrderType() == OP_BUY)  result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
if ( OrderType() == OP_SELL)  result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
if ( OrderType()== OP_BUYSTOP)  result = OrderDelete( OrderTicket() );
if ( OrderType()== OP_SELLSTOP)  result = OrderDelete( OrderTicket() );
}
return;
}

//+------------------------------------------------------------------------+
//| cancels all orders that are in profit
//+------------------------------------------------------------------------+
void CloseAllinProfit()
{
for(int i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
bool result = false;
if ( OrderType() == OP_BUY && OrderProfit()+OrderSwap()>ProftableTradeAmount)  result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
if ( OrderType() == OP_SELL && OrderProfit()+OrderSwap()>ProftableTradeAmount)  result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
}
return;
}

//+------------------------------------------------------------------------+
//| cancels all pending orders
//+------------------------------------------------------------------------+
void ClosePendingOrdersOnly()
{
for(int i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
bool result = false;
if ( OrderType()== OP_BUYSTOP)   result = OrderDelete( OrderTicket() );
if ( OrderType()== OP_SELLSTOP)  result = OrderDelete( OrderTicket() );
}
return;
}

//+-----------+
//| Main      |
//+-----------+
int start()
{

//+------------------------------------------------------------------+
//  Determine last order price                                       |
//-------------------------------------------------------------------+
for(int i=0;i<OrdersTotal();i++)
{
if(OrderType()==OP_SELL) SellLots += OrderLots();
if(OrderType() == OP_SELL)  SellProfit += OrderProfit() + OrderCommission() + OrderSwap();
}

if(CloseAllNow) CloseAll();

if(AccountEquity() >= EquityTarget)
{
CloseAll();
if(RunEquityRaiseContinuously==true)
{
run_status = false;
}
if(UseEquityRaiseAfterClose == true && run_status == false)
{
EquityTarget = EquityTarget + EquityRaisedByXAfterClose;
run_status = true;
}
}
if(ClosePendingOnly) ClosePendingOrdersOnly();

Comment("                            Comments Last Update 12-12-2006 10:00pm", NL,
"                            SellLots        ", SellLots, NL,
"                            Balance ", AccountBalance(), NL,
"                            Equity        ", AccountEquity(), NL,
"                            Margin              ", AccountMargin(), NL,
"                            MarginPercent        ", MathRound((AccountEquity()/AccountMargin())*100), NL,
"                            Current Time is  ",TimeHour(CurTime()),":",TimeMinute(CurTime()),".",TimeSeconds(CurTime()));
} // start()

```
182

```extern bool EquityRaisedByXAfterClose = 25;
```
change bool by int. but even after it has no work only close at equity not rise. need proper setting
Moderator
10569

amitkk:
change bool by int. but even after it has no work only close at equity not rise. need proper setting

Why would you give a bool the value 25 ??