Author: Ron Thompson
Profit factor:
0.54
Price Data Components
Series array that contains open time of each bar
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt Closes Orders by itself
Indicators Used
Moving average indicator
9 Views
0 Downloads
0 Favorites
3MA04aEXP
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//| 3MA Bunny Cross Expert                               |
//+------------------------------------------------------------------+
#property copyright "Ron Thompson"
#property link      "http://www.lightpatch.com/forex"

// User Input
extern double Lots = 0.1;
extern double MAFASTtime=5;
extern double MASLOWtime=25;




//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|

int init()
  {
   return(0);
  }


//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int start()
  {
   double   cMAfst=0, pMAfst=0;
   double   cMAslo=0, pMAslo=0;

   double    p=Point();
      
   bool     found=false;
   bool    rising=false;
   bool   falling=false;
   bool    bought=false;
   bool      sold=false;

   
   int      cnt=0;
   int      err=0;
   

   // Error checking
   if(Bars<100)                        {Print("Bars less than 100"); return(0);}
   if(AccountFreeMargin()<(1000*Lots)) {Print("We have no money");   return(0);}

   // get all the moving averages at once
   cMAfst=iMA(Symbol(),0,MAFASTtime,0,MODE_LWMA,PRICE_CLOSE, 1);
   pMAfst=iMA(Symbol(),0,MAFASTtime,0,MODE_LWMA,PRICE_CLOSE, 2);
   cMAslo=iMA(Symbol(),0,MASLOWtime,0,MODE_LWMA,PRICE_CLOSE, 1);
   pMAslo=iMA(Symbol(),0,MASLOWtime,0,MODE_LWMA,PRICE_CLOSE, 2);
   //MA100= iMA(Symbol(),0,100,0,MODE_LWMA,PRICE_CLOSE, 1);

   // determine if FST line is rising or falling around SLO line
   if (pMAfst<pMAslo && cMAfst>cMAslo) {rising=true;  falling=false;}
   if (pMAfst>pMAslo && cMAfst<cMAslo) {rising=false; falling=true;}

   // Does the Symbol() have an open order
   for(cnt=0;cnt<OrdersTotal();cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderSymbol()==Symbol())
        {found=true; break;}
         else
        {found=false;}        
     }
   
   //Leave if there is no open order 
   if (found==false)
     {
      //if (rising)  OrderSend(Symbol(),OP_BUY, Lots,Ask,3,Ask-(p*50),0,"BC Buy ",16123,0,White);
      //if (falling) OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+(p*50),0,"BC Sell",16321,0,Red);
      if (rising)  OrderSend(Symbol(),OP_BUY, Lots,Ask,3,0,0,"BC Buy ",16123,0,White);
      if (falling) OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"BC Sell",16321,0,Red);
      return(0);
     }
   
   // Leave if order was less than 4 periods ago
   //if ((Time[0]-OrderOpenTime())<300) {Print(Symbol()," not old enough ", Time[0]-OrderOpenTime()); return(0);}
   //if ((Time[0]-OrderOpenTime())<300) {return(0);}

   if (OrderType()==0) {bought=true;  sold=false;}
   if (OrderType()==1) {bought=false; sold=true;}

   // wrong direction, just print report
   if (rising && bought) {Print("Cross, but already Buy "); return(0);}
   if (falling && sold)  {Print("Cross, but already Sell"); return(0);}
     
   if (rising && sold)       //exist sell
     {
      Print(Symbol()," CLOSE sell BUY buy");
      OrderClose(OrderTicket(),Lots,Ask,0,Red);
      err=GetLastError();
      if(err==0)
        {
         Print("BUY  Order started  ",Ask);
         //OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-(p*50),0,"BC Buy ",16123,0,White);
         OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"BC Buy ",16123,0,White);
         if(GetLastError()==0)Comment("BC_BUY  Order opened : ",Ask);
        }
         else
        {
         Print(Symbol(),"BUY Error ",err);
        }
     }
   if (falling && bought)  // exist buy
     {
      Print(Symbol(),Time[0],OrderOpenTime(),"CLOSE buy BUY sell");
      OrderClose(OrderTicket(),Lots,Bid,0,White);
      err=GetLastError();
      if(err==0)
        {
         Print("SELL Order started  ",Bid);
         //OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+(p*50),0,"BC Sell",16321,0,Red);
         OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"BC Sell",16321,0,Red);
         if(GetLastError()==0)Comment("BC_SELL Order opened : ",Bid );
        }
         else
        {
         Print(Symbol(),"SELL Error ",err);
        }
     }


   //Print(Symbol()," Tick");
   return(0);
  }

Profitability Reports

USD/CAD Jul 2025 - Sep 2025
0.47
Total Trades 218
Won Trades 43
Lost trades 175
Win Rate 19.72 %
Expected payoff -3.60
Gross Profit 708.66
Gross Loss -1493.98
Total Net Profit -785.32
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.92
Total Trades 179
Won Trades 54
Lost trades 125
Win Rate 30.17 %
Expected payoff -0.48
Gross Profit 1035.50
Gross Loss -1121.20
Total Net Profit -85.70
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.89
Total Trades 193
Won Trades 54
Lost trades 139
Win Rate 27.98 %
Expected payoff -1.25
Gross Profit 1881.10
Gross Loss -2121.70
Total Net Profit -240.60
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.28
Total Trades 212
Won Trades 36
Lost trades 176
Win Rate 16.98 %
Expected payoff -10.90
Gross Profit 896.98
Gross Loss -3207.08
Total Net Profit -2310.10
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.74
Total Trades 193
Won Trades 57
Lost trades 136
Win Rate 29.53 %
Expected payoff -2.54
Gross Profit 1422.77
Gross Loss -1912.69
Total Net Profit -489.92
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 23
Won Trades 6
Lost trades 17
Win Rate 26.09 %
Expected payoff -4588.72
Gross Profit 87.20
Gross Loss -105627.70
Total Net Profit -105540.50
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.68
Total Trades 221
Won Trades 59
Lost trades 162
Win Rate 26.70 %
Expected payoff -2.19
Gross Profit 1046.50
Gross Loss -1530.80
Total Net Profit -484.30
-100%
-50%
0%
50%
100%
USD/CHF 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%
USD/CAD Oct 2024 - Jan 2025
0.91
Total Trades 100
Won Trades 31
Lost trades 69
Win Rate 31.00 %
Expected payoff -0.78
Gross Profit 772.20
Gross Loss -850.55
Total Net Profit -78.35
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.35
Total Trades 126
Won Trades 28
Lost trades 98
Win Rate 22.22 %
Expected payoff -7.30
Gross Profit 493.50
Gross Loss -1413.80
Total Net Profit -920.30
-100%
-50%
0%
50%
100%

Comments