Announcement

Collapse
No announcement yet.

Tick Change Charting

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

  • #16
    Here's the update... basically I added some code to the reset area to store the previous price change for comparison. Right before the data is returned to the chart, there's a check to see if the current number of price changes are less than the previous number, and if so turn the histogram red. Once it is higher then the previous it should revert back to blue.

    PHP Code:
    /********************************************************************
    Copyright © eSignal, 2003
    Title:        Price Change Count
    Version:    1.1

    =====================================================================
    Fix History:
    1.1 - Added red color if current price change is less then previous

    =====================================================================
    Project Description:  This displays a histogram of the number of price
    changes for each bar


    **********************************************************************/


    function preMain () {

        
    setPriceStudy(false);
        
    setStudyTitle("Price Change Count");
        
    setCursorLabelName("Price Changes"0);
        
    setDefaultBarStyle(PS_SOLID0);
        
    setDefaultBarFgColor(Color.blue0);
        
    setDefaultBarThickness(10);
        
    setPlotType(PLOTTYPE_HISTOGRAM0);

    }

    var 
    vPriceChanges 0;
    var 
    vPrevPC 0;
    var 
    vPreviousPrice 0.00;

    function 
    main() {

        if (
    getCurrentBarIndex() != 0) return;
        var 
    vBarState getBarState();
        var 
    vCurrentPrice close();
        if (
    vCurrentPrice == null) return;
        
        if (
    vBarState == BARSTATE_NEWBAR) {
            
    vPrevPC vPriceChanges// Store Previous Bar's Price Changes
            
    vPriceChanges 0// reset # of Price Changes
        
    }
        
        if (
    vCurrentPrice != vPreviousPricevPriceChanges++; // increment if there's a price change
        
    vPreviousPrice vCurrentPrice;
        
        
    // Color Change code
        
    if (vPriceChanges vPrevPC)
            
    setBarFgColor(Color.red0);
            
        return 
    vPriceChanges;

    Attached Files
    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11

    Comment


    • #17
      Jay,

      First of all thanks for all of the help so far - I had a question

      I used the program you gave me to change the histogram bars and then I changed it to color the price bars- it works fine but since it re-sets every time I close or change the chart the bars all revert back to the default color. Is there any way to save the color of the price bars? I still want the program to re-set each time because I need the data from bar to bar. Another mind bending problem (at least for a neophyte programer like me!)

      p.s. how long did it take to learn the Java as well as you do??

      p.s.s. ever heard of Genetic Algorithims??

      Thanks!
      Glen

      Comment


      • #18
        Since that EFS can only monitor price changes in real-time, it will reset each time the chart is reloaded. I don't believe there is any way around this, but if someone else knows of a way feel free to chime in.

        Regards,
        Jay F.
        eSignal Community Support

        PS. I am moving this thread over to the EFS Studies forum to hopefully get some more "EFS eyes" on it.
        Regards,
        Jay F.
        Product Manager
        _____________________________________
        Have a suggestion to improve our products?
        Click Support --> Request a Feature in eSignal 11

        Comment


        • #19
          Jay,

          I'm not sure I get the whole gist of the converestion, but if the question is "is there a way to keep data alive through resets of the chart?" (reloads of formula, changing symbols, changing paramters, etc) the answer is yes. Use universal globals (ie: getGlobal and setGlobal). You can even save arrays this way.

          If this isn't what is being asked...maybe someone can restate the request so that slower people like me can understand?

          Garth
          Garth

          Comment


          • #20
            You are correct Garth. I think I'm the slower one here () as I have never used or really understood the universal globals process.

            - For Garth, Jason, or anyone with the knowledge on globals...

            1) How would one store price change data (example earlier in thread) in a global array for reloading at a later point?

            2) How would one load up the stored data and sync' it to the correct time?

            3) Are global values kept after eSignal is shut down, or are they saved in memory?

            Thanks for your help!
            Regards,
            Jay F.
            Product Manager
            _____________________________________
            Have a suggestion to improve our products?
            Click Support --> Request a Feature in eSignal 11

            Comment


            • #21
              Hi,


              Answers are not in the same order as asked (I start with the easy ones and work my way down ;-).

              3) Are global values kept after eSignal is shut down, or are they saved in memory?
              They are saved in memory, so they will not survive a shut down of eSignal itself, but will be presevered through resets of the chart and formula (unless your formula over writes them, or deletes them).

              1) How would one store price change data (example earlier in thread) in a global array for reloading at a later point?
              You can store them in an regular local global array and then save that array off as a universal global using setGlobalValue("MyUniqueName", <local global variable name>);


              2) How would one load up the stored data and sync' it to the correct time?
              This is a tough one. The easiest way to do this is to verify that that the interval hasn't changed (save off the interval as a universal global) and also save off the starting time for the bars you are saving. When a reload happens (ALLBARS is true) you can verify if the universal global for interval is set (and make sure that this interval and that interval matches) then sort through the bars until the start time is reached (you can use rawtime matches I would think). Once you should have a one for one match. Is this the cleanest way...no...but it is the easiest.

              Garth
              Garth

              Comment


              • #22
                Thanks a ton Garth.

                To Glen, I will be quite busy over the next few days with other work, but I'll try to get started on this by the end of the week.
                Regards,
                Jay F.
                Product Manager
                _____________________________________
                Have a suggestion to improve our products?
                Click Support --> Request a Feature in eSignal 11

                Comment


                • #23
                  No luck so far on this. Globals are much more complex then I originally thought. I'm afraid I won't have the time to convert this to keep historical data anytime soon.

                  Regretfully,
                  Jay
                  Regards,
                  Jay F.
                  Product Manager
                  _____________________________________
                  Have a suggestion to improve our products?
                  Click Support --> Request a Feature in eSignal 11

                  Comment


                  • #24
                    Quesion

                    How would I limit the attached formula to display only the swing high and swing low indicatiors when they are 10 or less points away? Right now it displays all indicators. Thanks!
                    Attached Files

                    Comment


                    • #25
                      Quesion

                      How would I limit the attached formula to display only the swing high and swing low indicatiors when they are 10 or less points away? Right now it displays all indicators. Thanks!
                      Attached Files

                      Comment


                      • #26
                        Also a little more info and an example -


                        it is the DNFRAC and UPFRAC I am interested in

                        for example DNFRAC is 9800 and UPFRAC is 9810 (trading the DOWmini)

                        This would display the indicator lines -

                        however DNFRAC is 9800 and UPFRAC is 9811

                        This would display nothing.

                        I would also like a pop up window and/or sound to indicate

                        Thanks!

                        Comment

                        Working...
                        X