Author: Maximus_genuine
Profit factor:
1.14

Here's a breakdown of what this MQL script does, explained in plain language:

This script is designed to automatically place buy and sell orders in the Forex market, aiming to profit from price fluctuations. It's like a mini-robot trader that follows a specific set of rules.

Initialization (Setting the Stage):

  • The script starts by defining several settings that control its behavior. These settings are like knobs and switches that you can adjust.

    • Royal: This sets a sensitivity level (like a risk tolerance). It determines how likely the script is to place trades based on a random number comparison. A higher number means the script needs a "luckier" random number to trade.
    • SL: This sets the Stop Loss level, in points. This is a safety net. When the trade moves unfavorably by this amount, the trade is automatically closed to limit losses.
    • In_BUY and In_SELL: These are on/off switches to allow the script to place buy orders (if In_BUY is set to true) and sell orders (if In_SELL is set to true). If set to false, the robot is no longer allowed to buy/sell
  • It then adjusts some internal variables based on market conditions.

  • It sets the amount of points you'd like to trade

The Trading Logic (The Brain):

  1. Time Check: The script only runs once per minute. It prevents itself from running too frequently by remembering the last time it ran and only proceeding if the current time is different.

  2. Trade Permission: Before doing anything, it checks if trading is allowed by the broker (e.g., the market isn't closed). If trading is not allowed, it pauses for a bit and tries again later.

  3. Order Placement Decision: The heart of the script is a function called My_Play. It determines whether to place a buy or sell order based on several factors:

    • Enable/Disable Switch (flag): The In_BUY or In_SELL setting (from above) acts as an on/off switch. If it's off, the script won't place trades in that direction (buy or sell).
    • Heuristic Check (a1 > a2): This is a simple rule that must be met for the script to trade. The script is evaluating whether to trade a certain way. The script checks a market indicator. If that indicator moves past the current market conditions then it has a higher chance of trading.
    • Random Number Check (level > Rand): This is a "luck" factor. The script generates a random number and compares it to the Royal setting (represented internally as a level from 2-16422). If the random number is lower than this level, the script proceeds. This adds an element of chance to the trading decisions.
    • Trade Allowed: It re-checks if trading is allowed.
  4. Order Execution: If all the conditions are met, the script places a buy or sell order in the market.

    • It uses a fixed lot size (0.1).
    • It sets a stop-loss level (SL) to limit potential losses.
    • It sets a take-profit level (TP) to automatically close the trade when a certain profit is reached.
  5. Error Handling: After placing the order, the script checks if the order was successfully placed. If there was an error, it pauses and tries again later.

In Summary:

The script is essentially a very simple trading robot that uses a combination of a market indicator, a luck factor, and user-defined settings to place buy and sell orders. It aims to automate trading while limiting potential losses.

Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reached
Indicators Used
Moving average indicator
10 Views
0 Downloads
0 Favorites
Poker_SHOW
//+------------------------------------------------------------------+
//|                                                   Poker_SHOW.mq4 |
//|                                                  Maximus_genuine |
//|                                              gladmxm@bigmir.net  |
//+------------------------------------------------------------------+
#property copyright "Maximus_genuine"
#property link      "gladmxm@bigmir.net "

//---- input parameters

//..........................................................................

extern int       Royal=8; // ----¹ ïîêåðíîé êîìáèíàöèè 
extern int       SL =89; // óðîâåíü ñòîï-ëîññà â ïóíêòàõ 
//..........................................................................
extern bool      In_BUY   =true;    //---âõîä â ëîíã
extern bool      In_SELL   =true;   //---âõîä â øîðò   

 
//..........................................................................

 
 
//---- other parameters
   static int  prevtime=0;
          int    ticket=0;
          int         x=1;
          int level=16422;
          int    TP=   20;
       //-------------------------
          int Magic_BUY  =123;
          int Magic_SELL =321;
         
 
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//--------------------------------
      if(Digits == 5) x=10;
      
      MathSrand(TimeCurrent());
//--------------------------------
    if (SL< 20) SL=20; TP=MathRound(1.618*SL);
//--------------------------------
    if (Royal==0) level=2;
    if (Royal==1) level=9;
    if (Royal==2) level=49;
    if (Royal==3) level=66;
    if (Royal==4) level=130;
    if (Royal==5) level=699;
    if (Royal==6) level=1562;
    if (Royal==7) level=13846;
 // if (Royal==8) level=16422;
//--------------------------------
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//..........................................................................
    if (Time[0] == prevtime) return(0); 
                             prevtime = Time[0];
    if (!IsTradeAllowed()) {
     prevtime=Time[1]; Sleep(30000 + MathRand());  //--- ôîðìèðîâêà áàðà---
                           }
//..........................................................................
 
 
 My_Play( Magic_BUY, In_BUY, level,Ask,iMA(NULL,0,89,5,MODE_EMA,PRICE_OPEN,0));    //---òîðãîâëÿ ïî ëîíãàì
   
   
 My_Play(Magic_SELL,In_SELL,level,iMA(NULL,0,89,5,MODE_EMA,PRICE_OPEN,0),Bid);  //---òîðãîâëÿ  ïî øîðòàì
   
   
//..........................................................................
   return(0);//-----------âûõîä èç ñòàðòîâîé ôóíêöèè------------
  }
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
void  My_Play(int mn,bool flag,int level,double a1,double a2) { 
 
         int total=OrdersTotal();
         
    for (int i = 0; i < total; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES);//---ïðîõîä ïî îðäåðàì--
    
    
                if (OrderSymbol() == Symbol() && OrderMagicNumber() == mn) { 
                
            
                
                return(0);
                                                                           } 
                                    }
 
