I’ve done some further testing on this.
You can use the Instrument Margin as a decimal to achieve this. E.g. if leverage is 200:1 you can 1/200 = 0.005. This seems to work on most cases. However, the challenges is with JPY crosses. The differences between Qty and Value of the position.
I’ve got an example with USDJPY of this not being quite right. The margin is calculated on Qty and not Value. A broker with use margin on the value of the trade not on the Qty.
Strategy.Position does have GetValue. I’ve included a screen shot here:
1. Shows the position details in the Portfolio screen
2. Show the some of the Output screen with a line of code
Code:
Console.WriteLine("Position Margin is: " + Position.Margin + " Instrument = " + Instrument.ToString());
OQ support – Could we please have a comment here? This doesn’t appear to make sense. With FX should Margin be calculated on Value, as opposed to Qty?
Thanks and regards,
drolles