Indicator: drawn not on all bars

Forums ProRealTime English forum ProBuilder support Indicator: drawn not on all bars

Viewing 15 posts - 1 through 15 (of 16 total)
  • #124529

    I want my indicator to draw a solid line only in certain parts of the graph and nothing in others.
    I tried to return a zero value, but if I do, the line on the screen drops to zero and remains visible, while I want it to disappear completely.

    example:

     

    #124531

    robocop – Please always use the ‘Insert PRT Code’ button when posting code. I have tidied up your post for you.

     

    You will have to use DRAWSEGMENT if you want a line to only be shown at certain times.

    https://www.prorealcode.com/documentation/drawsegment/

    #124543

    i can’t use drawsegment because i know my drawing is curved and it’s not a straight line.
    imagine having to join the maximum (or mininum) of some non-adjacent candles by means of arches, like the Mc Donald’s symbol.
    So I have to use “return” to return a series of values ​​that make up a curve (code is simplified to make idea).

    Can someone help me?

    Robocop

    PS: thak you to correct my post to insert sample code

    #124553

    You simply calculate your value at each candle and draw a segment from one candle to the next. Then you get exactly the same result as using RETURN but you can choose to draw a series of segments or not.

    #124556

    Here you go – exactly what you asked for drawn using SEGMENT.

     

    2 users thanked author for this post.
    #124615

    Here you go – exactly what you asked for drawn using SEGMENT.

    Thak you very much. You are right.

    And, i don’t want abuse about your know-how…, two question

    a)

    force platform to call indicator only on the very last bar, and i can plot any point ‘in the past’?

    b)  my indicator will run in daily or weekly timeframe,  can i read timestamp (something like yyyymmddhhmmss) for maximum and mininum of a candle (day/week depending timeframe)?

     

    #124629

    DRAWONLASTBARONLY does exactly that. It only draws whatever your code is trying to draw once at the last bar on the chart. For example if it was not in your code and you drew a line across the chart at the close price then you would have thousands of lines on your chart but with DRAWONLASTBARONLY = TRUE you only have one at the latest closing value.

    Not sure that I fully understand your second question. You can store anything you like in a variable such as TIME, OPENMINUTE, DAYOFWEEK etc. If however you want to draw something to when that event happened then you have to store the BARINDEX when it happened.

    There are lots of info and coding examples to be found here that might be generally helpful for you:

    https://www.prorealcode.com/prorealtime-documentation/

     

    If you are using v11 then there is an instruction DATETOBARINDEX that might do what you want. I know there was a slight bug in the first release of it which I’m not sure has been fixed yet or not.

    https://www.prorealcode.com/documentation/datetobarindex/

     

     

    #124650

    I am in DAILY Timeframe. Whith “High” i can have then High of the current bar. With “low” i can have the low of the current bar.

    Is it possible to know the time when the maximum was recorded? Is it possible to know the time when the minimum was recorded?

    #124653

    If I understand what you are asking correctly then in an indicator the answer is no as MTF is not yet available for indicators. In a strategy if you use MTF then yes but then you can’t launch your strategy on the daily time frame.

    #124654

    If I understand what you are asking correctly then in an indicator the answer is no as MTF is not yet available for indicators. In a strategy if you use MTF then yes but then you can’t launch your strategy on the daily time frame.

    Yes, i am in an indicator. So, I have to wait until MultiTimeFrame will be available for indicators, right?

    #124656

    using DRAWSEGMENT instead of RETUN values, i don’t find a way to control the style of the line, for example dotted line or bold, i think i can control only colour.

     

    #124657

    Yes. Even then we don’t know how it will work. Perhaps we have to do the same as on strategies and run our indicator on the fastest time frame.

    At the moment from what I have heard all update deadlines are unknown due to the staff at PRT working from home. Obviously in this current  situation releasing major updates is not such a good idea. I guess we all just have to be a little patient right now.

    #124658

    Yes, only colour.

    With v11 you’ll be able to control other settings (like RETURN).

    1 user thanked author for this post.
    #124659

    Roberto answered your post while I was editing it. Please don’t quote posts that contain a large amount of code as it makes a really unreadable mess of the forums. If you want to quote a statement or sentence in a post so that people know what you are referring to then just highlight it and then click on quote.

    1 user thanked author for this post.
    #124661

    Yes, only colour.

    With v11 you’ll be able to control other settings (like RETURN).

    Hi RobertoGozzi, but now i run V11.1-1.8.0_202 and i don’t find any wy to control style (like RETURN).

Viewing 15 posts - 1 through 15 (of 16 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login