I'm going to trade some of my automated strategies in realtime, buy I have to understrand some values of GetAccountValue first. So please let me understand what is the proper way to use it to be able to apply money management to my strategies to get things work.
I will use this simple example for better understand. Let's have account with size of $10 000 and let's go trade two futures instruments say FOO and BAR with same initial margins $1 000. Also let's have 2 strategies trading this instruments with actual state:
- First strategy is in trade with 2 contracts over FOO with actual realized profit of +$500.
- Second strategy is in trade with 1 contract over BAR with actual realized loss of -$200.
And the questions:
- How can I get the value of initial margin for any instrument?
GetAccountValue(AccountItem.InitialMargin) or MasterInstrument.Margin ?? - How can I get available account value?
In this case 10000 - 2*1000 - 1000 = $7 000
Is it GetAccountValue(AccountItem.CashValue) or GetAccountValue(AccountItem.TotalCashBalance) - What exactly do I get from AccountItem.RealizedProfitLoss?
Is it same global value for all strategies (in this case +$300), or value related to any single strategy so +$500 if I call from FOO strategy and -$200 if I call from BAR strategy ?? - How can I get realized account value?
In this case 10000 + 500 - 200 = $10 300
Is it TotalCashBalance + RealizedProfitLoss ?? - StopLoss for BAR strategy is 1%, what is the best way to restate this CalculationMode.Percentage value to CalculationMode.Price value??
Is it 0.01 * Close[0] * MasterInstrument.PointValue ??
Ex.: 0.01 * 2587 * 20 = $517.4
Hope you understand my questions.
Thanks
Comment