.Send(num_lots) is not sending the proper number of orders  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
MattR
Posts: 5
Joined: 06 Feb 2014
Has thanked: 1 time

.Send(num_lots) is not sending the proper number of orders

Postby MattR » 21 Jan 2015

In my Create() section, my order is being set up exactly as instructed by the documentation and IDE. However, when I try to use the my_order.Send() method and specify a number of lots, it continues using the default of 1 instead of the num_contracts integer which I am specifying.

Code: Select all

my_order =
OrderCreator.MarketNextBar(new SOrderParameters(EOrderAction.SellShort, "my_order"));
In CalcBar() section, I have the following code which does not produce the desired result. Every time it runs, it will create an order with 1 contract:

Code: Select all

my_order.Send(num_contracts);
I have verified via Expert Commentary that num_contracts contains an integer larger than 1.

Am I using this correctly? Is there better recommended approach to modifying the number of lots on the fly?

Thanks!

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

Re: .Send(num_lots) is not sending the proper number of orde  [SOLVED]

Postby JoshM » 22 Jan 2015

Code: Select all

my_order =
OrderCreator.MarketNextBar(new SOrderParameters(EOrderAction.SellShort, "my_order"));
In CalcBar() section, I have the following code which does not produce the desired result. Every time it runs, it will create an order with 1 contract:
If you want to specify the number of contracts in the code (instead of the default value taken from the 'Strategy Properties' window), you'll need to explicitly set this when creating the order in `Create()`, like so:

Code: Select all

protected override void Create()
{
enterLong = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.UserSpecified, EOrderAction.Buy));
}

MattR
Posts: 5
Joined: 06 Feb 2014
Has thanked: 1 time

Re: .Send(num_lots) is not sending the proper number of orde

Postby MattR » 22 Jan 2015

So, you mean it is not possible to specify the number dynamically??!

In order to specify 1-10 lots, I'm going to need to create 10 different orders?

MattR
Posts: 5
Joined: 06 Feb 2014
Has thanked: 1 time

Re: .Send(num_lots) is not sending the proper number of orde

Postby MattR » 22 Jan 2015

If what you said is correct, why on earth is this overload available?
Screen Shot 2015-01-22 at 10.09.56 AM.png
(16.64 KiB) Downloaded 632 times

MattR
Posts: 5
Joined: 06 Feb 2014
Has thanked: 1 time

Re: .Send(num_lots) is not sending the proper number of orde

Postby MattR » 22 Jan 2015

Nevermind. What you suggested worked. Thank you.


Return to “MultiCharts .NET”