EA placing buy orders 16 pips above hi on strategy tester

 

This was an indicator that I am trying to make into an EA.  I am trying to do one thing at a time.  I am just working the buy side. 

Pls notice that strategy tester placed a buy order about 16 pips above the high of the bar.  Why?

I am using Ask in the OrderSend function.  

 Journal

2013.04.12 23:09:14 2012.12.28 02:00  MTFMACrossEA_v1 EURUSD,H1: open #1 buy 1.00 EURUSD at 1.32685 sl: 1.32185 tp: 1.33085 ok
 

 if (FastMAValueTF1 > SlowMAValueTF1  && PrevFastMAValueTF1 < PrevSlowMAValueTF1)
       {
      
    
           if(StochValueTF2 > PrevStochValueTF2)
           {
            // Print ("chk " + iHigh(Symbol(), TimeFrame1, i));

            int ticket;
            //moving up
             ticket=OrderSend(Symbol(),OP_BUY,1,Ask,0,Ask-500*Point,
             Ask+400*Point,0,0,0,Green);
             if(ticket<0)
             {
                Print("OrderSend failed with error #",GetLastError());
                 return(0);
             }
          
          }
       }
       else if ((FastMAValueTF1 < SlowMAValueTF1) && (PrevFastMAValueTF1 > PrevSlowMAValueTF1))

 
dukeb:



Play video
Please edit your post.
For large amounts of code, attach it.
 
dukeb:

This was an indicator that I am trying to make into an EA.  I am trying to do one thing at a time.  I am just working the buy side. 

Pls notice that strategy tester placed a buy order about 16 pips above the high of the bar.  Why?


What was the Spread at the time ?
 

dukeb: strategy tester placed a buy order about 16 pips above the high of the bar. 

