I need a little help with some code that I cant seem to get to work probably. I’m trying to detect if a cross of the highest function has occurred within the last 20 bars. Can you use the highest function in a for loop. I am heading towards a breakout system with a pullback.
I have tried the code as an indicator and I seem to get the right output but not in trading system.
With the indicator I get the expected histogram when triggered but in the back test I don’t seem to get any triggers. I used the graph function to try and see what was happening in the back test but it came out blank. I have simplified the code to find the issue because when included there were no trades taken. So when I started to investigate it seems as though a never get a positive result from the loop. maybe I’m missing something. Please find indicator code below I was using.
When I use your original trading system, it does generate positions…
I have set the number of contracts from 0.2 to 1…
The signals are a bit “treacherous” for example the signal “b1” can remain valid for 20 bars so within 20 bars after the actual “trigger” more buy signals can follow…
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok