SMC HiLo v11.1

Profit factor:
33.39
Price Data Components
Series array that contains open time of each bar
Orders Execution
Checks for the total of open ordersIt can change open orders parameters, due to possible stepping strategyIt Closes Orders by itself It automatically opens orders when conditions are reached
Indicators Used
Moving average indicator
10 Views
0 Downloads
0 Favorites
SMC HiLo v11.1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                      SMC MaxMin at 1200.mq4 |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+

 double TakeProfit = 500;
 double Lots = 0.1;
 double InitialStop = 10;
 double TrailingStop = 30;
 int SetHour = 15;
 
 int cnt,total,ticket,MinDist;
 int SigPos;

//#####################################################################
int init()
{
//---- 



//----
   return(0);
  }
//#####################################################################

int start()
  {

   int Flag;
   
   double Spread;
   double ATR;
   double StopMA;
   int cnt, tmp;
   double SetupHigh, SetupLow;
// initial data checks
// it is important to make sure that the expert works with a normal
// chart and the user did not make any mistakes setting external 
// variables (Lots, StopLoss, TakeProfit, 
// TrailingStop) in our case, we check TakeProfit
// on a chart of less than 100 bars

  Spread=(Ask-Bid);
//############################################################################
  if(Bars<100){
     Print("bars less than 100");
     return(0);  
  }
  if(TakeProfit<10){
     Print("TakeProfit less than 10");
     return(0);  // check TakeProfit
  }
 
   
//#########################################################################################
//~~~~~~~~~~~~~~~~Miscellaneous setup stuff
 //TrailingStop=iATR(NULL,0,10,0)*2; // BE CAREFUL OF EFFECTING THE AUTO TRAIL STOPS
 StopMA=iMA(NULL,0,24,0,MODE_SMA,PRICE_CLOSE,0);
 
//#########################################################################################
if (TimeHour(CurTime()) == SetHour+2)
{
if (total>0)
  {
  for(cnt=0;cnt<total;cnt++)
   {  
     OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
     if(OrderType()==OP_BUYSTOP && OrderSymbol()==Symbol())
      {OrderDelete ( OrderTicket() );
      Print("BUYSTOP Deleted" );}
     
     
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
     if(OrderType()==OP_SELLSTOP && OrderSymbol()==Symbol())
      {OrderDelete ( OrderTicket() ); 
      Print("BUYSTOP Deleted" );
      }
       } }}
//##########################################################################################
//ALWAYS TRY TO COME OUT WITH A PROFIT:
if(0==1)
{
 total=OrdersTotal();
 if (total>0)
  {
  for(cnt=0;cnt<total;cnt++)
   {  
//LONG
     OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
     if(OrderType()==OP_BUY && OrderSymbol()==Symbol())
      {
       if(OrderStopLoss() < OrderOpenPrice())
      {
       if (OrderStopLoss() < Bid -(Point*(MinDist*2)))
       {
        OrderModify(OrderTicket(),OrderOpenPrice(),Bid -(Point*(2*MinDist)),OrderTakeProfit(),0,Lime);
        }}}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// SHORT
     OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
     if(OrderType()==OP_SELL && OrderSymbol()==Symbol())
      {
       if(OrderStopLoss() > OrderOpenPrice())
        {
         if (OrderStopLoss() > Ask + (Point*(MinDist*2)))
        {
         OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(Point*(MinDist*2)),OrderTakeProfit(),0,Lime);
        }}}
  }}}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//##################     ORDER CLOSURE  ###################################################
// If Orders are in force then check for closure against Technicals LONG & SHORT
//CLOSE LONG Entries
  total=OrdersTotal();
  if(total>0)
   { 
   for(cnt=0;cnt<total;cnt++)
    {
     OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()==OP_BUY && OrderSymbol()==Symbol())
//##############################################################################
//##   LONG Closure Rules   ###
      {
      if(0==1)
//##############################################################################
       {                                 
        OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close LONG position
        return(0);
        }}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//CLOSE SHORT ENTRIES: 
     OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); 
      if(OrderType()==OP_SELL && OrderSymbol()==Symbol()) // check for symbol
//##############################################################################
//##  SHORT Closure Rules  ##
      {
      if(0==1)
//##############################################################################
       {   
        OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close SHORT position
        return(0);
        }}
     }  // for loop return
    }   // close 1st if 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//##################     ORDER TRAILING STOP Adjustment  #######################
//TRAILING STOP: LONG
  total=OrdersTotal();
  if(total>0)
   { 
   for(cnt=0;cnt<total;cnt++)
    {
     OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
     if(OrderType()==OP_BUY && OrderSymbol()==Symbol())
      {
            if(TrailingStop>0)  
              {                 
               if(Bid-OrderOpenPrice()>Point*TrailingStop)
                 {
                  if(OrderStopLoss()<Bid-Point*TrailingStop)
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,White);
      }}}}}}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//TRAILING STOP: SHORT
  total=OrdersTotal();
  if(total>0)
   { 
   for(cnt=0;cnt<total;cnt++)
    {
     OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
     if(OrderType()==OP_SELL && OrderSymbol()==Symbol())
      {
               if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
                 {
                  if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,White);
      }}}}}

