BarIndex not an integer for Day[N]

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #41844 quote
    AVTAVT
    Participant
    Senior

    BarIndex should return an integer, I mean I could not imagine what else.

    Day[N] needs an integer for N. But if I use the value of BarIndex for D, I get a complaint that an integer value is needed.  Code:

    defparam DrawOnLastbarOnly=true
    
    i=BarIndex[1]
    AFictiveBarIndexValue=700 // <= this works
    //AFictiveBarIndexValue=i // <= this is not an integer
    dofi=Day[AFictiveBarIndexValue]
     
    id=IntradayBarIndex
    dofid=Day[id]
    
    Drawtext("BarIndex: #i#",barindex-20,0) // m1 changes around 729
    Drawtext("Day of BarIndexValue: #dofi#",barindex-20,0.2)
    Drawtext("IntradayBarIndex: #id#",barindex-20,0.4)
    Drawtext("Day of IntradayBarIndex: #dofid#",barindex-20,0.6)
    
    Return

    Any ideas what that is?

    Thanks a lot.

    #41865 quote
    NicolasNicolas
    Keymaster
    Legend

    You need at least 1 bar elapsed to get an integer value with barindex[1]

    AVT thanked this post
    #41924 quote
    AVTAVT
    Participant
    Senior

    Thanks for your answer Nicolas. I really don’t understand it, but I think at the moment you are too busy with other stuff to get this cleared. For the task behind that (get something which is special for today and compare that to previous days within an If-IntradayBarindex) I found a solution – hopefully, tests next week will show. So maybe somewhen later I might come back with that matter, if it’s ok for you.

    Thanks for all your great work and have a nice weekend.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

BarIndex not an integer for Day[N]


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
AVT @avt Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by AVTAVT
9 years, 2 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/27/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...