2013.04.12 23:09:14 2012.12.28 02:00  MTFMACrossEA_v1 EURUSD,H1: open #1 buy 1.00 EURUSD at 1.32685 sl: 1.32185 tp: 1.33085 ok
              ticket=OrderSend(Symbol(),OP_BUY,1,Ask,0,Ask-500*Point,

  1. Use SRC
  2. your SL was 500 points 1.32685-1.32185=0.0050 That's 50 pips. On 5 digit broker a pip is 10 points. It was not placed 16 pips above the high. it was placed 1.6 pips - and that is the spread.
  3. mql4 charts are bid charts. you buy at the Ask.
 

RaptorUK:
What was the Spread at the time ?                                                                                                                                                                                                                                                     

               

 The spread as per the journal:

2013.04.13 06:51:17 2012.12.28 02:00  MTFMACrossEA_v1 EURUSD,H1: open #1 buy 1.00 EURUSD at 1.32685 sl: 1.32185 tp: 1.33085 ok
2013.04.13 06:51:17 2012.12.28 02:00  MTFMACrossEA_v1 EURUSD,H1: Bid 1.32479000   Ask 1.32685000 
The high of that bar was 1.32500 -- 18.5 pips below the trade entry. 

I was running the tester on open prices only.

If my trade went off at the ask, shouldn't the bar be at least as high as the ask of the trade?  I re-ran the test for Feb. thinking than Dec was too thinly traded. 

On Feb 7 at 0900 another trade went off at 16 pips above the bar.  It has never been my experience when I placed a trade at the ask that I experienced this behavior.

Suggestions? 

 
WHRoeder:
  1. Use SRC
  2. your SL was 500 points 1.32685-1.32185=0.0050 That's 50 pips. On 5 digit broker a pip is 10 points. It was not placed 16 pips above the high. it was placed 1.6 pips - and that is the spread.
  3. mql4 charts are bid charts. you buy at the Ask.

The high of that bar was 1.32500  --- the trade went off at 1.32685 ... that is 18.5 pips.  That seems excessive.  Am I missing something?

The bid of 1.32579 was even higher than the bar by nearly 8 pips... 

2013.04.13 06:51:17 2012.12.28 02:00 MTFMACrossEA_v1 EURUSD,H1: open #1 buy 1.00 EURUSD at 1.32685 sl: 1.32185 tp: 1.33085 ok
2013.04.13 06:51:17 2012.12.28 02:00 MTFMACrossEA_v1 EURUSD,H1: Bid 1.32479000 Ask 1.32685000   

 
dukeb:

The high of that bar was 1.32500  --- the trade went off at 1.32685 ... that is 18.5 pips.  That seems excessive.  Am I missing something?

The bid of 1.32579 was even higher than the bar by nearly 8 pips...      // It was 1.32479000 so not higher then the bar  

2013.04.13 06:51:17 2012.12.28 02:00 MTFMACrossEA_v1 EURUSD,H1: open #1 buy 1.00 EURUSD at 1.32685 sl: 1.32185 tp: 1.33085 ok
2013.04.13 06:51:17 2012.12.28 02:00 MTFMACrossEA_v1 EURUSD,H1: Bid 1.32479000 Ask 1.32685000   


This big spread is what you get most accounts testing at weekendtime....
 

deVries:

This big spread is what you get most accounts testing at weekendtime....                                                                                                                               

                                                                                                                                                                                                                                              

Thank you for taking the time....

You are correct... I misread the bid price.  I don't understand 'This big spread is what you get most accounts testing at weekendtime....'  statement.

It is true I am testing on the weekend, although the first test was on Fri.  The downloaded data is not data generated on the weekend (except Sun in the US).  All data is generated during trading hours.  Why would I get a fill price (ask) that is 18.5 pips above the high of that bar?  The spread on the EURUSD is anywhere from <1 pip to 2pips(generally speaking).  This did not only happen on the date above, it consistently happend on many dates. Is this the nature of the tester or am I doing something wrong?  

 
dukeb:

Thank you for taking the time....

You are correct... I misread the bid price.  I don't understand 'This big spread is what you get most accounts testing at weekendtime....'  statement.

It is true I am testing on the weekend, although the first test was on Fri.  The downloaded data is not data generated on the weekend (except Sun in the US).  All data is generated during trading hours.  Why would I get a fill price (ask) that is 18.5 pips above the high of that bar?  The spread on the EURUSD is anywhere from <1 pip to 2pips(generally speaking).  This did not only happen on the date above, it consistently happend on many dates. Is this the nature of the tester or am I doing something wrong?  

 

 


Generally before week-end broker greatly increases the spread. When you test on week-end, it is this last spread that is used for testing. So you can have spread as wide as 18.5 pips on eurusd.
 

angevoyageur:

Generally before week-end broker greatly increases the spread. When you test on week-end, it is this last spread that is used for testing. So you can have spread as wide as 18.5 pips on eurusd.                                                                                                                                                                                         

                                                                                                                                                                                                                                              

I had no idea.  I guess it would be better to download history data mid week.  If I download data, say on Wed, will it overwrite the pervious data (hope so)?

Thank you very much for that info.  You have explained a very important aspect of the back testing.

 
dukeb:

 The spread as per the journal:

2013.04.13 06:51:17 2012.12.28 02:00  MTFMACrossEA_v1 EURUSD,H1: open #1 buy 1.00 EURUSD at 1.32685 sl: 1.32185 tp: 1.33085 ok
2013.04.13 06:51:17 2012.12.28 02:00  MTFMACrossEA_v1 EURUSD,H1: Bid 1.32479000   Ask 1.32685000 
The high of that bar was 1.32500 -- 18.5 pips below the trade entry. 

I was running the tester on open prices only.

If my trade went off at the ask, shouldn't the bar be at least as high as the ask of the trade?  I re-ran the test for Feb. thinking than Dec was too thinly traded. 

The chart is drawn by Bid price,  the OHLC of all the bars are Bid prices . . .  not Ask.
Reason: