Orders Execution
0
Views
0
Downloads
0
Favorites
Profitability Reports
AUD/USD
Oct 2024 - Jan 2025
76.00 %
Total Trades
785
Won Trades
0
Lost trades
0
Win Rate
0.00 %
Expected payoff
-10.32
Gross Profit
25125.00
Gross Loss
-33230.00
Total Net Profit
-8105.00
-100%
-50%
0%
50%
100%
GBP/USD
Oct 2024 - Jan 2025
58.00 %
Total Trades
361
Won Trades
95
Lost trades
266
Win Rate
0.26 %
Expected payoff
-26.66
Gross Profit
13192.00
Gross Loss
-22818.00
Total Net Profit
-9626.00
-100%
-50%
0%
50%
100%
testEA3
//+------------------------------------------------------------------+
//| testEA3.mq4 |
//| rem |
//| |
//+------------------------------------------------------------------+
#property copyright "rem"
#property link ""
extern double Lots = 1;
int start()
{
int cnt, ticket, total;
total=OrdersTotal();
if(total<1)
{
// no opened orders identified
if(AccountFreeMargin()<(1000*Lots))
{
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
// check for long position (BUY) possibility
if(Close[1] > Close[2])
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,0,0,0,"testEA3",16384,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
// check for short position (SELL) possibility
if(Close[1] < Close[2])
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,0,0,0,"testEA3",16384,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
}
return(0);
}
// it is important to enter the market correctly,
// but it is more important to exit it correctly...
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && // check for opened position
OrderSymbol()==Symbol()) // check for symbol
{
if(OrderType()==OP_BUY) // long position is opened
{
// should it be Closed?
if(Close[1] < Close[2])
{
OrderClose(OrderTicket(),OrderLots(),Bid,0,Violet); // Close position
// + open a new one
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,0,0,0,"testEA2",16384,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0); // exit
}
}
else // go to short position
{
// should it be Closed?
if(Close[1] > Close[2])
{
OrderClose(OrderTicket(),OrderLots(),Ask,0,Violet); // Close position
// + open a new one
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,0,0,0,"testEA2",16384,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0); // exit
}
}
}
}
return(0);
}
// the end.
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---