//..........................................................................
      ticket = -1;  int Rand=MathRand();  
      
   
 
  if (  flag                          &&  // ---ôëàã îòêðûòèÿ îðäåðà
  
        a1>a2                         &&  // --- ïðîâåðêà ôèëüòðóþùåé ýâðèñòèêè
  
        level >   Rand                &&  //---- ïîêåð-ØÎÓ ---
      
      
           IsTradeAllowed()) { 
           
           if (mn<200)      {
  
 ticket= OrderSend(Symbol(), OP_BUY,lot(),Ask,5*x,Bid-x*SL*Point,Ask+x*TP*Point,DoubleToStr(mn,0),mn,0,Blue);
                         
    
                            }
                         
                         
                         else {
                         
 ticket= OrderSend(Symbol(),OP_SELL,lot(),Bid,5*x,Ask+x*SL*Point,Bid-x*TP*Point,DoubleToStr(mn,0),mn,0, Red);
                        
                              }
        
   
                 RefreshRates();   
      
              if ( ticket < 0) { Sleep(30000);   prevtime = Time[1]; } 
                                           
                                           } //-- Exit ---
 
       return(0); } 
       
 
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxXXXXXXXXXXXXXXXXXXXX
double lot() {  return(0.1);    } 
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Profitability Reports

GBP/AUD Jul 2025 - Sep 2025
1.03
Total Trades 29
Won Trades 12
Lost trades 17
Win Rate 41.38 %
Expected payoff 1.07
Gross Profit 1079.57
Gross Loss -1048.48
Total Net Profit 31.09
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.71
Total Trades 41
Won Trades 13
Lost trades 28
Win Rate 31.71 %
Expected payoff -17.05
Gross Profit 1737.10
Gross Loss -2436.10
Total Net Profit -699.00
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.59
Total Trades 6
Won Trades 2
Lost trades 4
Win Rate 33.33 %
Expected payoff -21.08
Gross Profit 181.00
Gross Loss -307.50
Total Net Profit -126.50
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
0.83
Total Trades 1354
Won Trades 502
Lost trades 852
Win Rate 37.08 %
Expected payoff -0.72
Gross Profit 4880.31
Gross Loss -5855.31
Total Net Profit -975.00
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
1.02
Total Trades 43
Won Trades 17
Lost trades 26
Win Rate 39.53 %
Expected payoff 1.12
Gross Profit 2820.43
Gross Loss -2772.40
Total Net Profit 48.03
-100%
-50%
0%
50%
100%
USD/CAD Jan 2025 - Jul 2025
0.78
Total Trades 51
Won Trades 17
Lost trades 34
Win Rate 33.33 %
Expected payoff -9.23
Gross Profit 1704.03
Gross Loss -2174.52
Total Net Profit -470.49
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
1.14
Total Trades 21
Won Trades 9
Lost trades 12
Win Rate 42.86 %
Expected payoff 7.60
Gross Profit 1268.90
Gross Loss -1109.40
Total Net Profit 159.50
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
1.03
Total Trades 56
Won Trades 22
Lost trades 34
Win Rate 39.29 %
Expected payoff 1.70
Gross Profit 3168.00
Gross Loss -3072.60
Total Net Profit 95.40
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
1.25
Total Trades 78
Won Trades 35
Lost trades 43
Win Rate 44.87 %
Expected payoff 9.06
Gross Profit 3559.27
Gross Loss -2852.37
Total Net Profit 706.90
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.73
Total Trades 139
Won Trades 45
Lost trades 94
Win Rate 32.37 %
Expected payoff -11.04
Gross Profit 4214.62
Gross Loss -5748.58
Total Net Profit -1533.96
-100%
-50%
0%
50%
100%

Comments