VBA Functions Reference: IG Index

All Excel Price Feed VBA functions can be used from VBA by using the Application.Run function.

Excel Price Feed includes several functions which are specially designed to be used from VBA. They all begin with EPF.IG.VBA and can be used for market analysis, position analysis etc.

Live Market/Price Functions

EPF.IG.VBA.Mid

EPF.IG.VBA.Bid

EPF.IG.VBA.Offer

EPF.IG.VBA.High

EPF.IG.VBA.Low

EPF.IG.VBA.Change

EPF.IG.VBA.ChangePercent

EPF.IG.VBA.MarketID

EPF.IG.VBA.TradeableStatus

EPF.IG.VBA.MarginFactor

EPF.IG.VBA.MinimumDealSize

EPF.IG.VBA.MinimumDealSizeUnits

EPF.IG.VBA.MinimumStopOrLimitDistance

EPF.IG.VBA.MinimumStopOrLimitDistanceUnits

EPF.IG.VBA.MaximumStopOrLimitDistance

EPF.IG.VBA.MaximumStopOrLimitDistanceUnits

Description

Returns the current value for the specified epic code.

Syntax

returnValue = Application.Run(functionName, epicCode)

All of these functions have the one single parameter:

Parameters
Parameter Description
epicCode The IG Index epic code for the instrument
Examples

1. Return the live mid price of EURUSD spot:

Dim midPrice As Variant
midPrice = Application.Run("EPF.IG.VBA.Mid", "CS.D.EURUSD.TODAY.IP")


2. Return the live bid price of Apple stock:

Dim bidPrice As Variant
bidPrice = Application.Run("EPF.IG.VBA.Bid", "UA.D.AAPL.DAILY.IP")


2. Return the minimum deal size for GBPUSD:

Dim bidPrice As Variant
bidPrice = Application.Run("EPF.IG.VBA.MinimumDealSize", "CS.D.GBPUSD.TODAY.IP")


Sentiment Functions

EPF.IG.VBA.SentimentLong

EPF.IG.VBA.SentimentShort

Description

Returns the current IG Index client sentiment (long or short) for the specified the market id.

Syntax

longSentiment = Application.Run("EPF.IG.VBA.SentimentLong", marketID)

shortSentiment = Application.Run("EPF.IG.VBA.SentimentShort", marketID)

These functions all have the one single parameter:

Parameters
Parameter Description
marketID The IG Index market id for the instrument
Examples

1. Return the current short sentiment value of EURUSD spot:

Dim shortSentiment As Variant
shortSentiment = Application.Run("EPF.IG.VBA.SentimentShort", "EURUSD")


2. Return the current long sentiment value of Apple stock:

Dim longSentiment As Variant
longSentiment = Application.Run("EPF.IG.VBA.SentimentLong", "AAPL")


Positions Function

EPF.IG.VBA.Positions

Description

Retrieves all open positions.

Syntax

returnValue = Application.Run("EPF.IG.VBA.Positions")

The EPF.IG.VBA.CloseAllPositions function has no parameters and returns a VBA variant array containing current position information.
The structure of the array is:

Array Index Description
1 The IG Index epic code eg: CS.D.EURUSD.TODAY.IP
2 The instrument name
3 The position size
4 The opening level of the position
5 The current price of the instrument (bid or offer depending on long or short)
6 Stop Level
7 Limit Level
8 Profit/Loss
9 Deal ID