How Stops Work

There are a few different things to know about how Trading Blox handles Stops.

How do I enter an order with a stop?

Use a broker order like the following:

broker.EnterLongOnOpen( exitStop ) - Buy on the open with an optional stop price

broker.EnterShortOnOpen( exitStop ) - Sell on the open with an optional stop price

broker.EnterLongOnStop( entryStop, exitStop ) - Buy on a stop with an optional exit stop price

broker.EnterShortOnStop( entryStop, exitStop ) - Sell on a stop with an optional exit stop price

broker.EnterLongAtLimit( entryLimit, exitStop ) - Buy at the limit with an optional stop price

broker.EnterShortAtLimit( entryLimit, exitStop ) - Sell at the given limit with an optional stop price


The entryStop or entryLimit (where applicable) are the basic On_STOP or At_LIMIT orders.  The exitStop, which is available to all these orders, is a protective Exit-Price Stop-Order.   Let's say the broker enters long at $11 with an exitStop of $10.  Should the position's price drops below $10 on the day of entry, the position will automatically be exited.  But check the Trading Blox Builder User's Guide -> Global Suite Simulation -> Entry Day Retracement Percent Parameter setting value for details on whether an entry day stop will be exited based on the low, or the close of the day.  Note: When Protective Stops placed in this manner, they are only good for the day of entry.  If you want them to create an exit price order after the day of entry, you will need to create a new protective price order.  Usually, this is done in the Exit Orders Script section that only runs when the instrument has an active position.  The need to create an new protective price order for each price-bar is required to make it easier to change the protective price without having to remove the previous protective price.  


Are protective Stop-Price orders required?

No.  An Exit Stop-Price is optional for all Broker orders.   Some reversal systems are always in the market and don't use stops.  However, remember that position risk calculations for each instrument are based upon the use of a protective Stop-Price order.   If you have no stops, Trading Blox assumes undefined/Unlimited Risk.  Using Blocks like the Fixed Fractional Money Manager, which is calculated required a risk amount to create an entry position order quantity amount.  When there is no protective price, the logic in the Fixed Fractional sizing will assume unlimited risk and will assign a zero quantity to the entry order.  In most cases, a zero quantity entry order will be canceled.  Canceled order don't create a trading position.


My position was not exited, and its protective stop price for my order went below the exit price on the next bar.  

The protective stop as placed with an entry order is saved with the instrument, but the protective exit-order only placed for the day of entry for a new position. See the following question.


Can I keep my protective stop "active" during the duration of my position?

Yes!  The protective stop is stored as instrument.unitExitStop.  However, you must use a new broker order every day so an active protective exit order is active to "hold" your protective exit-stop.  You could use an order like the following:


broker.ExitAllUnitsOnStop( instrument.unitExitStop )


Many of our built-in systems use this method of "holding" stops.  Open up their Exit Order script sections to see how they are being used.


Can I change my stop once it is set?

The function instrument.setExitStop( ) will set a new stop.  


instrument.SetExitStop( unitNumber, stopPrice ) - Sets a new stop price for a particular unit.  This value is used to calculate risk at the end of the day.   If you just have one unit on, you do not need to enter a unitNumber.


instrument.SetExitStop( newStopPrice )
broker.ExitAllUnitsOnStop( instrument.unitExitStop )


What script should I change my stops in?

The Exit Orders and Adjust Stops script are the best places to keep protective exit orders active.  All new Exit and Entry orders will be active for the next price bar.  Protective Exit Stop-Price orders are then used in the end-of-day risk and other calculations.  We usually place all entry broker orders in the entry script, and exit broker orders in the exit script, and protective price orders will also work well when updated in the Adjust Stops script section.


What if I have multiple units?

Use the same function - you can enter a different stop for each unit:


instrument.SetExitStop( unitNumber, stopPrice )


An example of how you might want to handle protective-exit price stops with multiple units is available in the blox, Turtle Entry Exit -> Exit Orders script section.


Edit Time: 10/6/2017 12:43:00 PM

Topic ID#: 374



Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software