Reputation: 11
Why can't the policy tester trade at the specified price that day?Can you only do the day's trading at the closing price?
How should I operate to meet the requirements in my question?
Upvotes: 0
Views: 26
Reputation: 21332
If you want to enter a trade at a specific price, you need to place a limit order by using the strategy.entry()
function. By default it will enter with a market order.
strategy.entry(id, direction, qty, limit, stop, oca_name, oca_type, comment, alert_message) → void
limit (series int/float) An optional parameter. Limit price of the order. If it is specified, the order type is either 'limit', or 'stop-limit'. 'NaN' should be specified for any other order type.
stop (series int/float) An optional parameter. Stop price of the order. If it is specified, the order type is either 'stop', or 'stop-limit'. 'NaN' should be specified for any other order type.
Upvotes: 0