Announcement

Collapse
No announcement yet.

common price over hours

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

  • common price over hours

    quick question....

    I'm trying to determine a short method to alert that a particular price in the current bar is common in the preceeding 3 or 4 bars. Is there not a simpler method other than numerous "if" statements ? Perhaps an EFS i've not found yet ?

    thanks in advance
    Attached Files

  • #2
    Chris747
    You could do it with just one if statement inside a for loop

    PHP Code:
    for (var i=0i<4i++){
        if(
    high(-i) >= Price && low(-i) <= Price){
            
    //execute your commands
        
    }

    This would check if the current and prior 3 bars breached the defined price level. If you want to exclude the current bar then replace var i=0 with var i=1
    Alex

    Comment


    • #3
      Hi Alexis,
      Thanks for getting back to me so quick with a solution but I didn't phrase my question quite right ... I would like to be alerted if the price falls in between the close and open (or within the body of the candle) of the previous 3 or 4 candles, regardless of whether they closed up or down. Any ideas ?

      Thanks again inadvance !

      Comment


      • #4
        Chris747
        Other than for some additional conditions the basic logic is the same
        Alex

        PHP Code:
        for (var i=0i<4i++){
            if(
        close(-i) > open(-i) && close(-i) >= Price && open(-i) <= Price ||
               
        close(-i) < open(-i) && close(-i) <= Price && open(-i) >= Price ){
                
        //execute your commands
            
        }

        Comment


        • #5
          Alexis, works like a charm.... !!!
          On behalf of myself and the countless others you go out of your way to help... thank you very much. Seems everytime i get a solution from you, i learn more than i bargained for and I use it in all my future programming.

          Cheers !

          Chris

          Comment


          • #6
            Chris
            You are most welcome
            Alex

            Comment

            Working...
            X