I'm in the process of creating a strategy which takes a position when the RSI line crosses a certain "trigger" line. For example, "20." But... I keep running into a snag... and I can't find a way to fix it (or if a way to fix it even exists).
In live trading, what happens many times is that the RSI line will cross the threshold (20 in our example here) and then retrace again, and finally move ahead to its intended target destination.
When I use a "crosses above" or "crosses below" condition, what ends up happening is the strategy sees each and every cross as a valid trigger. In other words, lets say the RSI crosses above 20 and enters a long position... but then, it retraces again back below 20, and then... again "crosses above" 20 (and triggers another "true" response to the "if" condition, which closes the original position, and executes another long position).
Is there a way to make the strategy execute only once until it hits its target, even if price drops again below 20? Is there a way to tell the strategy to ignore future entry triggers as long as the exit trigger has not been reached? I can't seem to find a command in the ninjascript for handling this type of scenario.
I would like to tell the strategy: "once you open the trade based on the first trigger condition, keep the trade open until the exit condition is reached, even if price drops back below the initial trigger point and crosses it again." I would like to tell it, after it has opened its position, to ignore any other "entry triggers" which may occur until it reaches its target. This way, it avoids opening and closing multiple trades and triggering multiple unwanted commissions.
Is there a command in NinjaScript which tells the strategy to "ignore" future "first trigger" conditions until the "exit" trigger condition is reached?
Thanks.

Comment