VBS - Very Blondie System

Author: David
Profit factor:
2.90

Here's a breakdown of what this trading script does, explained in simple terms:

Overall Goal:

The script, named "Very Blondie System," is designed to automatically place and manage trades in the Forex market based on certain price movements. It aims to open new trades and close existing ones based on predefined rules.

How it Works:

  1. Initial Setup:

    • The script starts by checking if there's enough historical data available and if trading is allowed on the platform. If not, it stops.
    • It then looks at whether there are any open trades at all. If there aren't, it proceeds to check for opportunities to open new trades. If there are open trades, it proceeds to check conditions to close those trades.
  2. Opening New Trades (CheckForOpen):

    • The script identifies the highest and lowest price points over a specific recent period (defined by "PeriodX").
    • It calculates an initial trade size ("Lots") based on the account balance.
    • The script determines whether the current price has moved significantly above the recent highest price or below the recent lowest price (as determined by a factor of Limit).
      • If the price is significantly higher: It opens a "buy" trade (expecting the price to continue upwards). It also places several pending "buy limit" orders (orders to buy if the price drops to specific levels), spaced out according to a "Grid" parameter. The size of each successive pending order increases exponentially.
      • If the price is significantly lower: It opens a "sell" trade (expecting the price to continue downwards). Similarly, it places several pending "sell limit" orders (orders to sell if the price rises to specific levels), also spaced out according to the "Grid" parameter and with increasing size.
  3. Closing Existing Trades (CheckForClose):

    • Profit Target: It checks if the total profit from all open trades is greater than or equal to a specified amount ("Amount"). If so, it closes all open positions.
    • "LockDown" Feature: If the "LockDown" feature is enabled (LockDown > 0), the script attempts to protect profits on existing trades by adjusting the stop-loss. If the price has moved a certain distance in a profitable direction (determined by "LockDown"), it sets a stop-loss order to the opening price plus or minus one "Point". The stop-loss is like an emergency exit, if the market reverse it can avoid losing more than the LockDown point.
  4. Closing All Trades (CloseAll):

    • This function simply iterates through all open trades and closes them, regardless of their individual profit or loss. It closes buy trades at the current "bid" price and sell trades at the current "ask" price. It also cancels any pending orders.
  5. Calculating Profit (getProfit):

    • This function calculates the total profit from all open trades, including any swap fees (interest for holding positions overnight).

Key Parameters:

  • PeriodX: The period used to calculate the recent highest and lowest prices.
  • Limit: A multiplier that determines how much the price needs to move above or below the recent high/low before a trade is opened.
  • Grid: The spacing between the pending "limit" orders.
  • Amount: The profit target for closing all trades.
  • LockDown: The amount of profit a trade must have before a stop-loss is set to protect gains.
  • Slippage: The maximum acceptable difference between the requested price and the actual price when closing a trade.

In essence, the script tries to capitalize on price breakouts by opening initial trades and then adding to those positions with pending orders at specific intervals. It also incorporates a profit-taking mechanism and a feature to protect existing profits.

Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt can change open orders parameters, due to possible stepping strategyIt Closes Orders by itself
15 Views
0 Downloads
0 Favorites
VBS - Very Blondie System
//+------------------------------------------------------------------+
//|                                    VBS - Very Blondie System.mq4 |
//|                                                            David |
//|                                               Broker77@gmail.com |
//+------------------------------------------------------------------+
#property copyright "David"
#property link      "broker77@gmail.com"
#define MAGICMA  20081109

extern int PeriodX = 60;
extern int Limit = 1000;

extern int Grid = 1500;
extern int Amount = 40;

extern int LockDown = 0;
int Slippage = 50;

//+------------------------------------------------------------------+
//| Start function                                                   |
//+------------------------------------------------------------------+
void start()
  {
//---- check for history and trading
   if(Bars<100 || IsTradeAllowed()==false) return;
//---- calculate open orders by current symbol
   if(OrdersTotal()==0) CheckForOpen();
   else CheckForClose();
//----
  }
