FX-CHAOS_SCALP

Author: www.fx-chaos.by.ru
Profit factor:
0.11
Price Data Components
Series array that contains close prices for each barSeries array that contains open prices of each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
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
Miscellaneous
It plays sound alerts
11 Views
0 Downloads
0 Favorites
FX-CHAOS_SCALP
//+------------------------------------------------------------------+
//|                                                     FX-CHAOS.mq4 |
//|                                      http://www.fx-chaos.by.ru// |
//|                                                      version 1.0 |
//+------------------------------------------------------------------+

#property copyright "www.fx-chaos.by.ru"
#property link      "http://www.fx-chaos.by.ru"

#define MIN_STOPLOSS_POINT 10 
#define MIN_TAKEPROFIT_POINT 10 
#define MAGIC 0

double TrailingStopPoint;
extern double TakeProfit=13;

 string sNameExpert = "FX-CHAOS";
 int nAccount =0;
 int nSlippage = 0;
 bool lFlagUseHourTrade = False;
 int nFromHourTrade = False;
 int nToHourTrade = False;
 bool lFlagUseSound = False;
 string sSoundFileName = "alert.wav";
 color colorOpenBuy = Blue;
 color colorCloseBuy = Aqua;
 color colorOpenSell = Red;
 color colorCloseSell = Aqua;
 int numorder;

  double dbStopLoss;
 double dsStopLoss;
 double dbTakeProfit;
 double dsTakeProfit;
int DELTA=3000;
int MAX_Lots;
extern double dLots=0.01;





