Hi, I am looking for some help generating a section of code to help smooth out one of the trading strategies I am working on. Thanks to the useful pdf created in the help section I have managed to work through most of my issues, however I do not seem to be able to get my head around something which should be extremely simple. I am looking to implement a gap between trades and I assumed that the easiest way to do this would be to set a minimum number of bars between the last executed trade and the next one triggered by the strategy. Basically, once my trading indicators are met I enter the market and exit very quickly, however I do not then want to enter the market again if those conditions continue to be met for the next ‘x’ amount of bars. Could anybody help me understand how I stop the strategy re-entering the market for ‘x’ amount of bars.
E.g. If I were to open a long position when the RSI crossed over 70 with a very short target profit of 3 pips the trading strategy would after exiting a profitable trade continue re-entering the market each time the RSI re-crossed over 70. If we were working on a 1 minute chart the RSI may dip below and re-cross the 70 mark a number of times for the next 30 minutes. In the above circumstance I would be looking to avoid re-entering the market after the initial trade had been entered and exited during that 30 minute window.
Any help would be much appreciated.
Thanks, Ben.
Penny has finally dropped, explanation no longer needed.