Simulating a Good Til Cancelled Order

Warning – stops, limits, trailing stops, and stop limits are difficult to understand and simulate. You may not understand this tip unless you are a trader experienced with these concepts. It is beyond the scope of our technical support services to educate you in these concepts, so this tip should be examined only by the most advanced users.

When you place a “Good til Cancelled” limit or stop order with a brokerage, the brokerage keeps that stop/limit order active until either it is filled or you physically cancel the order.

However, in the NeuroShell Trader, there are no “Good til Cancelled Orders”. The stop and limit orders in the NeuroShell Trader are only active for the following bar (Good for next bar). This was done so that trailing stops and trailing limit orders that change prices after every bar could be easily created by the user without the need to create cancel conditions.

To create an intraday “Good til Cancelled” order in NeuroShell Trader, you must make the entry/exit condition true until you want the order to be “cancelled” (i.e., it must be true on every bar) and you must also make the stop/limit price retain the same value during the same time period. The selective moving average with an averaging period of 1 accomplishes keeping the same value. The following examples illustrate how this can be accomplished:

Example1

Create a “Good til Cancelled” exit stop order which is placed at 10:30am and will have a stop price of 5 points below the 10:30am price. The order is to be cancelled at 2:30pm if it has not yet been filled.

Exit Order Condition:
X<=Time<=Y( Date, 10:30am, 2:30pm )

Exit Order Stop Price:
SelectiveMovingAverage( subtract(close,5), Time=X(Date,10:30am), 1 )

Example2

The same as example 1 above, except you only want to place the order at 10:30am if the MACD is less than zero.

Exit Order Conditions (ALL of which must be true):
X<=Time<=Y( Date, 10:30am, 2:30pm )
SelectiveMovingAverage( A<B(MACD(…),0), Time=X(Date,10:30am), 1 )

Exit Order Stop Price:
SelectiveMovingAverage( subtract(close,5), Time=X(Date,10:30am), 1 )

Note that in the examples above, you could have used the dayopen instead of the close if you wanted to base the price on the day’s open instead of the 10:30am price.

This technique can be used with daily bars by changing the time conditions to other conditions like crossover, breakout, etc. as long as two of them don’t occur during the period the order is active. These other conditions can be used intraday as well.

Was this article helpful?

Related Articles