Regular visitors will have noticed ever increasing amounts of spam on the Trading Gurus Community Forum. On November 24th 2012 we implemented some changes:

1. New users will be moderated 2. Registered users who have a post count of zero will not be able to view attachments or download code. 3. Registered users who have a post count of zero will not be able to create a new thread

As an additional countermeasure we anticipate introducing a modest paywall in the near future.

If this is your first visit here our apologies for the inconvenience.

Existing users may wish to contribute their ideas to this thread.

Results 1 to 8 of 8

Thread: Backtesting EA on a spread betting account

  1. #1
    Junior Member scrivna's Avatar
    Join Date
    Jul 2012
    Location
    Suffolk, UK
    Posts
    7

    Backtesting EA on a spread betting account

    Hello!

    I'm doing some backtesting using an EA using Alpari UK Spread Betting MT5 demo account.

    I'm rather confused about calculating margin and what risk per pip I'm leaving myself open to.

    With the spread bet account I was under the impression that you set the "Lot size" to the value per pip you want to bet. so if i wanted to bet 10p per point I would enter 0.1.

    In my EA I have a "lot size" of 0.1 and a stop loss of 100 pips

    I thought this would mean that the maximum I could lose in a single trade would be 0.1*100 = £10.

    Yet if i run this EA i'm losing £60+ on some trades even though they don't exceed a 100 pip loss.

    Is this a "feature" of the mt5 backtester using traditional forex calculations and doing something based on the underlying price of the currency? can I do something about the calculations?

    Also where does leverage come in to play with spread betting accounts, I thought the bet was the leverage?!?

    I'm totally confused!

    Any advice would be greatly appreciated!

    Thanks

  2. #2
    Administrator Jim's Avatar
    Join Date
    Apr 2010
    Location
    South West England
    Posts
    494
    Hi Scrivna,

    Quote Originally Posted by scrivna View Post
    I'm doing some backtesting using an EA using Alpari UK Spread Betting MT5 demo account.

    I'm rather confused about calculating margin and what risk per pip I'm leaving myself open to.

    I'm totally confused!

    Any advice would be greatly appreciated!
    I'm totally confused now too! I have an Alpari UK MT5 account, but it's spot FX not spread betting. I just double checked with Alpari, and they confirmed that their spreadbetting account uses MT4 as its platform. (I have one of of those accounts as well BTW).

    To summarise, the Alpari MT5 account is NOT a spread bet account. What's more Alpari's MetaTrader 5 account works rather differently to their "Classic" MT4 account. Theoretically lower spreads, but non-zero commissions for example.

    Hopefully all this will clear up any remaining confusion for you. If not, just ask!

    Cheers,

    Jim
    Reality is merely an illusion, albeit a very persistent one - Albert Einstein

  3. #3
    Junior Member scrivna's Avatar
    Join Date
    Jul 2012
    Location
    Suffolk, UK
    Posts
    7
    Jim, you're a genius, I completely missed that when I signed up, I thought it was a spread betting account.

    So I guess I'm off to rewrite my EA in MQL4 - yay! Just when I was getting comfortable with MQL5. Never mind.

    Thanks again.

  4. #4
    Junior Member scrivna's Avatar
    Join Date
    Jul 2012
    Location
    Suffolk, UK
    Posts
    7
    The calculations on The mt4 back tester are the same. They assume it's actual forex rather than spread betting so calculations are all wrong. :-(
    Last edited by scrivna; 07-12-2012 at 01:30 PM.

  5. #5
    Administrator Jim's Avatar
    Join Date
    Apr 2010
    Location
    South West England
    Posts
    494
    Hi Scrivna,

    Can you provide more details please. What you describe doesn't tie in with my own experience, but you're not providing a lot of information to go on! Any chance of some example backtest results that show "the issue"?

    Jim
    Reality is merely an illusion, albeit a very persistent one - Albert Einstein

  6. #6
    Junior Member scrivna's Avatar
    Join Date
    Jul 2012
    Location
    Suffolk, UK
    Posts
    7
    OK, taken from the results tab here is one deal the EA took on a spread bet account with a bet of 0.1 "lots"

    45 2012.01.23 12:00 buy 23 0.10 0.83376 0.00000 0.00000 0.00 9981.39
    46 2012.01.23 17:00 close 23 0.10 0.83657 0.00000 0.00000 4.38 9985.77

    So I bought at 0.83376 and closed at 0.83657 so a price difference of 0.00281

    So a pip difference of 28.1 pips

    28.1 * my initial bet of 0.1 per pip should equal = £2.81 however as you can see the MT4 calculation comes out at £4.38

  7. #7
    Junior Member scrivna's Avatar
    Join Date
    Jul 2012
    Location
    Suffolk, UK
    Posts
    7
    Hi, ok I think I'm getting somewhere, when I open the symbol properties in the backtester settings tab it reports that the calculation mode is "CFD", which I would expect, however in my EA when i check marketinfo the "MODE_PROFITCALCMODE" is equal to 0 which is Forex calculation mode!! It should be set to "1" for CFD mode.

    Aargh, and I cant seem to find a way to change the mode :-(

  8. #8
    Administrator Jim's Avatar
    Join Date
    Apr 2010
    Location
    South West England
    Posts
    494
    Well here's what Ray Robot II comes up with:

    346 2012.07.12 09:04 sell 142 0.10 1.54843 1.54943 1.54343
    348 2012.07.12 09:30 s/l 142 0.10 1.54943 1.54943 1.54343 -1.00 257.96
    351 2012.05.22 03:39 buy 143 0.10 1.55190 1.55090 1.55690
    353 2012.05.15 22:50 t/p 143 0.10 1.55690 1.55090 1.55690 5.00 262.96

    £5.00 profits and £1.00 losses just as I would expect.

    One thought occurs, since you seem to be out by a factor of 1.56 or thereabouts. Have you got the backtest account currency set to USD instead of GBP?

    Jim
    Reality is merely an illusion, albeit a very persistent one - Albert Einstein

Posting Permissions

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