A Few MC.NET questions

Questions about MultiCharts .NET and user contributed studies.
zentenk
Posts: 2
Joined: 07 Mar 2014
Has thanked: 1 time

A Few MC.NET questions

Postby zentenk » 09 Mar 2014

I'm new to MC.NET and new to automated trading and so far I couldn't find information for the following questions that I have.

1. How can I check the status of a specific order? (whether an order is Filled, pending, working, cancelled, etc.). I'd like to do logic based on whether a specific order's current status.

2. Get information about a specific filled order for the purpose of doing logic. e.g. I have 2 limit orders set at different prices, I'd like to get the avg fill price for one of those orders.

3. I read https://www.multicharts.com/trading-sof ... rder_Types and I can't find any information on the datafeed Continuum (a division of CQG). As Zen-Fire is currently unavailable some brokers such as Mirus is now using Continuum, is there any information available on how orders would be handled when using this datafeed?

Thanks!

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: A Few MC.NET questions

Postby JoshM » 10 Mar 2014

1. How can I check the status of a specific order? (whether an order is Filled, pending, working, cancelled, etc.). I'd like to do logic based on whether a specific order's current status.

2. Get information about a specific filled order for the purpose of doing logic. e.g. I have 2 limit orders set at different prices, I'd like to get the avg fill price for one of those orders.
The IOrders collection contains information about orders. I don't have a code example at hand, but if you google "trademanager site:http://www.multicharts.com" you'll come across a few examples. Perhaps they are enough to get you started.
3. I read https://www.multicharts.com/trading-sof ... rder_Types and I can't find any information on the datafeed Continuum (a division of CQG). As Zen-Fire is currently unavailable some brokers such as Mirus is now using Continuum, is there any information available on how orders would be handled when using this datafeed?!
CQG has multiple APIs. Continuum is one of them. It is not currently supported in MultiCharts.
"Regular" CQG API is supported in MultiCharts.
Source.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: A Few MC.NET questions

Postby Henry MultiСharts » 13 Mar 2014

1. How can I check the status of a specific order? (whether an order is Filled, pending, working, cancelled, etc.). I'd like to do logic based on whether a specific order's current status.
Hello zentenk,

Here is a sample code for getting "Generated" and "Filled\Canceled" values from TradeManager.Order:

Code: Select all

using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
using ATCenterProxy.interop;
using PowerLanguage.TradeManager;
using ATCenterProxy;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;


namespace PowerLanguage.Strategy
{
public class Test_HistoryOrdersLookUp : SignalObject
{
public Test_HistoryOrdersLookUp(object _ctx) : base(_ctx) { }

protected override void Create()
{
}

protected override void StartCalc()
{
Output.Clear();
ExecControl.RecalcLastBarAfter(TimeSpan.FromSeconds(1));
}

bool subscribed = false;

protected override void CalcBar()
{
if (!subscribed)
{
TradeManager.TradingData.Orders.FinishChanging += new EventHandler(Orders_FinishChanging);
subscribed = true;
}

if (Bars.CurrentBar == 1)
{
TradeManager.TradingData.Orders.IntervalFltr.From = DateTime.Now.AddDays(-20);
TradeManager.TradingData.Orders.ProfileFltr.CurrentValue = "Interactive Brokers";
}

TradeManager.ProcessEvents();
}

protected override void OnRecalcLastBarAfterEvent()
{
CalcBar();
ExecControl.RecalcLastBarAfter(TimeSpan.FromSeconds(1));
}

void Orders_FinishChanging(object sender, EventArgs e)
{
TradeManager.IOrders ord = sender as TradeManager.IOrders;
Output.WriteLine("Data Count = {0}", ord.Items.Length);
foreach (TradeManager.Order o in ord.Items)
{
Output.WriteLine("Order Profile = {0}, Order ID = {1} , ExecPrice = {2}, Generated = {3}, Filled\\Canceled = {4} ",
o.Profile, o.ID, o.ExecPrice == null ? 0 : o.ExecPrice, o.GeneratedDT, o.FinalDT == null ? new DateTime(): o.FinalDT);
}
}
}
}


Return to “MultiCharts .NET”