Author: FORTRADER.RU
Profit factor:
0.82

Okay, here's a breakdown of what this MetaTrader script does, explained in a way that doesn't require any programming knowledge:

Overall Goal:

This script is designed to automatically open and manage buy (long) and sell (short) trades based on certain market conditions, aiming to profit from price fluctuations. It uses technical indicators called Bollinger Bands and the Relative Strength Index (RSI) to identify potential trading opportunities.

How it Works (Step-by-Step):

  1. Setting the Stage (Parameters):

    • The script starts with a set of adjustable parameters, allowing users to customize its behavior. These parameters control things like:
      • Bollinger Band Settings: Bollinger Bands are like dynamic channels around the price. These settings control how wide those channels are, using three different settings (BB1, BB2, BB3).
      • RSI Settings: The RSI measures how overbought or oversold an asset is. Settings define the time frame used for this measurement (RSI) and how much leeway is given (predel and otstup).
      • Trade Size: The "Lots" parameter determines the size of the trades the script will place.
  2. Checking Existing Trades:

    • The script first checks if there are already open buy or sell trades. If there are, it remembers this and avoids opening a new trade in the same direction. This prevents the script from stacking too many similar trades.
  3. Identifying Potential Buy Signals:

    • **Bollinger Band Check:**The script checks if the lowest price of the previous bar has reached the third Bollinger Band (nbb3) .

    • RSI Confirmation: Once the previous price has touched the third Bollinger Band, the script looks back a few bars (defined by "predel") and checks if the RSI was below a certain level (30 in the code) at any of those points, indicating the asset might be oversold.

    • Buy Trigger: If both conditions are met (price touched the band and RSI was low), the script checks one final condition: whether the closing price of the previous bar is greater than the second bollinger band (nbb2). If there are no open buy trades, it will place a buy order.

    • Setting the Stop Loss: When the script opens a buy order, it calculates the point at which the order should close if the market goes the other way (the stoploss) and sets a green color in the code.

  4. Managing Existing Buy Trades:

    • If the script finds an open buy trade, it does the following:
      • Checking the second Bollinger Band: If price crosses the second Bollinger Band(vbb2) the script closes the order with the color violet on the code.
      • **Partial Closure and Trailing Stop:**The script sets a target price (setup2). When this target is achieved, the script is designed to close half the position (take some profit) and move the stop loss to break even (protect the remaining profit). If this target is achieved the script is programmed to make these changes just once.
  5. Identifying Potential Sell Signals:

    • The logic for sell trades is very similar to the buy trades, but in reverse:

    • **Bollinger Band Check:**The script checks if the highest price of the previous bar has reached the third Bollinger Band (vbb3) .

    • RSI Confirmation: The script checks if the RSI was above a certain level (70 in the code) at any of those points, indicating the asset might be overbought.

    • Sell Trigger: If both conditions are met and there are no open sell trades, the script will place a sell order.

    • Setting the Stop Loss: When the script opens a sell order, it calculates the point at which the order should close if the market goes the other way (the stoploss) and sets a white color in the code.

  6. Managing Existing Sell Trades:

    • If the script finds an open sell trade, it does the following:
      • Checking the second Bollinger Band: If price crosses the second Bollinger Band(nbb2) the script closes the order with the color violet on the code.
      • **Partial Closure and Trailing Stop:**The script sets a target price (setup2). When this target is achieved, the script is designed to close half the position (take some profit) and move the stop loss to break even (protect the remaining profit). If this target is achieved the script is programmed to make these changes just once.

In Summary:

The script watches the market using Bollinger Bands and RSI to find moments where the price might be about to reverse. It then opens trades, sets stop-loss orders to limit potential losses, and attempts to manage the trades by closing portions of it for a profit, and moving the stop loss to break even if the trade goes well.

Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt Closes Orders by itself It can change open orders parameters, due to possible stepping strategy
Indicators Used
Bollinger bands indicatorRelative strength index
18 Views
0 Downloads
1 Favorites
FullDamp
#property copyright "FORTRADER.RU"
#property link      "http://FORTRADER.RU"

/*

Ïîäðîáíîå îïèñàíèå ïàðàìåòðîâ ñîâåòíèêà äîñòóïíî â íîìåðå æóðíàëà îò 2 Èþíÿ, 
ïðåäëîæåíèÿ è îòçûâû ìû áóäåì ðàäû âèäåòü â íàøåé ýëåêòðîïî÷òå: letters@fortrader.ru
http://www.fortrader.ru/arhiv.php

A detailed description of the parameters adviser available issue of the journal dated Iune 2, 
suggestions and feedback we will be glad to see in our e-mail: letters@fortrader.ru
http://www.fortrader.ru/arhiv.php

Looking for an interpreter for the English version of the magazine on partnership.

*/




extern string x="Íàñòðîéêè BB:";
extern int BB1 = 20;
extern int BB2 = 20;
extern int BB3 = 20;
extern string x1="Íàñòðîéêè RSI:";
extern int RSI = 14;
extern int predel = 6;
extern int otstup = 10; 

extern double Lots=1;

datetime Bar,sBar;int buy,sell,i,a,b,nbb3ok,vbb3ok,nbar;double Sstoploss,stoploss,setup2,rsi,okbuy,oksell;

