Announcement

Collapse
No announcement yet.

geting a value

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

  • geting a value

    I am trying to get a value for a moving average of volume and use that as a constant else where in my efs.

    Is this possible, the attached efs shows no error but does not work.

    Thanks in advance for your help


    James
    Attached Files

  • #2
    James
    The syntax checker will identify syntax errors but not logical errors such as those contained in your script.
    Enclosed below is a basic version of what you would need to do. To this add the preMain statements and/or FunctionParameters that you may require
    Alex

    PHP Code:
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("Curo");
        
    setColorPriceBars(true);
        
    setDefaultPriceBarColor(Color.black); 
    }
     
    var 
    AvgVol null;//declare global variable
     
    function main() {
     
        if(
    AvgVol==nullAvgVol ema(200volume());//initialize variable
        
        
    if(AvgVol.getValue(0)==null) return;//null check on value
     
        
    if (volume(0) > (AvgVol.getValue(0) * 1.5)){
            
    onAction1();
        }
    }
     
    function 
    onAction1() {
        
    setPriceBarColor(Color.red);

    Comment


    • #3
      Thank you

      James

      Comment


      • #4
        James
        You are most welcome
        Alex

        Comment

        Working...
        X