SmartQuant Discussion
http://www.smartquant.com/forums/

Script to CloseAll Pending Orders in "Order Manager"
http://www.smartquant.com/forums/viewtopic.php?f=44&t=8476
Page 1 of 1

Author:  RickTrader99 [ Fri Oct 22, 2010 4:27 pm ]
Post subject:  Script to CloseAll Pending Orders in "Order Manager"

Hi,

im new to oq, is it possible to make script close all Pending Orders in "Order Manager"? if so, please give me example.

Thanks

Author:  Baraz Sergey [ Fri Oct 22, 2010 4:36 pm ]
Post subject:  Re: Script to CloseAll Pending Orders in "Order Manager"

Hi,

Please try the following script.

Code:
   foreach (Order order in Orders)
         if (!order.IsDone)
            order.Cancel();


Regards,
Sergey.

Author:  RickTrader99 [ Sat Oct 23, 2010 12:56 am ]
Post subject:  Re: Script to CloseAll Pending Orders in "Order Manager"

The name "Orders" does not exists in current context.

any idea what is wrong ?

Author:  Dr. Anton Fokin [ Sat Oct 23, 2010 10:11 am ]
Post subject:  Re: Script to CloseAll Pending Orders in "Order Manager"

Are you running this code inside a strategy?

Regards,
Anton

Author:  RickTrader99 [ Sat Oct 23, 2010 11:06 am ]
Post subject:  Re: Script to CloseAll Pending Orders in "Order Manager"

Im running this code as Script , but it doesn't work

Code:
public class MyScript : Script
{
   
   public override void Run()
   {
      // Type your code here
      foreach (Order order in Orders)
         if (!order.IsDone)
            order.Cancel();
   }
}


Dr. Anton Fokin wrote:
Are you running this code inside a strategy?

Regards,
Anton

Author:  Dr. Anton Fokin [ Sat Oct 23, 2010 12:38 pm ]
Post subject:  Re: Script to CloseAll Pending Orders in "Order Manager"

You don't have access to Orders in the script, Orders object references a list of current Strategy orders (actually it's Strategy.Orders property, you can find it in the API documentation).

We can add OrderManager object to make it possible to access order lists in a script.

Regards,
Anton

Author:  RickTrader99 [ Sat Oct 23, 2010 1:13 pm ]
Post subject:  Re: Script to CloseAll Pending Orders in "Order Manager"

Thanks, that would be great.
Dr. Anton Fokin wrote:
You don't have access to Orders in the script, Orders object references a list of current Strategy orders (actually it's Strategy.Orders property, you can find it in the API documentation).

We can add OrderManager object to make it possible to access order lists in a script.

Regards,
Anton

Author:  okokok [ Thu Mar 31, 2011 4:13 pm ]
Post subject:  Re: Script to CloseAll Pending Orders in "Order Manager"

Dr. Anton Fokin wrote:
You don't have access to Orders in the script, Orders object references a list of current Strategy orders (actually it's Strategy.Orders property, you can find it in the API documentation).

We can add OrderManager object to make it possible to access order lists in a script.

Regards,
Anton


Hi Anton,

Does recent version of OQ allow to access active orders in context of a solution's Scenario.cs (e.g. OrderManager mentioned in your post)?

Thanks!

Author:  newDave [ Wed Jun 20, 2012 6:37 pm ]
Post subject:  Re: Script to CloseAll Pending Orders in "Order Manager"

As I understand feature is still not available. Right ?

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/