UpDn-leksus

Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It automatically opens orders when conditions are reached
Indicators Used
Bulls Power indicator
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
20.00 %
Total Trades 650
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -15.12
Gross Profit 2438.00
Gross Loss -12264.00
Total Net Profit -9826.00
-100%
-50%
0%
50%
100%
GBP/CAD Oct 2024 - Jan 2025
0.00 %
Total Trades 56
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -173.92
Gross Profit 28.91
Gross Loss -9768.44
Total Net Profit -9739.53
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
18.00 %
Total Trades 587
Won Trades 325
Lost trades 262
Win Rate 0.55 %
Expected payoff -16.40
Gross Profit 2147.00
Gross Loss -11773.00
Total Net Profit -9626.00
-100%
-50%
0%
50%
100%
UpDn-leksus
//+------------------------------------------------------------------+
extern double    Lots         =  1;
extern int       StopLoss     = 30;
extern int       TakeProfit   =  7;
extern int       TrailingStop =  5;

int      LastTotal;
datetime LastTime;
//+------------------------------------------------------------------+
int init()   { return(0); }
int deinit() { return(0); }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{
  int cnt;
  double pos1pre,pos2cur,SLoss;

  pos1pre = iBullsPower(NULL,0,13,PRICE_WEIGHTED,1);
  pos2cur = iBullsPower(NULL,0,13,PRICE_WEIGHTED,0);

  if(pos1pre>pos2cur) //çàêðûâàåì äëèííóþ ïîçèöèþ 
  {
    for(cnt=0; cnt<OrdersTotal(); cnt++)
    {
      OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
      if(OrderType()==OP_BUY) // îòêðûòà äëèííàÿ ïîçèöèÿ
  		{
      	if(Bid>(OrderOpenPrice())+TrailingStop*Point)
        {
          OrderClose(OrderTicket(),OrderLots(),Bid,3); // çàêðûâàåì ïîçèöèþ
          return(0); // âûõîäèì
    		}
  		}
    }
  }

  if(pos2cur<0) //çàêðûâàåì êîðîòêóþ ïîçèöèþ
  {
    for(cnt=0; cnt<OrdersTotal(); cnt++)
    {
      OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
      if(Ask<OrderOpenPrice()-TrailingStop*Point)
      {
        if(OrderType()==OP_SELL) // îòêðûòà êîðîòêàÿ  ïîçèöèÿ
        {
          OrderClose(OrderTicket(),OrderLots(),Ask,3); // çàêðûâàåì ïîçèöèþ
          return(0); // âûõîäèì
       	}    
      } 
   	}
  }

  if(OrdersTotal()<LastTotal) LastTime=Time[0]+Period()*60;
  LastTotal=OrdersTotal();

  if(CurTime()<LastTime) return(0);

  SLoss=0;
  if(OrdersTotal()<1) // íåò íè îäíîãî îòêðûòîãî îðäåðà ïðîâåðÿåì íà âîçìîæíîñòü âñòàòü â êîðîòêóþ ïîçèöèþ (SELL)
  {
    if(pos1pre>pos2cur && pos2cur>0)
    {
      if(StopLoss!=0) SLoss=Ask+StopLoss*Point;
      OrderSend(Symbol(),OP_SELL,Lots,Bid,3,SLoss,Bid-TakeProfit*Point,0,0,CLR_NONE); // Îòêðûâàåì êîðîòêóþ 
      return(0); // âûõîäèì
    } 

    if(pos2cur<0)
    {
      if(StopLoss!=0) SLoss=Bid-StopLoss*Point;
      OrderSend(Symbol(),OP_BUY,Lots,Ask,3,SLoss,Ask+TakeProfit*Point,0,0,CLR_NONE); // Îòêðûâàåì êîðîòêóþ 
      return(0); // âûõîäèì
    } 
  }

  return(0);
}
//+------------------------------------------------------------------+

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 ---