Announcement

Collapse
No announcement yet.

Condtions after 10:00 Bar????

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

  • Condtions after 10:00 Bar????

    I am having problems on how to approach this. I have been looking for days on how to do this and come up empty.

    I have a line drawn at the open of bar at 11:00 now. This line draws a straight line from the open of it to the y axis.

    All I want to do is make a condition that if the high(0) of any other bar after the 11:00 bars open must be greater......so basically anything under this line is not alerted or in condition (even if it passes the rest of the conditions)

    high(0) > 10:00 open then action

    I have some other basic conditions.

    I want to ignore the rest of the conditions before 11:00. Mychart starts at 9:30 right now so the conditions before 11:00 are okay and do not need to be changed

  • #2
    Hi PATRADER,

    Try this:

    PHP Code:
    //set four global variables outside main and premain
    var flag11 false;
    var 
    hour1 null;
    var 
    open11 null;
    var 
    condition1 false;

     
     
    // the rest is in main
     
    var nHour hour(0);

     
    // setting up your 11 o'clock conditional
     
    if(nHour!=hour1){
      if(
    nHour==11 && !flag11){
       
    flag11 true;
       
    open11 open(0);
      }
      else if(
    nHour<11 || nHour==16){ // set flag to false before 11 and when it is 4PM
       
    flag11 false;
       
    condition1 false;
      }
      
    hour1 nHour;
     }
     
     
    // testing your conditional
     
    if(flag11 && high(0)>open11){
      
    condition1 true;
     } 
    I hope this helps.

    Comment


    • #3
      Not working right

      thanks for the code...

      I couldnt get it to work....could you look at the basic code.....I am at work and making up a script to try it on.

      for some reason it wont let me paste the code in the PHP?????only the first line???

      so I will attach the file
      Attached Files

      Comment


      • #4
        PATRADER
        Your script is not working because some variables (eg flag10, hour1, etc) are declared in preMain - hence available to that function only - instead of being declared globally
        Alex

        Comment


        • #5
          Thanks

          moved them out and works now....thanks....

          Comment


          • #6
            PATRADER

            for some reason it wont let me paste the code in the PHP?????only the first line???
            The PHP button allows to add a single line of code only.
            If the block of code is more than one line you need to paste it in the body of your message and enclose it with a [p h p] at the beginning and a [/ p h p] at the end of the block of code (in both cases without the extra spaces used in the example)
            Alex

            Comment

            Working...
            X