UpDn-leksus-money

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
31.00 %
Total Trades 313
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -31.80
Gross Profit 4558.10
Gross Loss -14511.00
Total Net Profit -9952.90
-100%
-50%
0%
50%
100%
GBP/CAD Oct 2024 - Jan 2025
0.00 %
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
21.00 %
Total Trades 393
Won Trades 214
Lost trades 179
Win Rate 0.54 %
Expected payoff -25.29
Gross Profit 2673.20
Gross Loss -12613.20
Total Net Profit -9940.00
-100%
-50%
0%
50%
100%
UpDn-leksus-money
//+------------------------------------------------------------------+
extern double Lots         =  100;
extern int    StopLoss     = 30;
extern int    TakeProfit   =  11;
extern int    TrailingStop =  5;
extern double minLots      =  0;
extern bool   UseMG        = true;

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

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

  ord_lot = Lots;
  if(minLots!=0) Lots=minLots;
  else
  {
    if(UseMG)
    {
      for(i=HistoryTotal()-1; i>=0; i--)
      {
        if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; }
        if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue; // ÙÐÍ ÍÐÊÍÔÅÌØÈ ÍÏÄÅÏ 
        //----
        if(OrderProfit()>0)
        {
          ord_lot = NormalizeDouble(OrderLots()/2,1);
          if(ord_lot<10) ord_lot=10;
          break;
        }
        if(OrderProfit()<0 && OrderClosePrice() == OrderStopLoss())
        {
          ord_lot = OrderLots()*MathRound(StopLoss/TakeProfit);  
          if(ord_lot < Lots) ord_lot=Lots;
          if(ord_lot > NormalizeDouble(AccountFreeMargin()/1000.0,1)) ord_lot = NormalizeDouble(AccountFreeMargin()/1000.0,1);        
          break;
        }
      }
    }
    if (StringSubstr(Symbol(),3,3) == "USD")
    { if (ord_lot > NormalizeDouble(AccountFreeMargin()/1000.0/Bid,1)) ord_lot = NormalizeDouble(AccountFreeMargin()/1000.0/Bid,1); }
  }

  SLoss=0;
  if(OrdersTotal()<1) // ÌÅÐ ÌÕ ÍÄÌÍÖÍ ÍÐÉÏØÐÍÖÍ ÍÏÄÅÏÞ ÎÏÍÁÅÏÚÅË ÌÞ ÁÍÃËÍÔÌÍßÐÝ ÁßÐÞÐÝ Á ÉÍÏÍÐÉÑ× ÎÍÃÕÆÕ× (SELL)
  {
    if(pos1pre>pos2cur && pos2cur>0)
    {
      if(StopLoss!=0) SLoss=Ask+StopLoss*Point;
      OrderSend(Symbol(),OP_SELL,ord_lot,Bid,3,SLoss,Bid-TakeProfit*Point,0,0,CLR_NONE); // íÐÉÏØÁÞÅË ÉÍÏÍÐÉÑ× 
      if(!IsDemo()) Sleep(15000);
      return(0); // ÁØÓÍÄÕË
    } 

    if(pos2cur<0)
    {
      if(StopLoss!=0) SLoss=Bid-StopLoss*Point;
      OrderSend(Symbol(),OP_BUY,ord_lot,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 ---