DRAWSEGMENT assistance

Forums ProRealTime English forum ProBuilder support DRAWSEGMENT assistance

Viewing 13 posts - 16 through 28 (of 28 total)
  • #40181

    Thank you Nicolas. Your assistance is much appreciated.

    #40190

    Code looks good thank you. Now the last challenge is how to get it to draw segment lines only on the most current HiPoint and HiPoint[1] and LoPoint and LoPoint[1] and ignore all the rest of the historical Hipoints and Lopoints.

    I tried introducing at the begining of the code:

    DEFPARAM DRAWONLASTBARONLY = true

    DEFPARAM CALCULATEONLASTBARS = 200

    But this seems to work on only one of the points either Lopoint or Hipoint pending which one happens to be the most current on chart but did not draw both.

    Any ideas?

     

    #40194

    That’s normal because we can’t never know in advance how much bars is necessary to loop in the past to find the last 2 needed points to draw a new trend line ..

    So I add the “lookback” variable as an external one that can change to find the suitable one for each instrument/timeframe. Example attached on DAX 5 minutes, a lookback of 500 bars was needed in order to find the first high point above the current one!

     

    #168996

    Hi Nicolas,

    For example suppose I have an indicator that is returning a number on the current bar of the chart (let’s say that number for argument sake is +100 which is obviously >0).

    The number +100 is continually changing increasing and decreasing depending on indicator calculation.

    Now if the current number is +100 and the next (new) number is +99 then the number (although is still >0) has decreased by -1.

    Is it possible to show +99 in red because it has decreased and as long as it is decreasing keep showing in red and when it increases again, show it in green.

    I guess you need to be able to calculate difference between a number and itself in the same bar and show green if >0 and red if <0. Unless you have another trick to do it.

    Regards,

    Walid

    #169005

    I’m not sure your question is related to this topic, but anyway..

    In order to compare a value between now and its previous state, during the same bar, you have to use a variable in array, which is not reset on each tick received in a bar:

     

    1 user thanked author for this post.
    #169042

    Thank you Nicolas. That’s great, it worked.

    Now the challenge is how do I compute the change between a and $var[barindex] (i.e. the change between the stored “a” value and the new “a” value in the same bar.

    For example to do it between the current bar and the previous bar, I would use change=(a-a[1])/a[1])*100 to get the %change.

    How do I do same but in the current bar.

    #169045

    $var[barindex] is the last value you have stored, so basically your formula is:

    ((a-$var[barindex])/$var[barindex])*100

     

    #169074

    Thank you Nicolas. Much appreciated mate.

    1 – in your email reply (plz see snapshot atatched), the expression ((a-$var[barindex])/$var[barindex])*100 seems to be included in the code and appears ABOVE the expression defparam drawonlastbaronly=true. Is this correct? In the web portal reply section above, the expression ((a-$var[barindex])/$var[barindex])*100 seems to be not included in the code. Is the expression required? and if so, where? above defparam or below it or expression not required at all?

    2 – In both your email code and code in this portal above, you have Return VWAP. Is this a typo or VWAP is required after Return?

    #169130

    The above code, contained in the code window is the one you need. There is no typo.

    #169216

    Thank you Nicolas.

    By the way, how do I DRAWTEXT to the RIGHT of the current bar? Say I have 3 results which I want to drawtext the values to the right of the bar (1 result below the other) starting from (to the right of High) and listing them down in a row

     

    #169294

    You can adjust the X coordinates in the future with BARINDEX+3 for example (3 is the bars quantity in the future)

    Same goes for Y axis in price, for example:

     

    #169407

    Tnx mate.

    If my indicator as a result of division of 2 numbers return a decimal number say 9.123 (3 decimals), is there a way I can make it return 6 decimals?

    #169636

    Hi Nicolas,

    The below code resets the VWAP at the start of every trading day (say at 00:00 midnight).

    d = max(1, intradaybarindex)
    VWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume)

    How do I make it reset every 2 trading days?

Viewing 13 posts - 16 through 28 (of 28 total)

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