Author: FORTRADER.RU
Profit factor:
0.94

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
14 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 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%
USD/CHF Jan 2025 - Jul 2025
0.95
Total Trades 46
Won Trades 25
Lost trades 21
Win Rate 54.35 %
Expected payoff -3.84
Gross Profit 3123.19
Gross Loss -3299.77
Total Net Profit -176.58
-100%
-50%
0%
50%
100%
USD/CAD Jan 2025 - Jul 2025
1.78
Total Trades 43
Won Trades 33
Lost trades 10
Win Rate 76.74 %
Expected payoff 29.63
Gross Profit 2904.77
Gross Loss -1630.66
Total Net Profit 1274.11
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
0.52
Total Trades 24
Won Trades 11
Lost trades 13
Win Rate 45.83 %
Expected payoff -47.19
Gross Profit 1240.50
Gross Loss -2373.00
Total Net Profit -1132.50
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
0.76
Total Trades 52
Won Trades 32
Lost trades 20
Win Rate 61.54 %
Expected payoff -23.16
Gross Profit 3805.50
Gross Loss -5010.00
Total Net Profit -1204.50
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
0.82
Total Trades 60
Won Trades 34
Lost trades 26
Win Rate 56.67 %
Expected payoff -15.93
Gross Profit 4499.19
Gross Loss -5454.80
Total Net Profit -955.61
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.46
Total Trades 27
Won Trades 13
Lost trades 14
Win Rate 48.15 %
Expected payoff -79.79
Gross Profit 1859.35
Gross Loss -4013.57
Total Net Profit -2154.22
-100%
-50%
0%
50%
100%
EUR/USD Jan 2025 - Jul 2025
1.17
Total Trades 56
Won Trades 32
Lost trades 24
Win Rate 57.14 %
Expected payoff 14.35
Gross Profit 5595.50
Gross Loss -4792.00
Total Net Profit 803.50
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
0.68
Total Trades 27
Won Trades 15
Lost trades 12
Win Rate 55.56 %
Expected payoff -28.30
Gross Profit 1660.00
Gross Loss -2424.00
Total Net Profit -764.00
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
2.45
Total Trades 29
Won Trades 16
Lost trades 13
Win Rate 55.17 %
Expected payoff 36.20
Gross Profit 1775.31
Gross Loss -725.63
Total Net Profit 1049.68
-100%
-50%
0%
50%
100%

Comments