Announcement

Collapse
No announcement yet.

Representing OHLC Bars in indicators

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Representing OHLC Bars in indicators

    How do you contsruct an OHLC bar in an indicator as I designing an indicator that adjusts each price bar and still require the indicator to look like a price chart.

    Any assistance will be appreciated.

    Robert

  • #2
    Robert

    This is an intriguing question, and the solution I envision is not all that easy to code, but let's see if I can lay out a solution...

    You will need to keep track of the O, H, L and C, obviously, Then you can use drawLineRelative (or maybe Absolute, I always get them confused), to draw a line from the H to the L. Then superimpose on this line the O and C using drawShape.

    Doesn't sound too tough after all, but I bet a lot of coding is required. If you get it started to the point where the O H L and C are identified, I can help with the draw functions.

    Comment


    • #3
      I have built a rudimentary efs file to display OHLC in an indicator. I would be grateful for any assistance to draw these as OHLC bars as I am unable to use the draw functions in any meaningful way.


      Robert
      Attached Files

      Comment


      • #4
        Hello Robert,

        There is an example formula in our EFS Library, drawOHLC.efs, which will show you how to do this.
        Jason K.
        Project Manager
        eSignal - an Interactive Data company

        EFS KnowledgeBase
        JavaScript for EFS Video Series
        EFS Beginner Tutorial Series
        EFS Glossary
        Custom EFS Development Policy

        New User Orientation

        Comment


        • #5
          Thanks for the info. Unfortunately there are 2 problems, the routine does not work in an indicator window only in the price pane and also does not work for historical data. Is there any way to modify the code to allow these 2 requirements?


          Robert

          Comment


          • #6
            Robert

            Did you try inserting

            setPriceStudy(false);

            in preMain?

            Also, perhaps if the 'length' of the study is increased to above 60 you would get more historical info.

            Comment


            • #7
              I took out the setPriceStudy parameter so that the study would work in an indicator window. however it did not draw anything and will only do so in the price window. Setting the length will only work for data to come from the current bar and will not work on any histroical data back from the current bar which is what I want to do because I need to acquire the data for average calculations and display after modifying the actual OHLC price bars.


              Robert

              Comment


              • #8
                I made a few changes and got it to work!
                You will need to fine tune it, but at least it draws in it's own pane and has historical data.
                Attached Files

                Comment


                • #9
                  ps

                  Here is what I see on my end, your mileage will vary, depending on the symbol used - change the max mins to suit your purposes.
                  Attached Files

                  Comment


                  • #10
                    I have the indicator up and running now. However there are 2 issues:-

                    1. Automatic rescaling to take account of the data being presented without having to fix the window range. Probably can only be fixed if someting is returned as we are only drawing lines at the moment.

                    2. More importantly the opena nd close on my display as i can see on your output are eqyual with no range in between unless it is drawn for the current bar and future bars but not historically. I have used 1000 bars as my setting so am getting a full data output.

                    Any thoughts/help will be much appreciated.

                    Robert

                    Comment

                    Working...
                    X