//##########################################################################################
//~~~~~~~~~~~ END OF ORDER Closure routines & Stoploss changes  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//##########################################################################################
//~~~~~~~~~~~~START of NEW ORDERS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//#########################  NEW POSITIONS ?  ######################################
//Possibly add in timer to stop multiple entries within Period
// Check Margin available
// ONLY ONE ORDER per SYMBOL
// ADD in code to elimante spikes
// Loop around orders to check symbol doesn't appear more than once
// Check for elapsed time from last entry
tmp= TimeHour(CurTime());
 // Print(" time ",tmp);

if (0==1) // switch to turn ON/OFF history check
{  
  total=HistoryTotal();
  if(total>0)
   { 
    for(cnt=0;cnt<total;cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY);
       if(OrderSymbol()==Symbol()
       && CurTime()- OrderCloseTime() < (Period() * 60 )
       )
        {
        return(0);
 }}}}

 total=OrdersTotal();
  if(total>0)
   { 
    for(cnt=0;cnt<total;cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
       if(OrderSymbol()==Symbol()) return(0);
   }
   }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   if(AccountFreeMargin()<(1000*Lots))
   {Print("We have no money. Free Margin = ", AccountFreeMargin());
    return(0);}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//#########################################################################################
//ENTRY RULES: LONG 
 double MinDist = (MarketInfo(Symbol(),MODE_STOPLEVEL)*Point);
 double HighPrice, LowPrice; 
 if(MinDist-(High[1] - Ask) > 0) HighPrice = High[1]+ (MinDist-(High[1] - Ask));
 if(MinDist-(High[1] - Ask) < 0) HighPrice = High[1];
 if(MinDist-(Bid -Low[1]) > 0) LowPrice = Low[1]+ (MinDist-(Bid -Low[1]));
 if(MinDist-(Bid -Low[1]) < 0) LowPrice = Low[1];
//Print(SetHour," ",LowPrice," ",HighPrice);

  if (TimeHour(CurTime()) == SetHour)
  {
//Place BUY Stop order 
   ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,HighPrice+(1*Point),3,Low[1]-(30*Point),Ask+(TakeProfit*Point),"MaxMin Long",16384,0,Orange); 
   if(ticket>0)
    {
    if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUYSTOP order opened : ",OrderOpenPrice());
     }
    else // Place  actual Order
     {
      Print("Error opening BUYSTOP order : ",GetLastError()); 
      ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Low[1]-(30*Point),Ask+(TakeProfit*Point),"MaxMin Long",16384,0,Yellow); 
       
     if(ticket>0)
      {
       if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
        }
       else Print("Error opening BUY order : ",GetLastError()); 
       }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ticket=OrderSend(Symbol(),OP_SELLSTOP,Lots,LowPrice-(1*Point),3,Ask+(30*Point),Bid-(TakeProfit*Point),"MaxMin Long",16384,0,Red); 
    if(ticket>0)
     {
      if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELLSTOP order opened : ",OrderOpenPrice());
       }
     else
      {
       Print("Error opening SELLSTOP order : ",GetLastError()); 
       ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+(30*Point),Bid-(TakeProfit*Point),"MaxMin Long",16384,0,Pink); 
     
     if(ticket>0)
     {
      if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
       }
      else Print("Error opening SELL order : ",GetLastError()); 
      }






      return(0); 
 }
//####################################################################################
//############               End of PROGRAM                  #########################   
   return(0);
}

Profitability Reports

