This script has instrument context by default.  When it executes it will have direct access to all IPV properties and functions.


Use this script section to create orders for new positions, or for adding units to a position.  Entry Orders is called for each instrument with a current date record.



This scripts section will not normally execute when a instrument date record is not available.  A current record is a record date for the same date on which this script is executing.  This means a test date must have an instrument date in order for this script to execute.  When it does have a missing instrument record any orders that were active for the active test date will not be filled or expired by the brokerage process.  However, when an order is still active after the brokerage process, it will be available to execute an order fill or allowed to expire on the next available instrument date trading session.



'  Following Entry Orders script is copied taken from
'  the Creating a New System tutorial at the beginning of this manual:
If macdIndicator > 0 AND instrument.position <> LONG THEN
'  Two conditions must be met - MACD above 0 and
'  instrument is not LONG, Then create a LONG order.
If macdIndicator < 0 AND instrument.position <> SHORT THEN
'  Two conditions must be met - MACD below 0 and
'  instrument is not SHORT, Then create a SHORT order.
'   This script has the broker object enter new long
'  and short positions depending on the macdIndicator
'  value to determine if is positive or negative.
'  Script has a common feature of checking for existing
'  positions before entering orders, the check for:
    instrument.position <> LONG
'  and
    instrument.position <> SHORT
'  which is part of the IF statement.


Unless you wish to add to an additional Unit to an existing position you should always check for an existing position before creating a new order to enter in the same direction.


Edit Time: 5/10/2017 8:42:36 AM

Topic ID#: 302


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