Cycle analysis much easier by barcounting

Viewing 13 posts - 16 through 28 (of 28 total)
  • Author
    Posts
  • #87090 quote
    Vonasi
    Moderator
    Master

    Maybe this is a starting point?

    [attachment file=”Bar Counter.itf”]

     

    //Bar Counter
    //By Vonasi
    //20181214
    
    //StartDate = 20181214
    //StartTime = 080000
    
    y = (high - low) * 0.20
    
    if date = startdate and time = starttime then
    timeok = 1
    drawarrowup(barindex, low - (y * 2)) coloured(0,0,255)
    endif
    
    if timeok then
    number = number + 1
    drawtext("#number#",barindex, low - y) coloured(0,0,255)
    endif
    
    return

    [attachment file=87091]

    Screenshot_2-4.png Screenshot_2-4.png Bar-Counter.itf
    #87107 quote
    Friend
    Participant
    Average

    Thank you, Vonasi!
    That already looks good.
    It is a pity that the start time is 1 bar too early, can you still adjust that?
    If you enter 11.00, the arrow and the ‘1’ will come under the 10.00 bar for example (in the 1 hour timeframe).
    And can the time display also be in 4 positions? I do not use seconds.

    #87115 quote
    Vonasi
    Moderator
    Master

    Sorry – I forgot I was coding an indicator and not a strategy. Just change TIME to OPENTIME and DATE to OPENDATE and that should do it.

    Yes the time can be in four digits – I’ll be back in a minute with that.

    #87116 quote
    Vonasi
    Moderator
    Master
    //Bar Counter
    //By Vonasi
    //20181214
    
    //StartDate = 20181214
    //StartTime = 0800
    
    y = (high - low) * 0.20
    
    if opendate = startdate and opentime = (starttime * 100) then
    timeok = 1
    drawarrowup(barindex, low - (y * 2)) coloured(0,0,255)
    endif
    
    if timeok then
    number = number + 1
    drawtext("#number#",barindex, low - y) coloured(0,0,255)
    endif
    
    return
    

    ..and ITF file to import:

    [attachment file=”Bar Counter.itf”]

    Bar-Counter-1.itf
    #87121 quote
    Friend
    Participant
    Average

    It works great now, Vonasi.
    Thanks for your support during the day
    Have a nice weekend!

    #87346 quote
    Friend
    Participant
    Average

    Good morning Vonasi,
    There is still something not going well.
    Intraday everything works fine, but in the day, week and month charts are some difficulties.
    Entering date and time does not work correctly and the numbers under the bars are not correct shown.
    As an example in the attachment a monthly chart that starts in February.
    Only if I enter the date 20180228 and the time 0 this result appears (I adjusted the color).
    The position, of the numbers (the distance to the bar) seems to be moved 1 bar.
    Can you take a look at it?

    Month.png Month.png
    #87352 quote
    Vonasi
    Moderator
    Master

    It doesn’t do it on my platform and I tested on several different markets. It might be something to do with how you have time set up on your chart. I would just create a different indicator for monthly and weekly as you don’t need time on a monthly or weekly chart.

    //Bar Counter - Monthly/Weekly
    //By Vonasi
    //20181214
    
    //StartDate = 20181214
    
    y = (high - low) * 0.20
    
    if opendate = startdate then
    timeok = 1
    drawarrowup(barindex, low - (y * 2)) coloured(0,0,255)
    endif
    
    if timeok then
    number = number + 1
    drawtext("#number#",barindex, low - y) coloured(0,0,255)
    endif
    
    return
    #87359 quote
    Friend
    Participant
    Average

    You are right. After I turned off the DailyData at Platform options, Time zones it works well. Thank you, also for the adjustment of the indicator.

    #179004 quote
    Friend
    Participant
    Average

    Dear Vonasi or colleagues,

    This indicator still works well.
    One question:
    Can it be changed that there is no number below the arrow and that the 1 and following numbers appear below the following bars?

    In other words, counting starts at the next bar.

    Thanks!

    #179008 quote
    robertogozzi
    Moderator
    Master

    There yoo go:

    //Bar Counter, By Vonasi, 20181214
    once timeok = 0
    once number = 0
    //StartDate = 20181214
    //StartTime = 080000
    y = average[100,0](range)   //(high - low) * 0.20
    if (((date >= startdate) and (time >= starttime))  or (date > startdate)) and timeok = 0 then
       timeok = 1
       drawarrowup(barindex, low - (y * 2)) coloured(0,0,255)
    endif
    if timeok then
       //number = number + 1
       IF number > 0 then
          drawtext("#number#",barindex, low - ((y * 1) * ((BarIndex MOD 3) + 1))) coloured(0,0,255)
       endif
       number = number + 1
    endif
    return
    x.jpg x.jpg Bar-Counter.itf
    #179141 quote
    Friend
    Participant
    Average

    Thanks a lot, Roberto!

    It works perfect.

    #179518 quote
    JOKAMAURICE
    Participant
    Junior

    not working for me. It just opens a blank indicator windows

    Capture-décran-2021-10-12-à-23.06.19.png Capture-décran-2021-10-12-à-23.06.19.png
    #179521 quote
    robertogozzi
    Moderator
    Master

    You have to add it ON your chart, not BELOW it.

    Use the PRICE properties, then add indicator.

Viewing 13 posts - 16 through 28 (of 28 total)
  • You must be logged in to reply to this topic.

Cycle analysis much easier by barcounting


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Friend @friend Participant
Summary

This topic contains 27 replies,
has 3 voices, and was last updated by robertogozzi
4 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/23/2018
Status: Active
Attachments: 11 files
Logo Logo
Loading...