EUR/USD Jan 2025 - Jul 2025
417.06
Total Trades 219
Won Trades 157
Lost trades 62
Win Rate 71.69 %
Expected payoff 1328.16
Gross Profit 291566.10
Gross Loss -699.10
Total Net Profit 290867.00
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
287.17
Total Trades 102
Won Trades 73
Lost trades 29
Win Rate 71.57 %
Expected payoff 1032.19
Gross Profit 105651.10
Gross Loss -367.90
Total Net Profit 105283.20
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
241.51
Total Trades 124
Won Trades 84
Lost trades 40
Win Rate 67.74 %
Expected payoff 848.77
Gross Profit 105685.00
Gross Loss -437.60
Total Net Profit 105247.40
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
1.96
Total Trades 114
Won Trades 88
Lost trades 26
Win Rate 77.19 %
Expected payoff 2.03
Gross Profit 474.26
Gross Loss -242.35
Total Net Profit 231.91
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
1.69
Total Trades 149
Won Trades 106
Lost trades 43
Win Rate 71.14 %
Expected payoff 1.53
Gross Profit 558.12
Gross Loss -330.61
Total Net Profit 227.51
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
1.50
Total Trades 294
Won Trades 213
Lost trades 81
Win Rate 72.45 %
Expected payoff 1.09
Gross Profit 962.95
Gross Loss -642.79
Total Net Profit 320.16
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
1.29
Total Trades 221
Won Trades 157
Lost trades 64
Win Rate 71.04 %
Expected payoff 0.76
Gross Profit 737.80
Gross Loss -570.70
Total Net Profit 167.10
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
1.25
Total Trades 103
Won Trades 74
Lost trades 29
Win Rate 71.84 %
Expected payoff 0.97
Gross Profit 500.99
Gross Loss -401.38
Total Net Profit 99.61
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
1.24
Total Trades 111
Won Trades 74
Lost trades 37
Win Rate 66.67 %
Expected payoff 0.64
Gross Profit 362.21
Gross Loss -291.50
Total Net Profit 70.71
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
1.14
Total Trades 102
Won Trades 68
Lost trades 34
Win Rate 66.67 %
Expected payoff 0.47
Gross Profit 386.30
Gross Loss -338.60
Total Net Profit 47.70
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
1.13
Total Trades 144
Won Trades 93
Lost trades 51
Win Rate 64.58 %
Expected payoff 0.51
Gross Profit 650.40
Gross Loss -577.00
Total Net Profit 73.40
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
1.11
Total Trades 123
Won Trades 81
Lost trades 42
Win Rate 65.85 %
Expected payoff 0.47
Gross Profit 563.95
Gross Loss -506.74
Total Net Profit 57.21
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
1.05
Total Trades 121
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 0.14
Gross Profit 359.50
Gross Loss -342.10
Total Net Profit 17.40
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
1.01
Total Trades 123
Won Trades 82
Lost trades 41
Win Rate 66.67 %
Expected payoff 0.03
Gross Profit 300.29
Gross Loss -296.26
Total Net Profit 4.03
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.87
Total Trades 108
Won Trades 69
Lost trades 39
Win Rate 63.89 %
Expected payoff -0.63
Gross Profit 471.50
Gross Loss -539.60
Total Net Profit -68.10
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.86
Total Trades 131
Won Trades 80
Lost trades 51
Win Rate 61.07 %
Expected payoff -0.55
Gross Profit 428.34
Gross Loss -500.67
Total Net Profit -72.33
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.86
Total Trades 130
Won Trades 77
Lost trades 53
Win Rate 59.23 %
Expected payoff -0.45
Gross Profit 369.70
Gross Loss -428.80
Total Net Profit -59.10
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.85
Total Trades 119
Won Trades 86
Lost trades 33
Win Rate 72.27 %
Expected payoff -0.47
Gross Profit 316.70
Gross Loss -372.40
Total Net Profit -55.70
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
0.64
Total Trades 244
Won Trades 161
Lost trades 83
Win Rate 65.98 %
Expected payoff -1.59
Gross Profit 704.54
Gross Loss -1093.36
Total Net Profit -388.82
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.61
Total Trades 100
Won Trades 58
Lost trades 42
Win Rate 58.00 %
Expected payoff -1.62
Gross Profit 250.60
Gross Loss -412.60
Total Net Profit -162.00
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
0.56
Total Trades 224
Won Trades 147
Lost trades 77
Win Rate 65.63 %
Expected payoff -2.28
Gross Profit 652.50
Gross Loss -1164.00
Total Net Profit -511.50
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.51
Total Trades 128
Won Trades 68
Lost trades 60
Win Rate 53.13 %
Expected payoff -1.94
Gross Profit 257.20
Gross Loss -504.90
Total Net Profit -247.70
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.49
Total Trades 253
Won Trades 158
Lost trades 95
Win Rate 62.45 %
Expected payoff -2.50
Gross Profit 614.62
Gross Loss -1246.67
Total Net Profit -632.05
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.48
Total Trades 129
Won Trades 78
Lost trades 51
Win Rate 60.47 %
Expected payoff -1.92
Gross Profit 231.54
Gross Loss -478.87
Total Net Profit -247.33
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.48
Total Trades 113
Won Trades 73
Lost trades 40
Win Rate 64.60 %
Expected payoff -2.14
Gross Profit 221.25
Gross Loss -463.07
Total Net Profit -241.82
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
0.40
Total Trades 279
Won Trades 176
Lost trades 103
Win Rate 63.08 %
Expected payoff -3.04
Gross Profit 572.26
Gross Loss -1420.60
Total Net Profit -848.34
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
0.33
Total Trades 247
Won Trades 126
Lost trades 121
Win Rate 51.01 %
Expected payoff -3.82
Gross Profit 463.50
Gross Loss -1406.90
Total Net Profit -943.40
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.13
Total Trades 146
Won Trades 59
Lost trades 87
Win Rate 40.41 %
Expected payoff -7.96
Gross Profit 167.97
Gross Loss -1330.16
Total Net Profit -1162.19
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.12
Total Trades 159
Won Trades 54
Lost trades 105
Win Rate 33.96 %
Expected payoff -9.94
Gross Profit 224.08
Gross Loss -1803.97
Total Net Profit -1579.89
-100%
-50%
0%
50%
100%

Comments