Rejected orders - how to insure they fill

Questions about MultiCharts and user contributed studies.
DaveAronow
Posts: 72
Joined: 20 Apr 2014
Has thanked: 9 times
Been thanked: 8 times

Rejected orders - how to insure they fill

Postby DaveAronow » 24 Mar 2016

One of my strategies sends orders only if specific criteria are met (for example price is above/below a moving average) but the actual stop prices are based on earlier price action. As a result an order may reject since the price has already been traded through. As an example the current price of ES is 2015.25 but my buy stop @ 2012.5 rejects since the price was already traded through.

I know I can rewrite my script to handle this scenario and send a market order but I'd rather not as the script has been fine for years (previously I was using TS to automate it and converting all orders to market orders via email).

Is there any way to have MC handle this without changing my script? Will the
"Convert unexecuted limit or stop entry orders to market orders" check box work in this scenario? In this case the order is not executed (because it was rejected) so I'm not clear if rejected orders are counted as "unexecuted".

Edit: Note I am using Async autotrading although not sure that matters.

Xyzzy
Posts: 162
Joined: 19 Mar 2011
Has thanked: 43 times
Been thanked: 79 times

Re: Rejected orders - how to insure they fill

Postby Xyzzy » 24 Mar 2016

I had a similar issue with my code. I just fixed it by placing the order at the minimum of either the price calculated by my strategy or the current closing price.

I first created a function _MinVal to calculate the smaller of two values:

Code: Select all

Inputs:
ValueA(NumericSimple),
ValueB(NumericSimple);

_MinVal= IFF(ValueA < ValueB, ValueA, ValueB);
In my strategy code, I have a variable "PriceLE" for the long entry price that my strategy has calculated. I then place an order as

Code: Select all

Buy next bar at _MinVal(PriceLE, close) limit;

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Rejected orders - how to insure they fill

Postby TJ » 24 Mar 2016

I had a similar issue with my code. I just fixed it by placing the order at the minimum of either the price calculated by my strategy or the current closing price.

I first created a function _MinVal to calculate the smaller of two values:

Code: Select all

Inputs:
ValueA(NumericSimple),
ValueB(NumericSimple);

_MinVal= IFF(ValueA < ValueB, ValueA, ValueB);
In my strategy code, I have a variable "PriceLE" for the long entry price that my strategy has calculated. I then place an order as

Code: Select all

Buy next bar at _MinVal(PriceLE, close) limit;
You could use these keywords:

MaxList
MinList


Return to “MultiCharts”