All functions discussed, are available to download here:
OnCandle as Your Start Point
Most strategies in the contest use the onCandle method to start their strategies, but not all utilize the following two fail-safes.
- Matching candle instrument to default instrument
- Comparing default period to candle period
Checking if the candle instrument is the same as the current default instrument is necessary for situations where a strategy loops through currency pairs looking for qualifying signals or to create a trading currency basket.
Example of Different OnCandle Period and Instruments
The example below checks first for the 20-day Average True Range (ATR) values of 4 pairs before assigning the instrument to trade. Note: It uses the daily candle while a different part of the strategy uses 1-minute candle.
The above two chec…