Results 1 to 6 of 6
 2 Attachment(s)    

Thread: (ASK) Delaying buy/sell time to backtests

  1. #1

    Default (ASK) Delaying buy/sell time to backtests

    i have noticed when comparing backtests to forward tests that results are very accurate except the backtests show buying and selling 1 second earlier compared to that of the forward live tests.


    Question:

    is it possible to add code to an ea to delay placing orders by 1 or more seconds and also add slippage by "x" pips to simulate server delay/latency to make testing more accurate to real world?

    backtest : true

    delay buy after signal : msecs
    delay sell after signal : msecs
    ( if possible)add pips to ask, bid price : +pips

    thanks
    Last edited by zoop; 02-10-2010 at 09:27.

  2. #2
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by zoop View Post
    i have noticed when comparing backtests to forward tests that results are very accurate except the backtests show buying and selling 1 second earlier compared to that of the forward live tests.


    Question:

    is it possible to add code to an ea to delay placing orders by 1 or more seconds and also add slippage by "x" pips to simulate server delay/latency to make testing more accurate to real world?

    backtest : true

    delay buy after signal : msecs
    delay sell after signal : msecs
    ( if possible)add pips to ask, bid price : +pips

    thanks
    Hi zoop,

    You can add this conditions :

    && iVolume(NULL,0,0)>1 to not enter exactly at the open.

  3. #3

    Default

    Quote Originally Posted by funyoo View Post
    Hi zoop,

    You can add this conditions :

    && iVolume(NULL,0,0)>1 to not enter exactly at the open.
    thanks funyoo, will try

    is it possible also when buy/sell signal is triggered> sleep for x time > then open ?

  4. #4
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by zoop View Post
    thanks funyoo, will try

    is it possible also when buy/sell signal is triggered> sleep for x time > then open ?
    Yes, you can set a datetime parameter :

    extern int seconds=1;

    datetime itime;
    datetime time;

    start(){

    ...

    if(signal)if(itime!=Time[0]){time=TimeCurrent();itime=Time[0];}

    if(TimeCurrent()>time+seconds)OrderSend(...

  5. #5

    Default

    Quote Originally Posted by funyoo View Post
    Yes, you can set a datetime parameter :

    extern int seconds=1;

    datetime itime;
    datetime time;

    start(){

    ...

    if(signal)if(itime!=Time[0]){time=TimeCurrent();itime=Time[0];}

    if(TimeCurrent()>time+seconds)OrderSend(...
    hi funyoo, i tried to add it to the ea but getting problems with ( signal )

    here is the CCYEURUSD ea i'm experimenting with, just need the time code added to this

    thanks zoop
    Attached Files Attached Files

  6. #6
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by zoop View Post
    hi funyoo, i tried to add it to the ea but getting problems with ( signal )

    here is the CCYEURUSD ea i'm experimenting with, just need the time code added to this

    thanks zoop
    Hi zoop,

    Try this.
    Attached Files Attached Files

Similar Threads

  1. New Currency Pairs Backtests
    By neilrickaby in forum Expert advisors backtesting
    Replies: 0
    Last Post: 07-18-2011, 15:11
  2. Add time to rest for EA (allow sever time )
    By 671988 in forum MQL programming
    Replies: 1
    Last Post: 10-24-2010, 03:28
  3. Replies: 13
    Last Post: 07-09-2009, 17:08

Tags for this Thread

add, backtest, live, pips, real, server, signal, slippage, time

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •