Draw line at highest candle body close
-
Hi guys, can anyone help with this? So what I want is the following: If the body of candle ID 1 closes higher than the bodies of IDs 2-80, I want a line drawn at the high of the body. This horizontal line (A no, B yes) will of course adjust, if following candle bodies have higher highs. I tried doing it with market properties - highest price (candle period), but it's not what I want, since it's the body of the candle that I'm looking for and not the wicks.
-
@sirluk Try this, use the variables to draw the line.
-
Thanks @jstap, I actually used the same loop you suggested in my previous question and that worked fine. Appreciate your help.
-
@sirluk Your welcome
-
but @jstap, why is this not working? https://fxdreema.com/shared/WttYNtlZc
It works when a bull candle makes a new high, but when a bear candle follows, the line adjusts to the close of said bear candle. It shouldn't according to my plan. If it's not a new high (looking back 80 bars), the line should not adjust...
-
@jstap this shouldn't happen. The pink line should stay at the close of the highest green candle!

-
@sirluk I don't know, I also don't know what settings you are using.
-
@jstap are you able to see my variables? Both variables used start out with the value 2. So if we just look at the right hand side of the tree in https://fxdreema.com/shared/WttYNtlZc the first condition should activate if the candle ID 1 close is higher than ID 2 close...then the formula keeps adding 1 to the variable and runs the condition again. Once the variable hits 80...a line should be drawn at the candle close.
In short...a line should be drawn at the highest closing price of the last 80 candles. I really can't see where I made a mistake...
@l-andorrà any ideas from you?
Appreciate your help, guys.
-
@jstap @l-andorrà oh and the mistake I'm getting you can see in the pic...the line was originally at the close of candle ID 2 (green with long wick) and then moved down to the close of ID 1 once that candle closed. That's what I don't get...my first condition says candle ID 1 close > ID 2 close. Don't know why the line should move.

-
@sirluk It doesen't matter what the loops are doing, it will always draw the line on candle 1 5m close.
-
@jstap why? Especially since I have a condition that says candle ID 1 close has to be higher than ID 2 close?
-
@jstap and it doesn't as you can see in this pic here...the line at close of ID 2 is wrong, it should be at close of ID 3 and stay there. But it also didn't move to ID 1 close. I don't understand...


-
@jstap I think I found the problem...I realized I have to build in a modify variables block before the draw line block to reset the variable to 2. Otherwise it just goes higher and higher.