Announcement

Collapse
No announcement yet.

setting an alarm for a tick counter

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

  • setting an alarm for a tick counter

    Hello, I know how to program an alarm for a specific formula but am not sure how to use the 'if' expression syntax. Basically I would like to modify an existing efs study which is very simple and counts the number of ticks in a bar, to incorporate an alarm when a certain number of ticks are reached. Would be grateful for any help on the method, or by all means if there is an example study then would be grateful to know where to look. Thanks.

  • #2
    Basically, you need to setup a "condition" when a new bar forms on the chart that will be hit when your "if" condition is reached.

    For example...

    Let's assume you are using the "tick countdown" code that is available on these forums. In this case, it counts DOWN to 0 as the bar continues to tick. So you could use two simple IF statements to test for the alert condition and the RESET condition - like this..

    var TC = current tick count (whater down to 0)
    var aTC = Alert tick count (10)
    var TCAlertEnabled = false; // logical variable to control the alert

    if (TC > aTC) {
    // This resets your alert to set it to go off.
    TCAlertEnabled = true;
    }

    if ((TC < aTC) && (TCAlertEnabled)) {
    // This fires your alert
    Alert.playSound("ding.wav");
    TCAlertEnabled = false;
    }

    If you need more help, just ask.
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      thanks for reply Brad. Really helpful.

      Well I do have another question! -is it possible within efs to describe not just open close low high criteria for a candle pattern but also be more refined about the context - ie - describe a candle in terms of how far you want the high to be from the open, or the maximum price range that is 'allowed' etc. I want to program some indicators on the chart which have very specfifc criteria for being triggered. I undestand the basics (OHLC) but wanted to describe things in more detail and I'm not sure what is available within efs language.

      Many thanks for any help.

      Comment


      • #4
        Of course you can do this. What you need to do is establish some BASE values you want to work with to accomplish your needs. I would suggest working in PERCENTAGE for this (unless your needs change). It's pretty easy to calculate percentage values and all you need to do is create some functions to handle your needs..

        The other thing you might need are some defined points for the bars you are analyzing...

        PHP Code:
          var B0MP = (high()+low())/2//  Midpoint of Current Bar
          
        var B1MP = (high()+low())/2//  Midpoint of Last Bar
          
        var B2MP = (high()+low())/2//  Midpoint of Previous Bar
          
        var B3HH Math.max(high(-1),high(-2),high(-3));
          var 
        B3LL Math.min(low(-1),low(-2),low(-3)); 
        PHP Code:

        function fCreatePercentage (V1V2) {
          
        //  V1 = the first value
          //  V2 = the second value

         
        return ( v1/v2 );

        Now, these are just sample functions/code. You can develop anything you need to accomplish your definitions. But doing it like this gives you the ability to START developing your project.. like..

        Let's say I wanted to find an engulfing bullish pattern that was in a tightening market..

        PHP Code:
          if (  (open(-1) > close(-1)) &&
                (
        open(-2) < close(-2)) &&
                (
        fCreatePercentage ((Math.abs(close(-1)-open(-1)), (B3HH-B3LL)) < 70
          ) {
        //  Then possibly a tight EB+ pattern.

          

        Last edited by Doji3333; 03-03-2009, 08:17 AM.
        Brad Matheny
        eSignal Solution Provider since 2000

        Comment

        Working...
        X