Stoploss for Excel sample

3 posts / 0 new
Last post
Stoploss for Excel sample

Some have commented on the lack of a stop facility in the Excel sample application.
The following is a simple way to insert a default stop-loss into the Trading macro:

Select the Main sheet, right click on tab, select view code

1)find macro Private Sub TradeButton_Click()
Immediately below the DIM statements add:
DIM stopDistance As Integer
below this insert:
stopDistance = 50 '(or whatever you decide for a fixed stop distance)
Edit the dealReference line to include stopDistance:
dealReference = restClient.createPosition(epic, expiry, direction, size, crncy, limit,stopDistance)

2)In the VBA Project column select Class Modules, IGApiRestClient
scroll down from (Declarations) to Create Position.
Edit the first line to include stopDistance:
Public Function createPosition(epic As String, expiry As String, direction As String, size As String, crncy As String, limit As String, stopDistance As Integer) As String
insert the following line under the ForceOpen call :
Call requestBodyDictionary.Add("stopDistance", stopDistance)

Stop entry

This is a great help! Could you please explain how to insert the crucial lines for a stop entry (working order) feature?

having the same problem in

having the same problem in managing to add the stoplevel in a working order.

did you managed meanwhile to let it work?

Log in or register to post comments