I also wrote in this way
void PositionCloseAll ()
{
for ( double eq = StartingEquity; eq <= StartingEquity*2; eq++ )
{
if ( AccountEquity() >= eq * 1.1 ||
AccountEquity() <= eq * 0.9 )
{
PositionClose();
}
}
}

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello. I hope someone could guide me with my code below.
This is different from AccountProfit for I need to track only the Equity
of my account, more often to profit side before closing all positions
in my portfolio.
Thanks.
//-------------------------------------------------------------------+
// Equity Function |
//-------------------------------------------------------------------+
void Equity ( )
{
if ( AccountEquity ( ) <= StartingEquity ) return;
for( int cnt = StartingEquity; cnt >= StartingEquity; cnt++ )
{
if ( AccountEquity ( ) >= StartingEquity * 1.1 )
{
if ( OrderClose ( OrderTicket ( ), OrderLots ( ), OrderClosePrice ( ), Slippage, clrNONE ) ) Print ( "Close order success" );
else Print ( "Close order failed" );
}
}
}