a little help on adding variables

Forums ProRealTime English forum ProBuilder support a little help on adding variables

Viewing 11 posts - 1 through 11 (of 11 total)
  • #70013

    I have created an indicator which shows you the high and the low price on the one hour candle stick! (only one hour chart)

    its only on the 12 am candle stick at the moment!!!

    is there a way to add a variable or anything to change the candle stick very easily?

    Ex: lets says if i want to see 6am candle’s high and low price. to change it easily without going in to the code and change the time!!i have tried to add variables but doesn’t seems to be working.. probably im not doing it right!! please any help appreciated!

     

    many thanks

    #70017

    I added variable MyTime (see attached screenshot) setting 010000 (leading ZEROs are dropped by PRT) as default thet you may change from the Indicator Properties on the chart.

    You can import the attached .ITF file or copy & paste this code:

    I commented *POINTSIZE, otherwise you won’t see the HIGH and LOW of the candlestick.

    Roberto

    #70329

    Thanks@roberto!! it works!!

    1 user thanked author for this post.
    #84785

    Hi roberto,

    just a quick question regarding this code.. this shows all past the history as,

    defparam CALCULATEONLASTBARS=360

    is it possible to have only the current candle high/low at that time and not show all past history but with a boolean or something – to click and to show up all the past history when we want??

    please let me know.. thanks in advance

    Roh

    #84797

    is often the solution, but not in this case if used alone, since if the last bar is NOT equal to MyTime, it would draw nothing!

    So we need to save the values of the prices (they are already saved) and bar, then draw those values at any subsequent bar:

    I added an offset not to display text too close to bars, but you can remove/change it at your convenience, of course.

     

    1 user thanked author for this post.
    #84799

    Thanks you very much for your help!! it works.. if you remove defparam DrawOnLastBarOnly  =True and use defparam CALCULATEONLASTBARS=360 will sow the history too..

    how can i add a “boolean” to both above so i can have the current time but when i want to see the history (defparam CALCULATEONLASTBARS=360) then i can click and get it in the chart!! i tried but didnt work.. please see the pic

    #84801

    Variables cannot be used with DEFPARAM, so you will have to modify the code anytime you want to change back to history.

    1 user thanked author for this post.
    #84825

    so you will have to modify the code anytime you want to change back to history.

    Or make a loop starting from current barindex ? A boolean variable should work in this case, as an option to select the code without the loop (no history plotted) or with the loop (all history plotted).

    2 users thanked author for this post.
    #84832

    Thank you both!!
    how do I make a loop? please will you be able to help out?
    Thanks

    #84838

    There you go:

    2 users thanked author for this post.
    #84881

    Thanks you very much.. it’s works!! Thanks again really appreciate your help

Viewing 11 posts - 1 through 11 (of 11 total)

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