But in RC2 all it does is give the same value as Open[0].
Basically currently GetBid(index) may as well be calling GetOpen(index).
Here's an example of a problem this causes:
In fact the documentation would make more sense if it used
EnterShortStopMarket(Bars.GetBid(CurrentBar+1));
EnterShortStopMarket(Bars.GetBid(CurrentBar));
I assume that GetAsk(CurrentBar) should get the Open Ask price for CurrentBar regardless of whether the dataseries has MarketDataType Last, Bid or Ask.
But in RC2 all it does is give the same value as Open[0]+2*TickSize.
Basically currently GetBid(index) may as well be calling GetOpen(index) + 2*TickSize.
The use of an arbitrary number of 2 ticks to simulate a spread makes it look like the current implementation of GetAsk and GetBid is just some temporary code that a developer was supposed to go back to and finish, but forgot.
This crude attempt to simulate a spread makes the current GetAsk() even worse than GetBid. For example:
If instead user was running strategy on MarketDataType.Bid then GetAsk(CurrentBar+1) would get the latest Bid price plus two ticks. Whereas the real latest relevant Ask price might have been any number of ticks above the latest Bid price.
Test strategy is attached. The problem can easily be seen by running this strategy on a MarketDataType.Ask dataseries.
Here is some sample output:
BarsInProgress index=0. Instrument=USDJPY, MarketDataType=Ask, BarsPeriodType=Minute, Value=1, Timeframe: From=25/10/2016 00:00:00, To=26/10/2016 00:00:00, TradingHours=Forex, BreakAtEOD=True, Count=2175
Setup: Account=****, Calculate=OnBarClose, MaximumBarsLookBack=TwoHundredFiftySix, BarsRequiredToTrade=0, StartBehavior=WaitUntilFlat (IsAdoptAccountPositionAware=False)
Historical Fill Processing: Resolution=Standard, IsFillLimitOnTouch=False, Slippage=0
Order Handling: (managed) EntriesPerDirection=1, EntryHandling=AllEntries, IsExitOnSessionCloseStrategy=False, StopTargetHandling=PerEntryExecution
Order Properties: SetOrderQuantity=Strategy, TimeInForce=Gtc (TraceOrders=False)
Historical
* BarsInProgress=0, CurrentBar=0, Time=24/10/2016 22:01:00 (close of CurrentBar), bar-being-built will close at: 24/10/2016 22:16:00
Close[0]=104.186, Open[0]=104.184, openNew=104.229, Bid(CurrentBar)=104.184, Bid(CurrentBar+1)=104.229, Ask(CurrentBar)=104.186, Ask(CurrentBar+1)=104.231
Warning Open[0] differs from GetAsk(CurrentBar) even though using MarketDataType.Ask !
Warning GetOpen(CurrentBar+1) differs from GetAsk(CurrentBar+1) even though using MarketDataType.Ask !
* BarsInProgress=0, CurrentBar=1, Time=24/10/2016 22:16:00 (close of CurrentBar), bar-being-built will close at: 24/10/2016 22:17:00
Close[0]=104.234, Open[0]=104.229, openNew=104.234, Bid(CurrentBar)=104.229, Bid(CurrentBar+1)=104.234, Ask(CurrentBar)=104.231, Ask(CurrentBar+1)=104.236
Warning Open[0] differs from GetAsk(CurrentBar) even though using MarketDataType.Ask !
Warning GetOpen(CurrentBar+1) differs from GetAsk(CurrentBar+1) even though using MarketDataType.Ask !
Comment