Announcement

Collapse
No announcement yet.

Help with finding indicator intraday high/low

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

  • Help with finding indicator intraday high/low

    I am new to eSignal and have spent the better part of the past couple of days trying to come up with a solution for what I want to build. I have searched through this message board and have learned a lot, but can't seem to get the following problem figured out.

    I am trying to modify the AccDist study with similar behavior as the "RSI ColorLine Bar" study, except rather than having the bars colored below 30 and above 70, I would like the AccDist line to be colored when the study reaches either a new high for the day (green) or a new low for the day (red). Ultimately, I would love to then tie this into price action and build my own alert. But, first things first. I typically use either 3 or 5 minute bar charts during the day.

    Below is my code. When I actually deploy this, I am not getting the desired results at all. Any ideas or suggestions would be greatly appreciated (even debugging suggestions).

    Thanks in advance for any assistance that is given!

    PHP Code:
    // AccDistHighLow.efs
    var study = new AccDistStudy();
    var 
    bInit false;
    var 
    vHighAD null;
    var 
    vLowAD null;
    var 
    vAccDistValue null;

    function 
    preMain() {
    }

    function 
    main() {
        if (
    bInit == false) {
            
    vAccDistValue study.getValue(AccDistStudy.ACCDIST);
            
    vHighAD highest(inv("D"),study);
            
    vLowAD lowest(inv("D"),study);
            
    bInit == true;
         }
        
        if (
    vAccDistValue vHighAD.getValue(-1)) {
            
    setBarStyle(PS_SOLID);
            
    setBarThickness(2);
            
    setBarFgColor(Color.black);
            
    setBarBgColor(Color.lime);
        } else if (
    vAccDistValue vLowAD.getValue(-1)) {
            
    setBarStyle(PS_SOLID);
            
    setBarThickness(2);
            
    setBarFgColor(Color.black);
            
    setBarBgColor(Color.red);
        }
        
        return (
    vAccDistValue);


  • #2
    El Pato
    There are several errors in the script.

    1) The value of the Accumulation/Distribution study is assigned to the vAccDistValue variable inside the bInit routine. This will happen only once ie when the efs is first run which means that vAccDistValue will be a constant value throughout the chart [which I don't think is what you want]. Note that this issue is not evident at this time only because of another error within the bInit routine (see point 4). Once that error is corrected this problem will become apparent.
    You need to assign a value to the vAccDistValue variable outside of the bInit routine.

    2) The first parameter used in the functions highest() and lowest() is not valid. This should be a constant which represents the number of bars to look back and not the interval on which the function will be based on. The interval should be defined in the series object that is used as the source for highest() and lowest().
    For the syntax required by these functions see the corresponding links.

    3) The parameter study is not a valid source for the highest() and lowest() functions as it is not a series object. You need to use the EFS2 version of the Accumulation/Distribution study [and not the EFS1 version] to be able to pass that source to the highest() and lowest() functions.
    For the syntax of the Accumulation/Distribution study see this link.

    4) bInit == true; should be bInit = true; ie with only one equal sign. As it is currently written that line does not set the bInit variable to true. This is the other error I mentioned earlier in point 1.

    Regardless of the errors listed above, highest() and lowest() of the Accumulation/Diistribution study based on the daily interval are not going to return the Highest and Lowest values recorded by that study during the day.
    What you instead need to do is to track the highest and lowest values registered by the Accumulation/Distribution study on the chart starting from the first bar of the day and then resetting those values on the first bar of each new day.
    Before you re-write the study I would suggest that you read through the Tutorials and Help Guides that are provided in the EFS KnbowledgeBase. You may also want to review the JavaScript Video Series that will introduce you to the JavaScript language, which is the basis for EFS.
    Alex

    Comment


    • #3
      Alexis,

      Thank you very much for your feedback. I will review the links you mentioned in your post and try to get my hands around EFS.

      For what it's worth, I am very familiar with programming (as it is my day job). So, I am used to just plowing through a javadoc and finding out what I need. I spent some time on the EFS knowledge base and could never really find what I was looking for. What is the best "EFS for Programmers" document/tutorial that is available?

      Thanks again for your response and your assistance!

      Comment


      • #4
        El Pato
        If you are already very familiar with programming in JavaScript then all you may need to read through is the EFS2 Function Reference section of the EFS KnowledgeBase which will provide you with the complete list of EFS extensions and their syntax
        You may also want to review the Tutorials for any information that is specific to EFS such as for example how an efs executes, etc
        Alex

        Comment

        Working...
        X