//---------------------------------------------------------------------------         
//---------------------------------------------------------------------------         
//---------------------------------------------------------------------------         
int CheckForOpen()
{
  double L = Low[iLowest(NULL,0,MODE_LOW,PeriodX,0)];
  double H = High[iHighest(NULL,0,MODE_HIGH,PeriodX,0)];
  double Lots = MathRound(AccountBalance()/100)/1000;
  
  if((H-Bid>Limit*Point))
    {OrderSend(Symbol(),OP_BUY,Lots,Ask,1,0,0,"",MAGICMA,0,CLR_NONE);
     for(int i=1; i<5; i++){OrderSend(Symbol(),OP_BUYLIMIT,MathPow(2,i)*Lots,Ask-i*Grid*Point,1,0,0,"",MAGICMA,0,CLR_NONE);}
    }
    
  if((Bid-L>Limit*Point))
    {OrderSend(Symbol(),OP_SELL,Lots,Bid,1,0,0,"",MAGICMA,0,CLR_NONE);
     for(int j=1; j<5; j++){OrderSend(Symbol(),OP_SELLLIMIT,MathPow(2,j)*Lots,Bid+j*Grid*Point,1,0,0,"",MAGICMA,0,CLR_NONE);}
    }
    
}  
//---------------------------------------------------------------------------         
//---------------------------------------------------------------------------         
//---------------------------------------------------------------------------         
int CheckForClose()
{
  if(getProfit()>=Amount){CloseAll();}
    
  if(LockDown>0)
  {
    for(int TradeNumber = OrdersTotal(); TradeNumber >= 0; TradeNumber--)
    {
      if (OrderSelect(TradeNumber, SELECT_BY_POS, MODE_TRADES)&&(LockDown>0))
      { int Pos=OrderType();
        if((Pos==OP_BUY)&&(Bid-OrderOpenPrice()>Point*LockDown)&&(OrderStopLoss() == 0))
        {OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Point,OrderTakeProfit(),0,CLR_NONE);}
        if((Pos==OP_SELL)&&(OrderOpenPrice()-Ask>Point*LockDown)&&(OrderStopLoss() == 0))
        {OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point,OrderTakeProfit(),0,CLR_NONE);}
      }
    }
  } 

}  
//---------------------------------------------------------------------------         
//---------------------------------------------------------------------------         
//---------------------------------------------------------------------------         
double getProfit()
{
   double Profit = 0;
   for (int TradeNumber = OrdersTotal(); TradeNumber >= 0; TradeNumber--)
   {
     if (OrderSelect(TradeNumber, SELECT_BY_POS, MODE_TRADES))
     Profit = Profit + OrderProfit() + OrderSwap();
   }
   return (Profit);
}
//---------------------------------------------------------------------------         
//---------------------------------------------------------------------------         
//---------------------------------------------------------------------------         
void CloseAll()
{
   bool   Result;
   int    i,Pos,Error;
   int    Total=OrdersTotal();
   
   if(Total>0)
   {
     for(i=Total-1; i>=0; i--) 
     {
       if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == TRUE) 
       {
         Pos=OrderType();
         if(Pos==OP_BUY)
         {Result=OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, CLR_NONE);}
         if(Pos==OP_SELL)
         {Result=OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, CLR_NONE);}
         if((Pos==OP_BUYSTOP)||(Pos==OP_SELLSTOP)||(Pos==OP_BUYLIMIT)||(Pos==OP_SELLLIMIT))
         {Result=OrderDelete(OrderTicket(), CLR_NONE);}
//-----------------------
         if(Result!=true) 
          { 
             Error=GetLastError(); 
             Print("LastError = ",Error); 
          }
         else Error=0;
//-----------------------
       }   
     }
   }
   return(0);
}
//---------------------------------------------------------------------------         
//---------------------------------------------------------------------------         

Profitability Reports

NZD/USD Jul 2025 - Sep 2025
4.41
Total Trades 4
Won Trades 3
Lost trades 1
Win Rate 75.00 %
Expected payoff 23.20
Gross Profit 120.00
Gross Loss -27.20
Total Net Profit 92.80
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
1.76
Total Trades 23
Won Trades 16
Lost trades 7
Win Rate 69.57 %
Expected payoff 24.69
Gross Profit 1319.05
Gross Loss -751.20
Total Net Profit 567.85
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
2.47
Total Trades 23
Won Trades 18
Lost trades 5
Win Rate 78.26 %
Expected payoff 27.94
Gross Profit 1079.31
Gross Loss -436.60
Total Net Profit 642.71
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
2.14
Total Trades 29
Won Trades 20
Lost trades 9
Win Rate 68.97 %
Expected payoff 26.67
Gross Profit 1453.97
Gross Loss -680.60
Total Net Profit 773.37
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 6
Won Trades 6
Lost trades 0
Win Rate 100.00 %
Expected payoff 29515716.00
Gross Profit 177094291.54
Gross Loss 0.00
Total Net Profit 177094291.54
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.00
Total Trades 3
Won Trades 3
Lost trades 0
Win Rate 100.00 %
Expected payoff 27.83
Gross Profit 83.50
Gross Loss 0.00
Total Net Profit 83.50
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
1.99
Total Trades 44
Won Trades 34
Lost trades 10
Win Rate 77.27 %
Expected payoff 28.69
Gross Profit 2543.88
Gross Loss -1281.53
Total Net Profit 1262.35
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
3.33
Total Trades 13
Won Trades 11
Lost trades 2
Win Rate 84.62 %
Expected payoff 30.96
Gross Profit 575.41
Gross Loss -172.93
Total Net Profit 402.48
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
6.44
Total Trades 10
Won Trades 9
Lost trades 1
Win Rate 90.00 %
Expected payoff 32.21
Gross Profit 381.35
Gross Loss -59.22
Total Net Profit 322.13
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
18.52
Total Trades 6
Won Trades 5
Lost trades 1
Win Rate 83.33 %
Expected payoff 31.53
Gross Profit 200.00
Gross Loss -10.80
Total Net Profit 189.20
-100%
-50%
0%
50%
100%

Comments