- ago
This feature is not available on WL. However These methods are essential for improving real-time trading strategy. Using the bid and ask, it allows to trace the price and to place a limit order directly and order be filled immediately without any wait time. Many Brokers such as TDA support this feature.

Previously, tried using the following but for some reason it is not returning any price number
BarData bd = bars.StreamingBar;
bd.Bid;

Needed: bars.Bid[0]; bars.Ask[0];

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript9 {    public class MyStrategy : UserStrategyBase    {       public MyStrategy() : base()       {       }       public override void Initialize(BarHistory bars) {          StartIndex = -1;       }       public override void Execute(BarHistory bars, int idx)       {          int index = idx;          Position foundPosition0 = FindOpenPosition(0);          //   bool condition0;          idx = bars.Count - 1;          if (idx == bars.Count - 1)          {             BarData bd = bars.StreamingBar;          //   val = bars.AveragePriceOHLC[idx];             val = bd.Bid; // NOT Working          }             if (foundPosition0 == null)             {                                _transaction = PlaceTrade(bars, TransactionType.Buy, OrderType.Limit, bar.Bid, "Buy At Limit (Bid)");                _transaction = PlaceTrade(bars, TransactionType.Sell, OrderType.Limit, bar.Ask, "Place Sell At Limit (Ask)");                             }          }                 public override void NewWFOInterval(BarHistory bars)   { }       private Transaction _transaction;       private double val;    } }




2
1,162
Solved
9 Replies

Reply

Bookmark

Sort
Glitch8
 ( 11.93% )
- ago
#1
It doesn't make sense to do this. The bid and ask are constantly changing. And it's not true that placing a limit order at the current bid price will cause it to get executed right away. In fact, it might not get filled at all if the price (and thus the bid) starts moving up.

If you want to simulate buying "at the bid" just place the limit order at the closing price of the signal bar, perhaps minus a few cents.
2
Best Answer
- ago
#2
Wealth-Lab is a trading simulation (i.e. backtesting) platform, not a real-time trading platform like your broker provides. We are talking about two separate applications here.

What I do today is copy the stock ticker I want to trade from WL to Active Trader Pro (Fidelity Investments), and do my research and trading from there real-time. And since ATPro is a trading platform, it gives me all the Bid and Ask details in real-time.

What would make some sense is to develop a way to pass information (ticker symbols, order type, quantity) from Wealth-Lab to the broker's real-time trading platform. It's a great idea, but the current problem is that the broker's trading platform isn't designed to accept such requests from WL. I would encourage your broker to add inter-application communications features to their trading platform to make this possible. (It's easy enough to augment the WL broker plugin to take advantage of such communication features.)
1
- ago
#3
Yes. I understand.

Problem: Exchanges fill orders at Ask price. Is it possible to be filled instantly using a limit order ?
Answer: Yes, send a limit order to the exchange with the [changing ask-price]

I meant to say Ask Price instead of Bid earlier. TDA developed this new dynamic tool which is able to trace/follow the fast changing Ask-Price, allowing a Limit-Order to be filled instantly. The order price is defined by the Ask-Price and is changing and after submitted, sent to exchanges with the changing price. It is impressive they were able to code it out.


1
Cone8
 ( 6.33% )
- ago
#4
It's probably true that in liquid markets you're very likely to be filled instantly, but I'm not aware of exchange "obligation" to fill buy/sell limit orders at ask/bid. I'd be interested to see that documented.

If the idea is that you want to send a buy at limit order at the Ask as opposed to a market order, I think it's a good idea.. and you can do it. The only risk is that with transmission and order activation delays (TD is very slow, IB is fast) - the market may have already moved and you miss the trade.
1
Glitch8
 ( 11.93% )
- ago
#5
Placing a limit order at the current ask price still does not guarantee a fill because the ask price might have moved up in the time it took to place the order. Besides there’s very little functional difference between this and a market order.
2
- ago
#6
Feature Request: Instant Limit-Order Execution

@Cone & Glitch
Please visit optionalpha.com. They implemented this dynamic tool. It is a helpful pricing tool, a tool to match current ask/bid which allows limit orders to be filled instantly.

0
- ago
#7


0
- ago
#8
And how is this "SmartPricing" any different than "Price Improvements" that Fidelity applies to every trade you make automatically? I might add, Fidelity lets their members keep any price improvements (And they report them.); whereas, most discount brokers pocket any price improvements they collect while trading. And what's the motivation for a "discount" broker to give up their price improvements to traders in the first place?

Also understand, we are talking about cents on the dollar gains here. For the typical trader, it's not going to make a big difference. Unless you're turning over 100s of positions per day, this isn't enough to worry about.
1
Glitch8
 ( 11.93% )
- ago
#9
Exactly, this kind of order routing is a broker option, not something that WL can magically do.
3

Reply

Bookmark

Sort