Hello,
I try to measured order latency time. Stopper started order send, and stopped at OnBrokerPositionChange(); This function ran 10-20x times to 1 order between 20ms-3000ms. I dont know which is the real latency from those.
Is there any way to stopper order latency?
thanks,
Bandito
order latency time
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: order latency time
Hello Bandito,
Do you want to trace the time between "order generated" and "order filled" statuses?
Do you want to trace the time between "order generated" and "order filled" statuses?
Re: order latency time
Hello Henry,
Yes, I'd like to trace xyorder.send() between "order filled" or "order executed".
thanks,
Bandito
Yes, I'd like to trace xyorder.send() between "order filled" or "order executed".
thanks,
Bandito
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: order latency time
Please refer to TradeManager IOrders collection:
public DateTime GeneratedDT { get; private set; }- time of the order creation, i.e. the time when the order appeared in MultiCharts .NET during the current connection.
public DateTime FinalDT { get; private set; } – time when the order moves to the final state.
public DateTime GeneratedDT { get; private set; }- time of the order creation, i.e. the time when the order appeared in MultiCharts .NET during the current connection.
public DateTime FinalDT { get; private set; } – time when the order moves to the final state.
Re: order latency time
I tryed to send order with TradeManager, but not success. Study ran correctly, but if I put to the chart pop up bog red error box. Please help!
We should have more short code examples with comments.
We should have more short code examples with comments.
Code: Select all
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
using ATCenterProxy.interop;
using PowerLanguage.TradeManager;
namespace PowerLanguage.Strategy {
public class Test_Trade_Icebob : SignalObject {
public Test_Trade_Icebob(object _ctx):base(_ctx){}
private String LMAXProfileName = "LMAX";
private String LMAXAccount = "226011989";
private String LMAXSymbol = "EUR/USD";
OrderParams LMAXparam;
ITradingProfile LMAXprofil;
protected override void Create() {
LMAXparam.action = ATCenterProxy.interop.MTPA_OrdrActn.eMTPA_OA_Buy;
LMAXparam.category = ATCenterProxy.interop.MTPA_OrdrCtgry.eMTPA_OC_Market;
LMAXparam.tif = ATCenterProxy.interop.MTPA_OrdrTimeInForce.eMTPA_TIF_DAY;
LMAXparam.limit_price = 0;
LMAXparam.stop_price = 0;
LMAXparam.contracts = 1;
}
protected override void StartCalc() {
// assign inputs
if (LMAXprofil == null)
LMAXprofil = GetProfile(LMAXProfileName);
}
protected override void CalcBar(){
// strategy logic
PlaceOrder(LMAXprofil, LMAXSymbol, LMAXAccount,LMAXparam);
}
protected void PlaceOrder(ITradingProfile p, String Symbol, String Account, OrderParams op)
{
if (p.ConnectionState == ETM_ConnectionChanged.eTM_CC_Connected)
{
p.CurrentAccount = Account;
p.PlaceOrder(op);
}
}
protected TradeManager.ITradingProfile GetProfile(String Name)
{
foreach (ITradingProfile p in TradeManager.TradingProfiles)
{
if (String.Equals(p.Name, Name)) return p;
}
return null;
}
}
}
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: order latency time
bandito,
There are multiple issues in your code:
1. You need to check for realtime calculation in the code if(Environment.IsRealTimeCalc). Otherwise the signal will start sending orders from the start of the calculation on historical data.
2. In the beginning of each calculation you need to call TradeManager.ProcessEvents(); Otherwise TradeManager data will not be updated.
3. In method void PlaceOrder(ITradingProfile p, String Symbol, String Account, OrderParams op) you need to add the following line
p.CurrentSymbol = GetSymbolInfo(p.PluginName, ESymbolCategory.Future, Symbol, "CME"); (adjust it according to your symbol settings).
Please use the TradeManager example for reference.
There are multiple issues in your code:
1. You need to check for realtime calculation in the code if(Environment.IsRealTimeCalc). Otherwise the signal will start sending orders from the start of the calculation on historical data.
2. In the beginning of each calculation you need to call TradeManager.ProcessEvents(); Otherwise TradeManager data will not be updated.
3. In method void PlaceOrder(ITradingProfile p, String Symbol, String Account, OrderParams op) you need to add the following line
p.CurrentSymbol = GetSymbolInfo(p.PluginName, ESymbolCategory.Future, Symbol, "CME"); (adjust it according to your symbol settings).
Please use the TradeManager example for reference.