Hi, I am horrible at coding and would like to ask the community for some assistance at putting together what I would think is a pretty basic system to backtest. Now, I have watched all the videos and read almost all the posts on developing a trading system but I just can't seem to get it done, so I'm reaching out to the community.
I am looking to backtest a system on a 4 tick renko chart that buys 4 ticks below a fractal low or sells 4 ticks above a fractal high. Initially, I'd like to test a 9 fractal rotation with a 5 tick stop loss and an 8 tick target. Given the results looking to optimizing those values.
Thanks in advance for your help
First, let me warn you, backtesting Fractals (or Zig Zag) is dangerious, because you are looking into the future and essentially cheating....using info you wouldn't have realtime. A 9 bar fractal, for example, is really looking forward 4 bars to make sure the bar with the fractal is lower than the 4 below it and 4 after it.
That being said, it looks like you are requiring price to move below a PREVIOUS fractal low. If that is the case, then it's valid. As long as you're not buying the closing price of a fractal low or high bar, then that is valid and possible.
So you want to look back at the LAST fractal low only, and buy when price moves 4 ticks below the low of that last fractal low?
Hi Chad, yes that is correct. Sorry for not making that clear. I want to buy the previous fractal's low price -4 ticks and if on the other side, sell the previous fractal's high + 4 ticks. In both cases, I will have a stop loss of 5 ticks from entry and a profit target of 8 ticks from entry.
So far I've only coded the long side but test this out some and let me know what you think.
Here is chart definition with TSYS added...
https://www.linnsoft.com/charts/fbs-fractalbreaksystem-es
Entry rule is...
LO <= SSTAT.1 - 4 * TINC AND SET(V#10, SSTAT.1)
with SSTAT giving the low of the last down fractal. So it looks for LO to be at or below the last fractal low minus 4 ticks and if so, it sets V#10 to that price and goes long at that price.
Target rule..
HI >= ENTRY + 8 * TINC AND SET(V#10, ENTRY + 8 * TINC)
Stop rule...
LO <= ENTRY - 5 * TINC AND SET(V#10, ENTRY - 5 * TINC)
Let me know if you have any questions.
Thank you very much. I'll run with that and let you know. Very much appreciated.
Aloha
Just out of curiosity, the buy fractal low didn't indicate the buy on the chart I uploaded as an example. I would think that it should have.
Thanks
And only want to enter a trade once per fractal signal.
OK. Import the chart again and replace all. This one should only take the first time the price drops 4 ticks below previous frac low.
https://www.linnsoft.com/charts/fbs-fractalbreaksystem-es
I thought you wanted to enter when the price moved 4 ticks below the previous down fractal (and not just down to touch previous down fractal)?
That is correct. In this example, price moved down 5 ticks below the previous fractal (3376.50 moved to 3375.25)
OK. I had to fix the logic to put the entry after the exit so it doesn't get in and out on the same bar (which TSYS does not display and shouldn't happen anyway). So here is the updated chart def: https://www.linnsoft.com/charts/fbs-fractalbreaksystem-es
Pages