Author: Maximus_genuine

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

Profitability Reports

NZD/USD Oct 2024 - Jan 2025
127.00 %
Total Trades 13
Won Trades 5
Lost trades 8
Win Rate 38.46 %
Expected payoff 11.70
Gross Profit 720.00
Gross Loss -567.90
Total Net Profit 152.10
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
110.00 %
Total Trades 14
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 4.84
Gross Profit 720.00
Gross Loss -652.20
Total Net Profit 67.80
-100%
-50%
0%
50%
100%
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


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