TrueScalper_Ron_Ruby_MT4_v11_step1

Author: Ron Thompson & Jacob Yego
Profit factor:
0.47
Price Data Components
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt Closes Orders by itself
Indicators Used
Moving average indicatorRelative strength index
10 Views
0 Downloads
0 Favorites
TrueScalper_Ron_Ruby_MT4_v11_step1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------+
//| TRUE_SCALPER                       |
//+------------------------------------+
//
// This is the one used successfully by Jean-François 
//
// Designed for M5 but I attached it to M15 and it worked fine.
//	long if EMA3>EMA7:::EMA3<EMA7<0 
// Code Adapted from  Scalper EAs to use EMA and RSI and multiple currencies


// v4 - Fixed a couple of ELSE statements that should NOT
//      have been there

// Spent a LOT of time debugging the backtester

// v11- added sell-&-hedge
//      added abandon-after-#-of-ticks
//      added init() section to load optimized symbol info


/*
Theory of operation

Based on MA3 of Bar[1],  MA7 of Bar[1]  and  RSI of Bar[2]

ENTRY LONG When:
MA3(Bar[1]) is greater than MA7(Bar[1]) by at least 1 pip
RSI(2-period Bar[2]) greater than 50

ENTRY SHORT When:
MA3(Bar[1]) is less than than MA7(Bar[1]) by at least 1 pip
RSI(2-period Bar[2]) less than 50

EXIT #1:
# of ticks to abandon trade is exceeded, 
trade is closed, and another is opened in the opposite direction

EXIT #2
TakeProfit (optimized) or Stoploss(optimized)

MONEY MANAGEMENT
-none-

RISK MANAGEMENT
TP/SL ~ .5  that is, SL is 2X TP mitigated by reversing hedge

TIME FRAME
15 MINUTES
also works well at 1 HOUR


*/


// variables declared here are GLOBAL in scope

#property copyright "Ron Thompson & Jacob Yego"
#property link      "http://www.lightpatch.com/forex/"

// generic user input
extern double Lots=0.5;
extern int    TakeProfit=42;
extern int    StopLoss=133;
extern int    RSIPos=50;
extern int    RSINeg=50;
extern int    Slippage=2;
extern int    abandon=63;


// Bar handling
datetime bartime=0;
int      bartick=0;



//+------------------------------------+
//| EA load code                       |
//+------------------------------------+

int init()
  {
   Comment("V11 Ruby 15 90 73 start 2822.04 11/20");
   // set up the symbol optimizations
   //if (Symbol()=="GBPUSD")  {TakeProfit=55; StopLoss=100; abandon=69;}
  }


//+------------------------------------+
//| EA unload code                     |
//+------------------------------------+

int deinit()
  {
  }



//+------------------------------------+
//| EA main code                       |
//+------------------------------------+

int start()
  {

   double p=Point();
   int      cnt=0;

   int      OrdersPerSymbol=0;

   double  bullMA3=0;
   double  bearMA7=0;
   double  RSI=0;
   bool    RSIPOS=0;
   bool    RSINEG=0;
   
   double TP;
   double SL;


   // Error checking & bar counting
   if(AccountFreeMargin()<(1000*Lots))        {Print("-----NO MONEY"); return(0);}
   if(Bars<100)                               {Print("-----NO BARS "); return(0);}
   if(bartime!=Time[0])                       {bartime=Time[0]; bartick++;       }

   // 3-period moving average on Bar[1]
   bullMA3=iMA(Symbol(),0,3,0,MODE_EMA,PRICE_CLOSE,1);
   // 7-period moving average on Bar[1]
   bearMA7=iMA(Symbol(),0,7,0,MODE_EMA,PRICE_CLOSE,1);
   
   // 2-period moving average on Bar[2]
   RSI=iRSI(Symbol(),0,2,PRICE_CLOSE,2);

   // Determine what polarity RSI is in
   if(RSI>RSIPos) {RSIPOS=true;  RSINEG=false;}
   if(RSI<RSINeg) {RSIPOS=false; RSINEG=true;}


   // count the open orders for this symbol 
   OrdersPerSymbol=0;
   for(cnt=OrdersTotal();cnt>=0;cnt--)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if( OrderSymbol()==Symbol() )
        {
         OrdersPerSymbol++;
        }
     }


   // place new order based on direction
   // only if no other orders are open on this Symbol 
   if(OrdersPerSymbol==0)
     {
      //ENTRY Ask(buy, long) 
      if(bullMA3>(bearMA7+p) && RSINEG)
		  {
		   SL=Ask-(StopLoss*p);
		   TP=Ask+(TakeProfit*p);
         OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,SL,TP,"BUY  "+CurTime(),0,0,White);
         bartick=0;
        }
        
      //ENTRY Bid (sell, short)
      if(bullMA3<(bearMA7-p) && RSIPOS)
        {
		   SL=Bid+(StopLoss*p);
		   TP=Bid-(TakeProfit*p);
         OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,SL,TP,"SELL "+CurTime(),0,0,Red);
         bartick=0;
        }
     } //if


   // have we run out of ticks for average time-to-profit?
   if(OrdersPerSymbol==1 && bartick==abandon)
     {

      if(OrderType()==OP_BUY)
        {
         // close losing BUY order to avoid more loss
         OrderClose(OrderTicket(),Lots,Bid,Slippage,White);
         // setup and trade new order 
         SL=Bid+(StopLoss*p);
         TP=Bid-(TakeProfit*p);
         OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,SL,TP,"SELL "+CurTime(),0,0,Red);
         // bump bartick to prevent multiple buys
         bartick++;
        } // if BUY

      if(OrderType()==OP_SELL)
        {
         // close losing SELL order to avoid more loss
         OrderClose(OrderTicket(),Lots,Ask,Slippage,Red);
         // setup and trade new order 
         SL=Ask-(StopLoss*p);
         TP=Ask+(TakeProfit*p);
         OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,SL,TP,"BUY  "+CurTime(),0,0,White);
         // bump bartick to prevent multiple buys
         bartick++;
        } //if SELL

     } //if OrdersPerSymbol

   return(0);
  } // start()




