Download MetaTrader 5

Indicators: spread_on_chart

To add comments, please log in or register
Automated-Trading
Admin
106102
Automated-Trading  

spread_on_chart:

Since 2008 the most of the dealing centers began to work with the "floating" spreads. During the night the spreads are often wider. The wide spreads are appear during the news.

The spread increasing can be sufficient, so in such cases some trading systems cannot be profitable. The stop level can be increased several times, it may cause the incorrect work of the Expert Advisors with fixed Stop Loss and Take Profit values.

The spread_on_chart indicator shows the following values on the chart:

  • spread (the difference between current Ask and Bid);
  • stop level (the minimal distance from the current price to Stop Loss and Take Profit);
  • freeze level (the minimal distance for orders modifying).

Author: Forexometer

spread_on_chart in the uppwer left cornerspread_on_chart in the lower right corner

forexistence
285
forexistence  
Automated-Trading:

spread_on_chart:

Author: Forexometer

Hi.

If i copy the code of indicator, into an expert advisor template, and instead of the  

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double& price[])
{
   ObjectSetString(0,"spread",     OBJPROP_TEXT,"spread = "      +DoubleToString(SymbolInfoInteger(Symbol(),SYMBOL_SPREAD),1));
   ObjectSetString(0,"stoplevel",  OBJPROP_TEXT,"stop level = "  +DoubleToString(SymbolInfoInteger(Symbol(),SYMBOL_TRADE_STOPS_LEVEL),1));
   ObjectSetString(0,"freezelevel",OBJPROP_TEXT,"freeze level = "+DoubleToString(SymbolInfoInteger(Symbol(),SYMBOL_TRADE_FREEZE_LEVEL),1));

   return(0);
}

of the indicator i do this:

void OnTick(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double& price[])
  {
  
   ObjectSetString(0,"spread",     OBJPROP_TEXT,"spread = "      +DoubleToString(SymbolInfoInteger(Symbol(),SYMBOL_SPREAD),1));
   ObjectSetString(0,"stoplevel",  OBJPROP_TEXT,"stop level = "  +DoubleToString(SymbolInfoInteger(Symbol(),SYMBOL_TRADE_STOPS_LEVEL),1));
   ObjectSetString(0,"freezelevel",OBJPROP_TEXT,"freeze level = "+DoubleToString(SymbolInfoInteger(Symbol(),SYMBOL_TRADE_FREEZE_LEVEL),1));
  
  }

(please notice OnTick) in order to have this indicator running into an EA, i only obtain

in the upper left corner of the chart three

Label

Label

Label

 

and when i put the mouse on it, it shows the corresponding value (1st spread, 2nd stop level, 3rd freeze level).

 

How to code properly in order to use in some EA chart this indicator? (in the way to have not the Label but the corresponding parameters, and 

 auto-refreshing?)

 

Thanks so much for any help! 

Sergey Golubev
Moderator
98268
Sergey Golubev  

What Does a Spread Tell Traders?

  • Spreads are based off the Buy and Sell price of a currency pair.
  • Costs are based off of spreads and lot size.
  • Spreads are variable and should be referenced from your trading software.

Spreads and Forex

Every market has a spread and so does Forex. A spread is simply defined as the price difference between where a trader may purchase or sell an underlying asset. Traders that are familiar with equities will synonymously call this the Bid: Ask spread.

Below we can see an example of the spread being calculated for the EURUSD. First we will find the buy price at 1.35640 and then subtract the sell price of 1.32626. What we are left with after this process is a reading of .00014. Traders should remember that the pip value is then identified on the EURUSD as the 4th digit after the decimal, making the final spread calculated as 1.4 pips.

Now we know how to calculate the spread in pips, let’s look at the actual cost incurred by traders.



Spreads Costs and Calculations

Since the spread is just a number, we now need to know how to relate the spread into Dollars and Cents. The good news is if you can find the spread, finding this figure is very mathematically straight forward once you have identified pip cost and the number of lots you are trading.

Using the quotes above, we know we can currently buy the EURUSD at 1.3564 and close the transaction at a sell price of 1.35474.That means as soon as our trade is open, a trader would incur 1.4 pips of spread. To find the total cost, we will now need to multiply this value by pip cost while considering the total amount of lots traded. When trading a 10k EURUSD lot with a $1 pip cost, you would incur a total cost of $1.40 on this transaction.

Remember, pip cost is exponential. This means you will need to multiply this value based off of the number of lots you are trading. As the size of your positions increase, so will the cost incurred from the spread.


Changes in the Spread

It is important to remember that spreads are variable meaning they will not always remain the same and will change sporadically. These changes are based off of liquidity, which may differ based off of market conditions and upcoming economic data. To reference current spread rates, always reference your trading platform.
Sergey Golubev
Moderator
98268
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

Scripts: News VLine

newdigital, 2014.01.30 09:25

Forex Spreads and the News (based on dailyfx article)

  • Spreads are based off the Buy and Sell price of a currency pair.
  • Spreads are variable and can change during news.
  • Watch for normalization of spreads, shortly after economic events.

Financial markets have the ability to be drastically effected by economic news releases. News events occur throughout the trading week, as denoted by the economic calendar, and may increase market volatility as well as increase the spreads you see on your favorite currency pairs.

It is imperative that new traders become familiar with what can happen during these events. So to better prepare you for upcoming news, we are going to review what happens to Forex spreads during volatile markets.


Spreads and the News

News is a notorious time of market uncertainty. These releases on the economic calendar happen sporadically and depending if expectations are met or not, can cause prices to fluctuate rapidly. Just like retail traders, large liquidity providers do not know the outcome of news events prior to their release! Because of this, they look to offset some of their risk by widening spreads.

Above is an example of spreads during the January NFP employment number release. Notice how spreads on the Major Forex pairs widened. Even though this was a temporary event, until the market normalizes traders will have to endure wider costs of trading.


Dealing with the Spread

It is important to remember that spreads are variable, meaning they will not always remain the same and will change as liquidity providers change their pricing. Above we can see how quickly spreads normalize after the news. In 5 minutes, the spreads on the EURUSD moved from 6.4 pips back to 1.4 pips. So where does that leave traders wanting to execute orders around the news?

Traders should always consider the risk of trading volatile markets. One of the options for trading news events is to immediately execute orders at market in hopes that the market volatility covers the increased spread cost. Or, traders can wait for markets to normalize and then take advantage of added liquidity once market activity subsides.


timmbits
83
timmbits  

Thank you very much for this indicator. 

I like it for it's simplicity, and extra information provided.

Could you please provide the option to shift the decimal left one place?  (for modern fractional pips quotes)

thank you.

To add comments, please log in or register