Exercise

Specifying sigval in add.rule()

Now that you've specified the column containing the relevant signal in your strategy, the next argument to specify in add.rule() is sigval, or the value that your signal should take to trigger the rule.

Remember that all signal outputs are either 1s or 0s. Effectively, a signal is either "on" or "off" at any given time. For our purposes, this is equivalent to two possible logical values: TRUE or FALSE. When specifying sigval in your add.rule() command, you need to indicate whether the rule is triggered when the signal value is TRUE or FALSE.

To proceed with the new exit rule in your strategy, you will want to specify that a transaction should occur when filterexit is equal to TRUE. The add.rule() command from your previous exercise is available in your workspace.

Instructions

100 XP
  • Set the sigval argument in add.rule() equal to TRUE.