Strategy Tester Spread

 

Hi, I currently have an EA that opens and closes positions based on some indicators.

The problem I am having is that when testing it on the Strategy Tester, when openingn a position (for example a buy order) if the price is 1.08931 it buys it at a price of 1.08946 (for example). I get that this is the spread + commission (let me know if I am wrong), however, when looking at the bar, it says the spread is 0, which is making me really confused. How can I get the correct spread that is being applied?

Thanks!

 
Please don't post randomly in any section. Your topic has been moved to the section: Expert Advisors and Automated Trading
 
Suraj Rohira: I get that this is the spread + commission (let me know if I am wrong),

No, it just the spread. Commission does not affect the price. It's a trading cost that only affects the final profit or loss.

Suraj Rohira: however, when looking at the bar, it says the spread is 0

The "spread for the bar" refers to the minimum spread that occurred during the bar's duration.

To see what spread is applied at the time the position was opened, you have to look at the tick data, not the bar data.

 
Fernando Carreiro #:
Please don't post randomly in any section. Your topic has been moved to the section: Expert Advisors and Automated Trading

Sorry for that

 
Fernando Carreiro #:

No, it just the spread. Commission does not affect the price. It's a trading cost that only affects the final profit or loss.

The "spread for the bar" refers to the minimum spread that occurred during the bar's duration.

To see what spread is applied at the time the position was opened, you have to look at the tick data, not the bar data.

Ahh, I see, and where could I download the tick spread from?

 
Suraj Rohira #: Ahh, I see, and where could I download the tick spread from?

IN the Strategy Tester, simply look at the log output as it prints both the Bid and Ask prices at the time the deal is taken.

In your code, you can simply read the current Ask and Bid prices before placing the order.

SymbolInfoDouble

Returns the double value of the symbol for the corresponding property

ENUM_SYMBOL_INFO_DOUBLE

Identifier

Description

Type

SYMBOL_BID

Bid - best sell offer

double

SYMBOL_ASK

Ask - best buy offer

double

On your terminal, you can view the historical tick data in the Symbols (Ctrl-U) dialogue box.