Orders Execution
1
Views
0
Downloads
0
Favorites
Profitability Reports
200.00 %
Total Trades
2
Won Trades
1
Lost trades
1
Win Rate
50.00 %
Expected payoff
12.50
Gross Profit
50.00
Gross Loss
-25.00
Total Net Profit
25.00
-100%
-50%
0%
50%
100%
GBPUSDADR14
//+------------------------------------------------------------------+
//| GBPUSDADR14.mq4 |
//| Copyright © 2007, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
int barant = 999999999;
int Lote = 1;
int ticket = 0;
int media14 = 0;
double soma14 = 0;
int aberturaVenda;
int aberturaCompra;
bool isComprou;
bool isVendeu;
int sl100 = 15;
int tp100 = 30;
int sl175 = 20;
int tp175 = 40;
int sl200 = 25;
int tp200 = 50;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
if(barant != Bars){
for(int i = 1; i<=14; i++){
soma14 += High[i] - Low[i];
}
media14 = (soma14/14)/Point;
Print("Media dos 14 dias é: "+media14);
}
soma14 = 0;
barant = Bars;
if(Hour() == 17 && Minute() == 0){
for(int j=0; j<OrdersTotal(); j++){
if(OrderSelect(j,SELECT_BY_POS) == true){
OrderClose(OrderTicket(), 1, Ask, 3, Red);
}
}
isComprou = false;
isVendeu = false;
return(0);
}
if(media14 < 100)
return(0);
if(media14 >= 100 && media14 < 175){
aberturaVenda = (Low[1]/Point) - (Bid/Point);
aberturaCompra = (High[1]/Point) - (Ask/Point);
if(aberturaCompra == 0 && !isComprou){
ticket=OrderSend(Symbol(),OP_BUY, Lote,Ask, 3,Ask - sl100*Point,Ask + tp100*Point,"Comprando GBP",0,0,Red);
if(ticket<0)
Print("OrderSend failed with error #",GetLastError());
isComprou = true;
return(0);
}
if(aberturaVenda == 0 && !isVendeu){
ticket=OrderSend(Symbol(),OP_SELL, Lote,Bid, 3,Bid + sl100*Point,Bid - tp100*Point,"Vendendo GBP",0,0,Red);
if(ticket<0)
Print("OrderSend failed with error #",GetLastError());
isVendeu = true;
return(0);
}
}
if(media14 >= 175 && media14 <= 199){
aberturaVenda = (Low[1]/Point) - (Bid/Point);
aberturaCompra = (High[1]/Point) - (Ask/Point);
if(aberturaCompra == 0 && !isComprou){
ticket=OrderSend(Symbol(),OP_BUY, Lote,Ask, 3,Ask - sl175*Point,Ask + tp175*Point,"Comprando GBP",0,0,Red);
if(ticket<0)
Print("OrderSend failed with error #",GetLastError());
isComprou = true;
return(0);
}
if(aberturaVenda == 0 && !isVendeu){
ticket=OrderSend(Symbol(),OP_SELL, Lote,Bid, 3,Bid + sl175*Point,Bid - tp175*Point,"Vendendo GBP",0,0,Red);
if(ticket<0)
Print("OrderSend failed with error #",GetLastError());
isVendeu = true;
return(0);
}
}
if(media14 >= 200){
aberturaVenda = (Low[1]/Point) - (Bid/Point);
aberturaCompra = (High[1]/Point) - (Ask/Point);
if(aberturaCompra == 0 && !isComprou){
ticket=OrderSend(Symbol(),OP_BUY, Lote,Ask, 3,Ask - sl200*Point,Ask + tp200*Point,"Comprando GBP",0,0,Red);
if(ticket<0)
Print("OrderSend failed with error #",GetLastError());
isComprou = true;
return(0);
}
if(aberturaVenda == 0 && !isVendeu){
ticket=OrderSend(Symbol(),OP_SELL, Lote,Bid, 3,Bid + sl200*Point,Bid - tp200*Point,"Vendendo GBP",0,0,Red);
if(ticket<0)
Print("OrderSend failed with error #",GetLastError());
isVendeu = true;
return(0);
}
}
return(0);
}
//+------------------------------------------------------------------+
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
---