int start()
  {
  if (Volume[0]>1){return(0); }

     buy=0;sell=0;
     for(  i=0;i<OrdersTotal();i++)
         {
           OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
           if(OrderType()==OP_BUY){buy=1;}
           if(OrderType()==OP_SELL){sell=1;}
         }   
   
   double vbb1 =iBands(NULL,0,BB1,1,0,PRICE_CLOSE,MODE_UPPER,1);
   double vbb2 =iBands(NULL,0,BB2,2,0,PRICE_CLOSE,MODE_UPPER,1);
   double vbb3 =iBands(NULL,0,BB3,3,0,PRICE_CLOSE,MODE_UPPER,1);
   double nbb1 =iBands(NULL,0,BB1,1,0,PRICE_CLOSE,MODE_LOWER,1);
   double nbb2 =iBands(NULL,0,BB2,2,0,PRICE_CLOSE,MODE_LOWER,1);
   double nbb3 =iBands(NULL,0,BB3,3,0,PRICE_CLOSE,MODE_LOWER,1);
  
  
  if(Low[1]<=nbb3 )
  { okbuy=0;  Bar=Time[1];
  
      for( i=predel;i>0;i--)
      {
      double rsi=iRSI(NULL,0,RSI,PRICE_CLOSE,i);
      if(rsi<30){nbb3ok=1;}
      }
  }
  
 
  if(okbuy==0 && nbb3ok==1 && Close[1]>nbb2 && buy==0)
  {okbuy=1;nbb3ok=0;a=0;
   stoploss=Low[iLowest(NULL,0,MODE_LOW,iBarShift(NULL,0,Bar,FALSE),1)]-otstup*Point;
   OrderSend(Symbol(),OP_BUY,Lots,Ask,3,stoploss,0,0,16385,0,Green);
  
  }
  
  for(i=0;i<OrdersTotal();i++)
  {
   OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
   if(OrderType()==OP_BUY )
   {  
    double setup2=OrderOpenPrice()+((OrderOpenPrice()-OrderStopLoss()));
    
          if(High[1]>vbb2)
       {
        OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
       } 
       
      if(High[1]>setup2 && a==0)
      { 
         OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,White);
         OrderClose(OrderTicket(),OrderLots()/2,Bid,3,Violet); 
         a=1;
       }
 
       
    }      
  }
  
  /**********************************************sell**********************************************************/
  
    if(High[1]>=vbb3 )
  { oksell=0;  sBar=Time[1];
  
      for( i=predel;i>0;i--)
      {
      rsi=iRSI(NULL,0,RSI,PRICE_CLOSE,i);
      if(rsi>70){vbb3ok=1;}
      }
  }
 
  if(oksell==0 && vbb3ok==1 && Close[1]<vbb2 && sell==0)
  {oksell=1;vbb3ok=0;b=0;
   Sstoploss=High[iHighest(NULL,0,MODE_HIGH,iBarShift(NULL,0,sBar,FALSE),1)]+otstup*Point;
   OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Sstoploss,0,0,16385,0,White);
  }
  
  for(i=0;i<OrdersTotal();i++)
  {
   OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
   if(OrderType()==OP_SELL )
   {  
      setup2=OrderOpenPrice()-((OrderStopLoss()-OrderOpenPrice()));
      
       if(Low[1]<nbb2)
    {
     OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
    } 
     
      if(Low[1]<setup2 && b==0)
      {
       OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,White);
       OrderClose(OrderTicket(),OrderLots()/2,Ask,3,Violet); 
       b=1;
      }      
      
   
       
    }      
  }
  
  
   

   return(0);
  }

Profitability Reports

USD/JPY Jul 2025 - Sep 2025
0.77
Total Trades 21
Won Trades 13
Lost trades 8
Win Rate 61.90 %
Expected payoff -17.04
Gross Profit 1222.24
Gross Loss -1580.15
Total Net Profit -357.91
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.73
Total Trades 23
Won Trades 15
Lost trades 8
Win Rate 65.22 %
Expected payoff -19.93
Gross Profit 1264.99
Gross Loss -1723.28
Total Net Profit -458.29
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.05
Total Trades 18
Won Trades 4
Lost trades 14
Win Rate 22.22 %
Expected payoff -61.28
Gross Profit 61.68
Gross Loss -1164.72
Total Net Profit -1103.04
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.13
Total Trades 11
Won Trades 2
Lost trades 9
Win Rate 18.18 %
Expected payoff -150.55
Gross Profit 247.00
Gross Loss -1903.00
Total Net Profit -1656.00
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
1.94
Total Trades 21
Won Trades 12
Lost trades 9
Win Rate 57.14 %
Expected payoff 65.57
Gross Profit 2838.50
Gross Loss -1461.50
Total Net Profit 1377.00
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.62
Total Trades 25
Won Trades 12
Lost trades 13
Win Rate 48.00 %
Expected payoff -31.01
Gross Profit 1290.85
Gross Loss -2066.11
Total Net Profit -775.26
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.36
Total Trades 15
Won Trades 5
Lost trades 10
Win Rate 33.33 %
Expected payoff -71.88
Gross Profit 596.24
Gross Loss -1674.42
Total Net Profit -1078.18
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.68
Total Trades 26
Won Trades 16
Lost trades 10
Win Rate 61.54 %
Expected payoff -18.13
Gross Profit 983.50
Gross Loss -1455.00
Total Net Profit -471.50
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.27
Total Trades 15
Won Trades 5
Lost trades 10
Win Rate 33.33 %
Expected payoff -60.00
Gross Profit 341.00
Gross Loss -1241.00
Total Net Profit -900.00
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
1.27
Total Trades 36
Won Trades 21
Lost trades 15
Win Rate 58.33 %
Expected payoff 24.51
Gross Profit 4103.62
Gross Loss -3221.19
Total Net Profit 882.43
-100%
-50%
0%
50%
100%

Comments