Announcement

Collapse
No announcement yet.

EFS Question

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

  • EFS Question

    How would an efs script be written to count how many times a trade takes place a given price level? (How many times price ticks at a specific price)


    Also what would the script be that would count total volume at that specific price?

    Are these two things possible in an efs?

  • #2
    possible solution.

    One way I would try to accomplish this is as follows..

    PHP Code:

    var TargetPrice 25.00;  // this is the price we are looking for


    var PriceCount 0;
    var 
    PriceVol 0;
    var 
    LastVolLevel null;

    function 
    main() {

    if (
    getCurrentBarIndex() == 0) {
      if ((
    close() == TargetPrice) && (LastVolLevel != null)) {  // price ticked
       
    PriceCount += 1;
        if (
    getValue("Volume",0) > LastVolLevel) {
          
    //  volume increased on the same bar
          
    PriceVol += (getValue("Volume",0) - LastVolLevel);
        } else {
          
    //  new bar with new volume level
          
    PriceVol += getValue("Volume",0);
        }
      }

      
    LastVolLevel getValue("Volume",0);
    }


    This code will only run in realtime as we don't know where prices ticked in the past (historical chart) for a single price level - but is is a good example. This code example will record price level hits (#) and total accumlative volume at that price level.

    If you wanted this code to track multiple price levels, I would suggest using an ARRAY OBJECT (with an array obviously), then we would have to convert this code to check the array values and update than just as I've shown.

    Best regards,

    B
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Thanks again Brad

      Thanks for all your help !!!!!

      Comment

      Working...
      X