UpDn-Leksus-mm-last

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
1 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
25.00 %
Total Trades 657
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -15.15
Gross Profit 3256.10
Gross Loss -13207.50
Total Net Profit -9951.40
-100%
-50%
0%
50%
100%
GBP/CAD Oct 2024 - Jan 2025
1.00 %
Total Trades 32
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -311.07
Gross Profit 52.84
Gross Loss -10006.94
Total Net Profit -9954.10
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
17.00 %
Total Trades 550
Won Trades 281
Lost trades 269
Win Rate 0.51 %
Expected payoff -18.07
Gross Profit 2079.50
Gross Loss -12019.20
Total Net Profit -9939.70
-100%
-50%
0%
50%
100%
UpDn-Leksus-mm-last
//+------------------------------------------------------------------+
extern double Lots         =  0.8;
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(OrderSymbol()==Symbol())
      {
        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(OrderSymbol()==Symbol())
      {
        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<0.1) ord_lot=0.1;
          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 ---