Announcement

Collapse
No announcement yet.

help

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

  • help

    Hi all,

    Can anyone tell me why the FlatLines in this efs is not coloring red?

    Thanks
    Angelo
    Attached Files
    ang.

  • #2
    Angelo
    Not sure if these are the flatlines you are referring to but they are colored in red at my end (note that I had to comment out the call to the SchirdingStoch.efs to get the formula to work)
    Alex

    Comment


    • #3
      Angelo
      Since you are painting the price bars you should add the following statements in preMain
      PHP Code:
      setColorPriceBars(true);
      setDefaultPriceBarColor(Color.black);//or any other color of your choice 
      The latter statement ensures that if neither condition is met then the bars get painted in the color of your chosing (else they get painted in white)
      Alex

      Comment


      • #4
        Hi Alex,

        Once again, thanks for the bail out! I got the formula to work commenting out the call also. But I have a question. I have a use for the SchridingStoch.efs in my script.

        Apparently, calling the SchirdingStoch.efs is causing the incorrect coloring of the flatline bars. Since I need this call in my program, I'm wondering if there is a work around.

        Also , does this mean by calling an efsExternal , it overides the fuctionality of preMain??

        Again , thanking you and other moderators for the quick responses and help you provide us here in our learning process.


        Angelo
        ang.

        Comment


        • #5
          Angelo
          Because you are passing a color and thickness parameter to the SchirdingStoch.efs as part of the efsExternal() call and these are used in the main function of that efs (in lines 79-82) to set the default properties of the plot(s) those same parameters are then applied to the plot returned by the calling (ie strategy1_blaus) efs.
          There are various solutions available to you. The easiest one is to change the parameters in the efsExternal() call to the SchirdingStoch.efs. To do this replace the following line
          PHP Code:
          SchirdStoch efsExternal("SchirdingStoch.efs",14,3,3,2,2,Color.blue,Color.red); 
          with
          PHP Code:
          SchirdStoch efsExternal("SchirdingStoch.efs",14,3,3,1,2,Color.red,Color.red); 
          Notice that in this example I have changed both the parameter for the thickness and color.
          The other solution is to set the defaults for the color and thickness in the calling efs by replacing the following section of code (lines 73-78)
          PHP Code:
          if(bInit == false){
               
          DS_Stoch = (amLib.amDSStoch(q,r,s));
               
          DS_Sig = eval(Type)(u,DS_Stoch);
               
          setShowTitleParameters(eval(Params));
              
          bInit true;
              } 
          with the following
          PHP Code:
          if(bInit == false){
               
          DS_Stoch = (amLib.amDSStoch(q,r,s));
               
          DS_Sig = eval(Type)(u,DS_Stoch);
               
          setShowTitleParameters(eval(Params));
               
          setDefaultBarFgColor(Color.red,0);
               
          setDefaultBarThickness(1,0);
              
          bInit true;
              } 
          In this case I override the defaults set by the SchirdingStoch.efs by defining new ones in the calling efs.
          Either solution should work and will not affect how the SchirdingStoch.efs will behave when used on its own.
          Alex

          Comment


          • #6
            Alex,

            Thanking you for the concise explanation and work-around for the ext. call function . The program works fine now.

            Your help is surely appreciated. A vast knowledge is always gained on your corrective suggestions to the whats and whys of
            script writing. We would be lost without you!

            Angelo
            ang.

            Comment


            • #7
              Angelo
              You are most welcome and thank you very much for your kind words. They are sincerely appreciated
              Alex

              Comment


              • #8
                Angelo
                Another change you may want to implement in your script to make it more efficient is to intialize the efsExternal() call inside the bInit routine. To do this first declare a new global variable (ie outside of main and preMain) called SchirdStoch and assign to it a value of null eg
                PHP Code:
                var SchirdStoch null;
                 
                function 
                main(...){ 
                Then move the call to the SchirdingStoch.efs from its current location (line 67) to inside the bInit routine eg
                PHP Code:
                if(bInit == false){
                    
                SchirdStoch efsExternal("/newdownloads/SchirdingStoch.efs",14,3,3,2,2,Color.blue,Color.red);
                    
                DS_Stoch = (amLib.amDSStoch(q,r,s));
                    
                DS_Sig = eval(Type)(u,DS_Stoch);
                    
                setDefaultBarFgColor(Color.red,0);
                    
                setDefaultBarThickness(1,0);
                    
                setShowTitleParameters(eval(Params));
                    
                bInit true;

                Then to retrieve the values of SchirdStoch series use the .getValue() method ie SchirdStoch.getValue(0) for the value at the current bar, SchirdStoch.getValue(-1) for the value at the prior bar, etc
                Alex

                Comment

                Working...
                X