/////////////////////
void deinit() {
   Comment("");
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start(){

for ( int z=0;z<HistoryTotal();z++)
{
if (OrderSelect (z,SELECT_BY_POS, MODE_HISTORY))
datetime oct=OrderCloseTime();
}
if(CurTime()-oct<3600) return(0);





   
 
  // Ñêîëüêî ïîçèöèé ó íàñ îòêðûòî?
   int total = OrdersTotal();

///////////////

 dbTakeProfit=Ask+TakeProfit*Point;
 dsTakeProfit=Bid-TakeProfit*Point;
 




   if (lFlagUseHourTrade){
      if (!(Hour()>=nFromHourTrade && Hour()<=nToHourTrade)) {
         Comment("Time for trade has not come else!");
         return(0);
      }
   }
   
   if(Bars < 100){
      Print("bars less than 100");
      return(0);
   }
   
   if (nAccount > 0 && nAccount != AccountNumber()){
      Comment("Trade on account :"+AccountNumber()+" FORBIDDEN!");
      return(0);
   }

   double ZZF1440=iCustom(NULL, 1440, "zzf",0,0);
      double   CLOSE =  iClose(NULL,0,0);
      double   OPEN =  iOpen(NULL,0,0); 
      
   double ZZF60=iCustom(NULL, 60, "zzf",0,2);
     double ZZF61=iCustom(NULL, 60, "FX-AO",0,0);


     double   HIGH1 =  iHigh(NULL,60,1)+2*Point+MarketInfo(Symbol(),MODE_SPREAD);
     double   LOW1 =  iLow(NULL,60,1)-2*Point;
      
  
  
      
   bool lFlagBuyOpen = false, lFlagSellOpen = false, lFlagBuyClose = false, lFlagSellClose = false, lFlagBuyOpen2 = false, lFlagSellOpen2 = false, lFlagBuyOpen3 = false, lFlagSellOpen3 = false, lFlagBuyOpen4 = false, lFlagSellOpen4 = false;

    
lFlagBuyOpen =(OPEN<HIGH1 && CLOSE>HIGH1 && CLOSE<ZZF60 && ZZF61<0 && CLOSE>ZZF1440);

  lFlagSellOpen = (OPEN>LOW1 && CLOSE<LOW1 && CLOSE>ZZF60 && ZZF61>0 && CLOSE<ZZF1440); 


///////////////////////////////////////////ïåðâûé îðäåð

if((lFlagBuyOpen || lFlagSellOpen) && (!GlobalVariableCheck("") || GlobalVariableGet("Symbol()"+"")!=Time[0] && total<1))
     {
      if(lFlagBuyOpen)
        {  
 numorder = OrderSend(Symbol(), OP_BUY, dLots, Ask, nSlippage, dbStopLoss, dbTakeProfit, sNameExpert, MAGIC, 0, colorOpenBuy); 
       
         
           if(numorder>0)
           {
            if(OrderSelect(numorder,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
            GlobalVariableSet("Symbol()"+"MAGICMA"+"TimeBuySell",Time[0]);
           }
         else Print("Error opening BUY order : ",GetLastError());return(0); 
        }
               
      if(lFlagSellOpen)
        { 
 numorder = OrderSend(Symbol(),OP_SELL, dLots, Bid, nSlippage, dsStopLoss, dsTakeProfit, sNameExpert, MAGIC, 0, colorOpenSell); 
        
     
          if(numorder>0)
           { 
            if(OrderSelect(numorder,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
            GlobalVariableSet("Symbol()"+"MAGICMA"+"TimeBuySell",Time[0]);
           }
         else Print("Error opening SELL order : ",GetLastError());return(0);
        }
   }

 

   


///////////////////////////////////   
   
//çàêðûòèå îðäåðà/////////////

    lFlagBuyClose =false;
   
  lFlagSellClose =false;

   
/////////////////////////////   
     
   
  
   if (ExistPositions()){
      if(OrderType()==OP_BUY){
         if (lFlagBuyClose){
            bool flagCloseBuy = OrderClose(OrderTicket(), OrderLots(), Bid, nSlippage, colorCloseBuy); 
            if (flagCloseBuy && lFlagUseSound) 
               PlaySound(sSoundFileName); 
            return(0);
         }
      }
      if(OrderType()==OP_SELL){
         if (lFlagSellClose){
            bool flagCloseSell = OrderClose(OrderTicket(), OrderLots(), Ask, nSlippage, colorCloseSell); 
            if (flagCloseSell && lFlagUseSound) 
               PlaySound(sSoundFileName); 
            return(0);
         }
      }
   }

   
   if (TrailingStopPoint > 0 ){
      
      for (int i=0; i<OrdersTotal(); i++) { 
         if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { 
            bool lMagic = true;
            if (MAGIC > 0 && OrderMagicNumber() != MAGIC)
               lMagic = false;
            
            if (OrderSymbol()==Symbol() && lMagic) { 
               if (OrderType()==OP_BUY && TrailingStopPoint > 0) { 
                  if (Bid-OrderOpenPrice() > TrailingStopPoint*Point) { 
                     if (OrderStopLoss()<Bid-TrailingStopPoint*Point) 
                        ModifyStopLoss(Bid-TrailingStopPoint*Point); 
                  } 
               } 
               if (OrderType()==OP_SELL) { 
                  if (OrderOpenPrice()-Ask>TrailingStopPoint*Point) { 
                     if (OrderStopLoss()>Ask+TrailingStopPoint*Point || OrderStopLoss()==0)  
                        ModifyStopLoss(Ask+TrailingStopPoint*Point); 
                  } 
               } 
            } 
         } 
      } 
   }
   return (0);
}

                 
    
////////////////////////

bool ExistPositions() {
	for (int i=0; i<OrdersTotal(); i++) {
		if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
         bool lMagic = true;
         
         if (MAGIC > 0 && OrderMagicNumber() != MAGIC)
            lMagic = false;

			if (OrderSymbol()==Symbol() && lMagic) {
				return(True);
			}
		} 
	} 
	return(false);
}




void ModifyStopLoss(double ldStopLoss) { 
   bool lFlagModify = OrderModify(OrderTicket(), OrderOpenPrice(), ldStopLoss, OrderTakeProfit(), 0, CLR_NONE); 
   if (lFlagModify && lFlagUseSound) 
      PlaySound(sSoundFileName); 
} 


Profitability Reports

GBP/USD Jul 2025 - Sep 2025
0.60
Total Trades 8572
Won Trades 7401
Lost trades 1171
Win Rate 86.34 %
Expected payoff -0.07
Gross Profit 962.13
Gross Loss -1597.32
Total Net Profit -635.19
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.07
Total Trades 7321
Won Trades 6916
Lost trades 405
Win Rate 94.47 %
Expected payoff -1.16
Gross Profit 641.88
Gross Loss -9125.27
Total Net Profit -8483.39
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.10
Total Trades 2870
Won Trades 1787
Lost trades 1083
Win Rate 62.26 %
Expected payoff -0.47
Gross Profit 151.58
Gross Loss -1492.87
Total Net Profit -1341.29
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.02
Total Trades 1485
Won Trades 1484
Lost trades 1
Win Rate 99.93 %
Expected payoff -6.96
Gross Profit 192.92
Gross Loss -10535.84
Total Net Profit -10342.92
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.00
Total Trades 9860
Won Trades 9860
Lost trades 0
Win Rate 100.00 %
Expected payoff 0.13
Gross Profit 1281.80
Gross Loss 0.00
Total Net Profit 1281.80
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.01
Total Trades 1000
Won Trades 500
Lost trades 500
Win Rate 50.00 %
Expected payoff -8.75
Gross Profit 50.00
Gross Loss -8802.34
Total Net Profit -8752.34
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.71
Total Trades 12976
Won Trades 12476
Lost trades 500
Win Rate 96.15 %
Expected payoff -0.05
Gross Profit 1621.88
Gross Loss -2275.06
Total Net Profit -653.18
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.00
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.00
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%

Comments