Announcement

Collapse
No announcement yet.

volume bars

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

  • volume bars

    Hello,
    looking for someone to write a formula to have the volume bars
    corresponding with candlesticks with equal open and close to
    in different
    color then up or down volume bars.

  • #2
    cassy
    The enclosed efs will do what you requested
    Alex

    PHP Code:
    function preMain() {

        
    setPriceStudy(false);
        
    setStudyTitle("Volume");
        
    setCursorLabelName("Volume"0);
        
    setDefaultBarFgColor(Color.blue0);
        
    setDefaultBarThickness(1,0);
        
    setPlotType(PLOTTYPE_HISTOGRAM,0);
        
        var 
    fp1 = new FunctionParameter("Source"FunctionParameter.STRING);
        
    fp1.addOption("Price");        
        
    fp1.addOption("Volume");
        
    fp1.setDefault("Price");
    }

    function 
    main(Source) {
       
        if(
    Source=="Price"){
            if (
    close(0) < open(0))
                
    setBarFgColor(Color.red,0);
            else if (
    close(0) > open(0))
                
    setBarFgColor(Color.blue,0);
            else if (
    close(0) == open(0))
                
    setBarFgColor(Color.cyan,0);   
        }
        if(
    Source=="Volume"){
            if (
    volume(0) < volume(-1))
                
    setBarFgColor(Color.red,0);
            else if (
    volume(0) > volume(-1))
                
    setBarFgColor(Color.blue,0);
            else if (
    volume(0) == volume(-1))
                
    setBarFgColor(Color.cyan,0);
        }    
            
        return 
    volume();

    Comment


    • #3
      volume bars

      Thank you so much for the formula, unfortunately I am not capable to bring this to life ? Do you know about someone that
      could help me out
      Thank you

      Comment


      • #4
        cassy
        Attached is the same script saved as an efs file.
        Click on the link and save the file to any one of the subfolders of Formulas. Once you have downloaded it right click the chart, select Formulas, navigate to the subfolder in which you saved the efs and click it.
        Alex
        Attached Files

        Comment


        • #5
          volume bars

          Hello,

          Thanks a bunch for the formula, I managed to make it work.
          One more think, how do I change the colors, so my up bars are
          green, down red, and equals black?
          Thanks

          Comment


          • #6
            cassy
            The attached revision of the efs adds color selectors for each condition. Once you have loaded the study in the chart right click the indicator pane, select Edit Studies and then select the desired color
            Alex
            Attached Files

            Comment


            • #7
              volume bars

              Hi Alex,

              Just wanted to drop you THANK YOU note. I still can not believe
              the help and service that I have received from you.
              All your help has been very much apreciated, although my issue
              with the volume bars might not seem like very important one,
              it is very crucial for my trading style.
              THANK YOU so much and keep up a good work.

              Best Regards,
              Cassy

              Comment


              • #8
                Cassy
                The pleasure is mine
                Alex

                Comment

                Working...
                X