Announcement

Collapse
No announcement yet.

Want to compare other bars to first bar of day

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

  • Want to compare other bars to first bar of day

    I have a script that works well, but looking to try to compare it to the first bar as well. I can compare it to the bar prior to it (has to be 50% or less) but finding it hard to compare it to the first bar I want (the 9:30 bar).

    I am going to write 2 scripts. One to compare it to the bar prior to it (which is already done) and if does then do an action, second efs is compare the same bar but compare it to the 9:30 bar (has also to be <50% to get an action or can this be done in one script)??. The bar to be compared to is the (0) bar.

    Also, how do I add a requirement that the bar(0) has to be green (UP) in this script. So far I have close(0)>open(0) to do this.


    Thank you
    Attached Files

  • #2
    PATRADER

    ...second efs is compare the same bar but compare it to the 9:30 bar (has also to be <50% to get an action or can this be done in one script)??
    It can be done in one script however you will need to use the EFS Editor to add the necessary logic. This is because you need to create some custom variables which cannot be done with the Formula Wizard.
    Enclosed is a code sample that shows you how to retrieve the Open, High, etc of the first bar of the day which you can then use in your logic.

    PHP Code:
    var BarTime  rawtime(0);
    var 
    BarIndex = (getFirstBarIndexOfDay(BarTime)-getCurrentBarIndex());
        
    var 
    FirstOpen open(BarIndex);
    var 
    FirstHigh high(BarIndex);
    //etc

    //for your logic you can use either open(BarIndex) or FirstOpen etc 
    If you are unfamiliar with programming in EFS you may want to go through the various guides and tutorials which can be found in the Help Guides folder of the EFS KnowledgeBase. To learn more about JavaScript which is the basis of EFS you may also want to view the Core JavaScript Video Series
    Alex

    Comment

    Working...
    X