Hello, I need a list of all my open positions including when you buy with a external Symbol, but OpenPositions (WL7) doesnt include them, only include positions of your single symbol you are running.
How can I get it.??
Returns:
--SPY--
idx 0
Current number of Open Positions 0
The number of Open Positions before BUY 1 is 0
The number of Open Positions after BUY 1 is 0
The number of Open Positions after BUY 2 is 0
The number of Open Positions after BUY 3 is 0
idx 1
Current number of Open Positions 1
The number of Open Positions before BUY 1 is 1
The number of Open Positions after BUY 1 is 1
The number of Open Positions after BUY 2 is 1
The number of Open Positions after BUY 3 is 1
idx 2
Current number of Open Positions 2
The number of Open Positions before BUY 1 is 2
The number of Open Positions after BUY 1 is 2
The number of Open Positions after BUY 2 is 2
The number of Open Positions after BUY 3 is 2
idx 3
Current number of Open Positions 3
The number of Open Positions before BUY 1 is 3
The number of Open Positions after BUY 1 is 3
The number of Open Positions after BUY 2 is 3
The number of Open Positions after BUY 3 is 3
idx 4
Current number of Open Positions 4
The number of Open Positions before BUY 1 is 4
The number of Open Positions after BUY 1 is 4
The number of Open Positions after BUY 2 is 4
The number of Open Positions after BUY 3 is 4
idx 5
Current number of Open Positions 5
The number of Open Positions before BUY 1 is 5
The number of Open Positions after BUY 1 is 5
The number of Open Positions after BUY 2 is 5
The number of Open Positions after BUY 3 is 5
...................................................................
How can I get it.??
CODE:
public override void Execute(BarHistory bars, int idx) { WriteToDebugLog(" idx " +idx); WriteToDebugLog("Current number of Open Positions " +OpenPositions.Count); WriteToDebugLog("The number of Open Positions before BUY 1 is " +OpenPositions.Count); //BUY1 EXTERNAL BarHistory Ticker_Compra1 = IndicatorFactory.GetHistory(bars, "DBC", bars.Scale, "BestData"); PlaceTrade(Ticker_Compra1, TransactionType.Buy, OrderType.MarketClose); WriteToDebugLog("The number of Open Positions after BUY 1 is " +OpenPositions.Count); //BUY2 EXTERNAL BarHistory Ticker_Compra2 = IndicatorFactory.GetHistory(bars, "TLT", bars.Scale, "BestData"); PlaceTrade(Ticker_Compra2, TransactionType.Buy, OrderType.MarketClose); WriteToDebugLog("The number of Open Positions after BUY 2 is " + OpenPositions.Count); //BUY 3 CURRENT PlaceTrade(bars, TransactionType.Buy, OrderType.MarketClose); WriteToDebugLog("The number of Open Positions after BUY 3 is " + OpenPositions.Count); }
Returns:
--SPY--
idx 0
Current number of Open Positions 0
The number of Open Positions before BUY 1 is 0
The number of Open Positions after BUY 1 is 0
The number of Open Positions after BUY 2 is 0
The number of Open Positions after BUY 3 is 0
idx 1
Current number of Open Positions 1
The number of Open Positions before BUY 1 is 1
The number of Open Positions after BUY 1 is 1
The number of Open Positions after BUY 2 is 1
The number of Open Positions after BUY 3 is 1
idx 2
Current number of Open Positions 2
The number of Open Positions before BUY 1 is 2
The number of Open Positions after BUY 1 is 2
The number of Open Positions after BUY 2 is 2
The number of Open Positions after BUY 3 is 2
idx 3
Current number of Open Positions 3
The number of Open Positions before BUY 1 is 3
The number of Open Positions after BUY 1 is 3
The number of Open Positions after BUY 2 is 3
The number of Open Positions after BUY 3 is 3
idx 4
Current number of Open Positions 4
The number of Open Positions before BUY 1 is 4
The number of Open Positions after BUY 1 is 4
The number of Open Positions after BUY 2 is 4
The number of Open Positions after BUY 3 is 4
idx 5
Current number of Open Positions 5
The number of Open Positions before BUY 1 is 5
The number of Open Positions after BUY 1 is 5
The number of Open Positions after BUY 2 is 5
The number of Open Positions after BUY 3 is 5
...................................................................
Rename
Use OpenPositionsAllSymbols
Your Response
Post
Edit Post
Login is required