Download MetaTrader 5
To add comments, please log in or register
Do you want to learn MQL5? 300 articles will help you!
espina88
44
espina88 2016.05.25 11:22 

Hello, im using a demo account of mql4 platform.

 

I never trades before, so i got no experience. Thats why i got this question, when i try to Comment the spread which is on the market always get the same number and never changes.

The expression that i used is: Comment("SPREAD ", Ask-Bid); and always returns me that number: 0.01800000...68 is that due to a demo account? is there any option to make it real so then i can strategy tester better my applications

Carl Schreiber
5946
Carl Schreiber 2016.05.25 11:46  
espina88:

Hello, im using a demo account of mql4 platform.

 

I never trades before, so i got no experience. Thats why i got this question, when i try to Comment the spread which is on the market always get the same number and never changes.

The expression that i used is: Comment("SPREAD ", Ask-Bid); and always returns me that number: 0.01800000...68 is that due to a demo account? is there any option to make it real so then i can strategy tester better my applications

It is account and/or broker specific.

Look at the specifications of your account/broker

espina88
44
espina88 2016.05.25 12:47  

Im using a demo account of mql4 platform (IFCMARKET).

 

I know on mql5 there´s a function which helps with that, Spread(). On mql4 i have tried with Ask - Bid but always return the same number and that doesnt make sense  thats why im asking if theres some issue with spread on mql4 demo account

Fernando Carreiro
1465
Fernando Carreiro 2016.05.25 12:58  
espina88:

I repeat, im using a demo account of mql4 platform, i just downloaded the software from mql4.com and started testing my EAs.

As, "gooly" has pointed out, even demo accounts can have "fixed" spreads. It all depends on the type of account the broker is providing. If however, you are ABSOLUTELY sure that the account is a Variable Spread account, then show us your code because there might be errors/bugs somewhere else that is causing the problem.

If you don't want to post your code, then for starters, tell us the following:

  1. Is your code in an "Indicator", "Expert Advisor" or a "Script".
  2. In which Event handler is your code - OnInit(), OnTick(), OnCalculate(), OnStart(), OnTimer(), etc.
  3. Are you using an infinite loop inside your code? If so, DON'T! Rather use proper event handling or in the very least use the "RefreshRates()" function.
  4. On what currency pair is this happening?
  5. Have you tried it on other currency pairs?
  6. EDIT: Enable the "Spread" on the "Market Watch" so that you can compare values and see the changes (see next post).

EDIT: PS! Try the following indicator (attached code) as a test to see what spread (in points) you get with it:

Files:
Fernando Carreiro
1465
Fernando Carreiro 2016.05.25 13:14  

Here is how to enable "Spread" on the "Market Watch" so that you can compare and verify values. Just Right-Click and enable "Spread" as highlighted:

Market Watch Spread

Keith Watford
Moderator
7908
Keith Watford 2016.05.25 13:32  
espina88:

The expression that i used is: Comment("SPREAD ", Ask-Bid); and always returns me that number: 0.01800000...68 is that due to a demo account? is there any option to make it real so then i can strategy tester better my applications

It is not clear whether you are running this in the strategy tester or not. If so, the spread will not change and will be fixed at whatever you set the spread to for the test
Fernando Carreiro
1465
Fernando Carreiro 2016.05.25 16:04  
GumRai:
It is not clear whether you are running this in the strategy tester or not. If so, the spread will not change and will be fixed at whatever you set the spread to for the test

@GumRai: That was a good catch. I did not even notice that part of the the OP's post! That should explain the problem completely, and since the OP is probably using the default "current spread", he will see that value change on different runs.

@espina88: To use "real" spread in the Strategy Tester you will have to use 3rd party tools. Personally I only know of one tool that does that and it is not free (there is a cost/price for it).

/
To add comments, please log in or register