How can I store the date of a candle identified by the ZigZag indicator?
-
How can I store the date of the candle at h0 in the ZigZag indicator in a variable? I want to use this date as the first time for the Fibonacci levels (time 1). Essentially, my goal is to draw a Fibonacci level from h0 that continuously adjusts with the live market price so that I can open trades based on specific conditions when the price touches the desired levels. The 100 level should be drawn from h0, and the 0 level should move with the price.
I would greatly appreciate your guidance, as I have many questions about building this bot with this scenario.
-
@m-aghilian You can do it this way:

-
I've done something similar before where I needed to track a key candle for drawing dynamic levels. What worked for me was storing the time of the h0 candle from the ZigZag indicator using something like Time[ZigZagPeak]. Once you've got that timestamp, you can use it as your reference point for the Fibonacci. I made it so the 100% level stays fixed at h0, while the 0% level adjusts with the current market price. You just need to update the 0% level with the live price in your on-tick loop. It took a bit of trial and error to get it to update smoothly, but once it’s set up, it’s super handy for catching those touch trades.