Announcement

Collapse
No announcement yet.

formula assistance

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

  • formula assistance

    I have tried to code the attachment but to no avail. The formula wizard says the code is not in the formula wizard library. My research on the forum shows no code with variables to powers. I would also like to put bollinger bands around the code but have found no forum which tells generically how to put the bands around an indicator. I have very little code ability so I have tried to copy what others have done but get syntax errors. I would appreciate any help.
    Attached Files

  • #2
    linsar
    There are several syntax errors in the script.
    1) The first line (ie /*******) comments out the whole script and needs to be removed.
    2) You are missing a parameter in getValue("Volume", -2) which should be getValue("Volume", 0, -2) for that variable to be an array
    3) You need to check the parenthesis in the equation used to calculate Power.
    4) Also in the same equation Volume should be Volume[0] as that variable is an array.
    Note that this formula cannot be read with the Formula Wizard which can only read scripts that were written with that tool.
    With regards to the Math functions see this article in the EFS KnowledgeBase. FYI I found the article by searching the KB for power
    As to adding Bollinger Bands you have two options. For the first one click here and download BBof_template.efs which will calculate the Bollinger Bands of any user defined variable. Open the efs with the Editor and insert where indicated the calculations for your variable. If you need to plot the efs as a non price study replace setPriceStudy(true) with setPriceStudy(false) in preMain()
    The second solution is to call your script from another efs using the efsExternal() function which will create the data series that you can then use as a source for the efs2 Bollinger functions (see example included below). See the respective links for the syntax required by these functions.
    PHP Code:
    function main(){
        var 
    Power efsExternal("/path to efs/powertest.efs");
        var 
    BBupr upperBB(20,2,Power);
        
    //etc for BBlwr
        
    return BBupr

    For a detailed explanation of the efsExternal() function together with several examples on how to use it see this thread. You can also find more examples in this thread.
    Having said all this if you are unfamiliar with programming in efs and would like to write your own scripts I would suggest that as a first step you review the JavaScript for EFS video series. That will provide you with a thorough introduction to programming in JavaScript which is at the foundation of EFS. Then go through the EFS KnowledgeBase and study the Help Guides and Tutorials which will provide you with the specifics of EFS.
    If instead you are not interested in learning to program in efs and just need someone to develop the script for you then please review the FAQ: How can I get my custom study built
    Alex

    Comment


    • #3
      assistance

      Alexis

      Thank you for the great info. This is more than I expected. I did not know about the Java Script video but I will review.

      Linsar

      Comment

      Working...
      X