Orders Execution
It automatically opens orders when conditions are reachedChecks for the total of open ordersIt Closes Orders by itself
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
5.00 %
Total Trades 2191
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -4.34
Gross Profit 531.30
Gross Loss -10032.70
Total Net Profit -9501.40
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
6.00 %
Total Trades 2206
Won Trades 1199
Lost trades 1007
Win Rate 0.54 %
Expected payoff -4.31
Gross Profit 605.10
Gross Loss -10106.40
Total Net Profit -9501.30
-100%
-50%
0%
50%
100%
Lucky_code
//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+

double a, b; 
bool first=true; 
extern int Shift = 3; 
extern int Limit = 18;




//---------------------------------------------------------------------------- 
int start()
{ 
  if (first) 
   {
      a=Ask; 
      b=Bid; 
      first=false; 
      return(0);
   } 
 
  if (Ask-a>=Shift*Point) 
    {
    OrderSend(Symbol(),OP_SELL,GetLots(),Bid,3,0,0,"",0,0,CLR_NONE);
    } 
  if (b-Bid>=Shift*Point) 
    {
    OrderSend(Symbol(),OP_BUY,GetLots(),Ask,3,0,0,"",0,0,CLR_NONE);
    } 

  a=Ask;  
  b=Bid; 
  
  CloseAll(); 
return(0);} 
//----------------------------------------------------------------------------- 
void CloseAll() 
{ 
  for (int cnt = OrdersTotal()-1 ; cnt >= 0; cnt--) 
  { 
    OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); 
    if (OrderSymbol() == Symbol()) 
    { 
      if ((OrderProfit()>0)) 
      { 
        if(OrderType()==OP_BUY)  OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NONE); 
        if(OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,3,CLR_NONE); 
      } 
      else 
      { 
        if((OrderType()==OP_BUY)  && (((OrderOpenPrice()-Ask)/Point) > Limit)) 
          OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NONE); 
        if((OrderType()==OP_SELL) && (((Bid-OrderOpenPrice())/Point) > Limit)) 
          OrderClose(OrderTicket(),OrderLots(),Ask,3,CLR_NONE); 
      } 
    } 
  } 
} 



//-------------------------------------------------------------------------- 



double GetLots() 
{ 

return (NormalizeDouble(AccountFreeMargin()/10000,1)); 
  
} 
//------------------------------------------------------------------------- 


Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---