Delete object after second object is created/creating only one object at beginning of indicator
-
Hey all. I've been trying to add lines to my indicator. To explain it thoroughly lets say the indicator is in a downtrend once it reverses to an uptrend and the candle closes it will create a line at the opening price of the previous candle. This is the easy part. The hard part is i'd like it to only create a line at the beginning of the trend only and not for each candle after.
The second problem I have is deleting the previous object. So lets say I create a line for the uptrend. If another uptrend starts id like to create another line but delete the previous one. Here's my example so far and a picture to help
https://fxdreema.com/shared/aOs7jg7Cc
-
@mannybear1 You can create two variables. Then store the price value of the recently created line into it. Then you can use an 'For each object' block searching for thet line with that variable to be deleted while the new one created is stored the same way.
-
Do you mind giving me an example?
-
@mannybear1 Sure. Firstly you need to connect these blocks immediately below those drawing the lines:

I created just one variable, but you will need 2 different ones. I also selected the horizontal type object. Then you craete a new independnet block tree with these blocks:

This will remove all lines with a different price level. Please be aware you need to specify the same color as per the on chart line. Otherwise it will not work.
-
@l-andorrà This was really helpful in the creating line part. Sadly the new lines get deleted before The are drawn or if I alter it a little the new lines will get deleted after a little bit. How would I delete the previous line on the chart. So as a new line forms delete the old one. Once again you've been really helpful thank you.
-
@mannybear1 Can you please share the link to your project?
-
Yes of course! https://fxdreema.com/shared/oioHoNfuc
Once again thank you. -
@mannybear1 Both block trees headed by blocks 458 and 467 should be moved to the 'on chart' tab. Additionally both 'pass' blocks are unnecessary.
-
@l-andorrà You've been a big help thank you very much. Sadly it just wouldn't work. The good news is after I kept testing I finally found a solution. https://fxdreema.com/shared/GamfMjhdc
I saw that a couple of people had the same question as me and its never been answered before so i hope this helps. Once again I really appreciate the help and the website. Been a huge help in my trading. -
@mannybear1 Congrats! Good for you.

-
@mannybear1 hi my friend, there is a special indicator in your project. can you share it too? thank you for your help
-
@ladydolares ohh ok my friend,I found it