Profitability Reports

GBP/USD Jul 2025 - Sep 2025
0.73
Total Trades 949
Won Trades 661
Lost trades 288
Win Rate 69.65 %
Expected payoff -5.52
Gross Profit 13881.00
Gross Loss -19122.50
Total Net Profit -5241.50
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.66
Total Trades 434
Won Trades 294
Lost trades 140
Win Rate 67.74 %
Expected payoff -7.25
Gross Profit 6164.50
Gross Loss -9310.00
Total Net Profit -3145.50
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.64
Total Trades 587
Won Trades 393
Lost trades 194
Win Rate 66.95 %
Expected payoff -5.63
Gross Profit 5878.67
Gross Loss -9180.86
Total Net Profit -3302.19
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.62
Total Trades 552
Won Trades 365
Lost trades 187
Win Rate 66.12 %
Expected payoff -6.31
Gross Profit 5568.66
Gross Loss -9050.49
Total Net Profit -3481.83
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.60
Total Trades 503
Won Trades 329
Lost trades 174
Win Rate 65.41 %
Expected payoff -11.48
Gross Profit 8629.58
Gross Loss -14402.92
Total Net Profit -5773.34
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.58
Total Trades 417
Won Trades 270
Lost trades 147
Win Rate 64.75 %
Expected payoff -9.78
Gross Profit 5670.00
Gross Loss -9746.50
Total Net Profit -4076.50
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.57
Total Trades 938
Won Trades 605
Lost trades 333
Win Rate 64.50 %
Expected payoff -10.06
Gross Profit 12705.00
Gross Loss -22144.50
Total Net Profit -9439.50
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.52
Total Trades 458
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -12.24
Gross Profit 5964.00
Gross Loss -11571.00
Total Net Profit -5607.00
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.47
Total Trades 988
Won Trades 591
Lost trades 397
Win Rate 59.82 %
Expected payoff -9.62
Gross Profit 8421.05
Gross Loss -17926.56
Total Net Profit -9505.51
-100%
-50%
0%
50%
100%
EUR/USD Oct 2025 - Feb 2026
0.38
Total Trades 510
Won Trades 279
Lost trades 231
Win Rate 54.71 %
Expected payoff -18.63
Gross Profit 5859.00
Gross Loss -15361.50
Total Net Profit -9502.50
-100%
-50%
0%
50%
100%
AUD/USD Oct 2025 - Feb 2026
0.37
Total Trades 497
Won Trades 269
Lost trades 228
Win Rate 54.12 %
Expected payoff -19.14
Gross Profit 5649.00
Gross Loss -15162.00
Total Net Profit -9513.00
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.36
Total Trades 479
Won Trades 255
Lost trades 224
Win Rate 53.24 %
Expected payoff -19.92
Gross Profit 5355.00
Gross Loss -14896.00
Total Net Profit -9541.00
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.01
Total Trades 225
Won Trades 4
Lost trades 221
Win Rate 1.78 %
Expected payoff -42.29
Gross Profit 54.70
Gross Loss -9569.09
Total Net Profit -9514.39
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 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