Open ghost opened 4 years ago
Yes trailing orders are supported.
Trailing stop order - A trailing stop order is entered with a stop parameter
that creates a moving or trailing activation price, hence the name. This parameter
is entered as a percentage change or actual specific amount of rise (or fall) in the
security price. Trailing stop sell orders are used to maximize and protect profit as
a stock's price rises and limit losses when its price falls.
Trailing stop-limit order - A trailing stop-limit order is similar to a trailing
stop order. Instead of selling at market price when triggered, the order becomes a limit
order.
Makes sense, very nice. Thanks.
I think pegged orders are a bit different from trialing orders, no ?
I get a memory leak with the following example, using trailing stop limit sell:
CppTrader::Matching::MarketManager market;
// Prepare symbol & order book
const char name[8] = "test";
CppTrader::Matching::Symbol symbol{0, name};
market.AddSymbol(symbol);
market.AddOrderBook(symbol);
// Enable automatic matching
market.EnableMatching();
uint64_t order_id = 1;
// Add buy limit orders
market.AddOrder(CppTrader::Matching::Order::BuyLimit(order_id++, 0, 2521, 200));
market.AddOrder(CppTrader::Matching::Order::BuyLimit(order_id++, 0, 2519, 300));
market.AddOrder(CppTrader::Matching::Order::BuyLimit(order_id++, 0, 2515, 785));
market.AddOrder(CppTrader::Matching::Order::BuyLimit(order_id++, 0, 2510, 170));
// Add sell limit orders
market.AddOrder(CppTrader::Matching::Order::SellLimit(order_id++, 0, 2556, 300));
market.AddOrder(CppTrader::Matching::Order::SellLimit(order_id++, 0, 2555, 1000));
market.AddOrder(CppTrader::Matching::Order::SellLimit(order_id++, 0, 2535, 200));
market.AddOrder(CppTrader::Matching::Order::SellLimit(order_id++, 0, 2530, 150));
market.AddOrder(CppTrader::Matching::Order::TrailingSellStopLimit(9999, 0, 2500, 2520, 150, 1));
market.AddOrder(CppTrader::Matching::Order::BuyLimit(order_id++, 0, 2550, 500));
market.AddOrder(CppTrader::Matching::Order::SellLimit(order_id++, 0, 2529, 500));
Assertion failed: ((_allocated == 0) && "Memory leak detected! Allocated memory size must be zero!"), function clear, file allocator_pool.inl, line 338.
The leak seam to be caused because of the TrailingSellStopLimit and after the submission of the last SellLimit
Any suggestions on this ? Thank you
Visual Leak Detector read settings from: Z:\soft\Development\VisualLeakDetector\vld.ini Visual Leak Detector Version 2.5.4 installed.
No memory leaks detected. Visual Leak Detector is now exiting.
The issue is not reproducing on my side. Could you please check if it still actual on your side?
Is there support for pegged order types ? or support for limit orders that dynamically move with the best market quotes ?