VBS - Very Blondie System

Author: David
Profit factor:
0.87
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
1 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 Oct 2024 - Jan 2025
0.92
Total Trades 7
Won Trades 2
Lost trades 5
Win Rate 28.57 %
Expected payoff -12.24
Gross Profit 941.60
Gross Loss -1027.30
Total Net Profit -85.70
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.00
Total Trades 5
Won Trades 0
Lost trades 5
Win Rate 0.00 %
Expected payoff -1767.66
Gross Profit 0.00
Gross Loss -8838.30
Total Net Profit -8838.30
-100%
-50%
0%
50%
100%
GBP/CAD Oct 2024 - Jan 2025
1.14
Total Trades 27
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 10.21
Gross Profit 2180.45
Gross Loss -1904.74
Total Net Profit 275.71
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
1.42
Total Trades 10
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 19.19
Gross Profit 652.80
Gross Loss -460.90
Total Net Profit 191.90
-100%
-50%
0%
50%
100%

Comments