I am trying to make an indictaor with lines, but I dont want the lines to go on forever to the right of the screen. Is it possible to determine the length of “Drawhline”? For example 40bars. My screen gets all messy with all the lines and I am only interested in the recently drawn levels.
You can use DEFPARAM DISPLAYONLSTBARONLY=TRUE to only plot the last one (constantly displaying it again and again each new candle, until a new one replaces it). If you are interested in the last 3-4 lines you need to save them and shift them as soon as a new one occurs.
Thank you Roberto and Vonasi. I have managed to Get a indicator that looks ok now 🙂
However, I made this indicator to visually see if one of my trading idea was worth proceeding with. Now, I am starting to code a system and got stuck directly. My “levels” that are drawn in the indicator is easy to find but I want them to still be there in X bars regardless if a new level forms. That is my problem. The level changes as soon as a new level forms. I tried to have a counter and I tried barindex, but I just cant get it to work. My basic code for the level is copied here as well as a picture of the levels from the indicator.
Thank you for your reply. I understand, I will try to do something about that this week. The thing is, my code doesnt work :), but I will do as much as I can and then hopefully you can help me to get further. I will also attach my indicator file. As always, thank you for your prompt respond! I wouldnt have got a single system without your help.
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue