Null Object exceiption in Create() when creating an order

Questions about MultiCharts .NET and user contributed studies.
drolles
Posts: 50
Joined: 03 Dec 2012
Has thanked: 4 times

Null Object exceiption in Create() when creating an order

Postby drolles » 29 Dec 2012

Hi,

I’m getting an Null Object exception when creating an order type in the Create() method.

See screen shot below.

Thanks,

drolles

MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

Re: Null Object exceiption in Create() when creating an orde

Postby MidKnight » 29 Dec 2012

Screen and code snippet please?

drolles
Posts: 50
Joined: 03 Dec 2012
Has thanked: 4 times

Re: Null Object exceiption in Create() when creating an orde

Postby drolles » 30 Dec 2012

Thanks MidKnight for the reminder. PSA.

Cheers,

drolles
Attachments
Null Object exception - Create.JPG
(60.09 KiB) Downloaded 1017 times

MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

Re: Null Object exceiption in Create() when creating an orde

Postby MidKnight » 30 Dec 2012

Hi drolles,

You are putting long entry orders into an array? If so, I can assume you have created the array object? At a glance, the OrderCreator call looks fine to me.

As an aside, maybe you can share why you think the long entry orders need to be in array? Maybe my stuff is too simple, but I've yet to have a need to do this.....

drolles
Posts: 50
Joined: 03 Dec 2012
Has thanked: 4 times

Re: Null Object exceiption in Create() when creating an orde

Postby drolles » 31 Dec 2012

Hi MK,

I’ve used arrays of orders in the past on other platforms. It helps when one is using multiple entries / exits. I had a friend who used to write trading platforms for large institutional, he showed me the trick. In fact he recommended ArrayLists, given their variable sizing feature; but what I’m doing doesn’t require it.

I’m suspecting that there might be a bug that particular OrderCreator method. It was suspicious that it was making the order creator for the short orders. I’ve managed to work around this by using a different order creator (see below).

long_entry_orders[temp_counter] = OrderCreator.MarketThisBar(new SOrderParameters(Contracts.Default, "Long Entry", EOrderAction.Buy));

Cheers,

drolles

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

Re: Null Object exceiption in Create() when creating an orde

Postby Henry MultiСharts » 04 Jan 2013

I’m suspecting that there might be a bug that particular OrderCreator method. It was suspicious that it was making the order creator for the short orders.
Please provide a complete study code for demonstrating this behavior and the workspace you are using.


Return to “MultiCharts .NET”