Extremely Profitable EA

 

Hi Guys,

I have been working on this EA for a while and it is extremely profitable if you run the strategy tester on daily or H1 timeframes... however on M1 it goes bankrupt.

The basic strategy is: after 5 consecutive positive ticks, enter a long with TP of 3 and SL of 10. With lotsize increasing as the account balance goes up.

What I want to know is what is the difference between how M1 and H1 simulations are run? and more importantly how can I replicate the H1 simulation entry parameters?

Is every tick in the H1 simulation equal to every 60th tick in the M1 simulation or how is it calculated? I also have the exact same EA that runs opposite, in otherwords short. That I want to run parallel on the same currency but on a different account to offset any losses.

Feel free to run the code yourself and use it once we can sort out this issue!

I should add is is written to run in EUR/USD 

//+------------------------------------------------------------------+
//|                                                NEW_CODE_LONG.mq4 |
//|                                                            Anton |
//|                                       http://www.fxeabuilder.com |
//+------------------------------------------------------------------+

#property copyright "fxeabuilder.com"
#property link "www.fxeabuilder.com"


// External variables

extern double StopLoss = 10;
extern double TakeProfit = 3;
extern double TrailingStopLimit = 0;
extern double TrailingStopStop = 0;
extern int MagicNumber = 23310;


// Global variables
int LongTicket;
int ShortTicket;
double RealPoint;
//double Lots

  //------------------------------------------------------------  
  //------------------------------------------------------------
// Init function
int init()
        {
      RealPoint = RealPipPoint(Symbol());  
        }
  //------------------------------------------------------------  
  //------------------------------------------------------------
  
// Start function
int start()
        
        {  
        
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                      
                // Long
                
                OrderSelect(LongTicket,SELECT_BY_TICKET);
                if(OrderCloseTime() != 0 || LongTicket == 0)
                
  
  //------------------------------------------------------------  
  //------------------------------------------------------------
   static int    countL   = 0;
   static double lastBid = 0;

   if(Bid > lastBid) { countL++;   }
   else              { countL = 0; }  

   if(countL >= 5)
  
     {
         //------------------------------------------------------------  
         bool buy_condition_1 = (countL >= 5);
         countL = 0;
         //------------------------------------------------------------  
     }

   lastBid = Bid;
  //------------------------------------------------------------        
  //------------------------------------------------------------
                
//***************************************************************      
//***************************************************************
                {                              
                if( buy_condition_1   )
                
                              {
                                OrderSelect(ShortTicket,SELECT_BY_TICKET);
                                if(OrderCloseTime() == 0 && ShortTicket > 0)
                                              {                        
                                                bool ClosedLong = OrderClose(ShortTicket,OrderLots(),Ask,0,Red);
                                              }                        
                                              
                                              
                        double AccountBalance = AccountInfoDouble(ACCOUNT_BALANCE);
         double Leverage = AccountInfoInteger(ACCOUNT_LEVERAGE);
         double LotSize = ((((AccountBalance/Ask)*Leverage) - 1)/100000);                    
                                              
                //------------------------------------------------------------  
      //------------------------------------------------------------
                LongTicket = OrderSend(Symbol(),OP_BUY,LotSize,Ask,0,0,0,"Buy Order",MagicNumber,0,Green);
           //------------------------------------------------------------      
      //------------------------------------------------------------            
                                
                                OrderSelect(LongTicket,SELECT_BY_TICKET);
                                double OpenPrice = OrderOpenPrice();
                                                            
            if(StopLoss > 0) double LongStopLoss = OpenPrice - (StopLoss * RealPoint);
            if(TakeProfit > 0) double LongTakeProfit = OpenPrice + (TakeProfit * RealPoint);
                      
                                if(LongStopLoss > 0 || LongTakeProfit > 0)
                        {
               bool LongMod = OrderModify(LongTicket,OpenPrice,LongStopLoss, LongTakeProfit,0);
                        }
                                                        
                                ShortTicket = 0;
                              }
                }              
//***************************************************************      
//***************************************************************              
                                      
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

        }


// Pip Point Function
double RealPipPoint(string Currency)
        {
                int CalcDigits = MarketInfo(Currency,MODE_DIGITS);
                if(CalcDigits == 2 || CalcDigits == 3) double CalcPoint = 0.01;
                else if(CalcDigits == 4 || CalcDigits == 5) CalcPoint = 0.0001;
                return(CalcPoint);
        }    

Any advice would be greatly appreciated!!!!!

Anton   

 

Mt4 creates its own ticks by estimating them due to (nobody knows exactly!!) op,hi,lo,cl, and tick_volume (of Volume[] in mql4).

And as m1 (1 Minute-bars) is a lot closer to the reality I assume your "Extremely Profitable EA" is not that extremely profitable.

Google for "Birt's Tickdata Suite" or Tickstory to be able to backtest with real tick-data!!

 
Carl Schreiber:

Mt4 creates its own ticks by estimating them due to (nobody knows exactly!!) op,hi,lo,cl, and tick_volume (of Volume[] in mql4).

And as m1 (1 Minute-bars) is a lot closer to the reality I assume your "Extremely Profitable EA" is not that extremely profitable.

Google for "Birt's Tickdata Suite" or Tickstory to be able to backtest with real tick-data!!

Thanks Carl, that is what I suspected.. Back to the drawing board then
 
C0mput3r:

The basic strategy is: after 5 consecutive positive ticks, enter a long with TP of 3 and SL of 10. With lotsize increasing as the account balance goes up. 

Carl Schreiber:

Mt4 creates its own ticks by estimating them due to (nobody knows exactly!!) op,hi,lo,cl, and tick_volume (of Volume[] in mql4).

A logical way to model an M1 bar would be:

  • On a bullish bar, price moved linearly from Open to Low to High to Close
  • On a bearish bar, price moved linearly from Open to High to Low to Close  

If this is indeed how the ticks are modelled by strategy tester, it would lend itself to a strategy such as yours which relies on consecutive ticks in the same direction. 

Just a thought; I can't back it up. 

 
  1. C0mput3r: and it is extremely profitable if you run the strategy tester on daily or H1 timeframes... however on M1 it goes bankrupt.
    You need all lower timeframes in history so the ST can model movement inter-candle. That way only the M1 is modeled. Set the testing range to where you have M1 data.
  2. C0mput3r: Thanks Carl, that is what I suspected.. Back to the drawing board then
    Don't be so quick, don't use the ST, use a demo account and forward test.
  3. honest_knave: If this is indeed how the ticks are modelled by strategy tester,
    Google is your friend https://www.google.com/search?q=site%3Aarticles.mql4.com+tester points you to Strategy Tester: Modes of Modeling during Testing - MQL4 Articles
 
whroeder1:
You need all lower timeframes in history so the ST can model movement inter-candle. Google is your friend https://www.google.com/search?q=site%3Aarticles.mql4.com+tester points you to Strategy Tester: Modes of Modeling during Testing - MQL4 Articles
I am familiar with that article. Unless I am mistaken, it does not explain how it interpolates ticks. I offered conjecture on the means of interpolation.
 
C0mput3r:



five tick could be five point, so this strategy is irrelevant if it is played in each tick mode and  5 digits


if digits == 4 on EURUSD it will be 50 point up or down.


On my computer, it is not a very profitable, it only lose money.


The spread often make the difference between loosing and winning strategy between M1 and H1

 
honest_knave:
I am familiar with that article. Unless I am mistaken, it does not explain how it interpolates ticks. I offered conjecture on the means of interpolation.
The FXT format file is open so if some one want to know how the ticks are modelled there is no need for conjectures, just need to analyse it.
Reason: