need help with refreshrates

 

Hi guys. I'm new to coding and I'm stuck with a refreshrate function. or so I think :) I'm using the function in a while loop and I need it to refresh the bid so that the while loop could work. when I run this to a test it's stuck on the same bid. I'd realy appreciate your help on this. here is my loop:

while (H1<0||L1<0)
 {
 if(iHigh(NULL,0,4)>iHigh(NULL,0,3)&&iHigh(NULL,0,4)>iHigh(NULL,0,5)
  &&iHigh(NULL,0,4)>iHigh(NULL,0,2)&&iHigh(NULL,0,4)>iHigh(NULL,0,6)
  &&iHigh(NULL,0,4)>iHigh(NULL,0,1)&&iHigh(NULL,0,4)>iHigh(NULL,0,7))
  {
  H1=iHigh(NULL,0,4);
  TH=iTime(NULL,0,4);
  } 
 if(iLow(NULL,0,4)<iLow(NULL,0,3)&&iLow(NULL,0,4)<iLow(NULL,0,5)
  &&iLow(NULL,0,4)<iLow(NULL,0,2)&&iLow(NULL,0,4)<iLow(NULL,0,6)
  &&iLow(NULL,0,4)<iLow(NULL,0,1)&&iLow(NULL,0,4)<iLow(NULL,0,7))
  {
  L1=iLow(NULL,0,4);
  TL=iTime(NULL,0,4);

  }

 RefreshRates();
 }

 
roeysegal:. I'm new to coding and I'm stuck with a refreshrate function. or . here is my loop:

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. Don't loop. If the condition is not satisfied, return from start() and wait for the next tick.
  3. You only have to use RefreshRate(), if you are doing multiple server calls (to update Bid/Ask between them) or you are doing a calculation that will take seconds.
 
I know. but this loop is part of the code. I need this loop to find the high and low before the rest of the code begins
 
roeysegal:
I know. but this loop is part of the code. I need this loop to find the high and low before the rest of the code begins


you are looking at bar open if bar4 is highest or lowest    

        Highestlevel = iHigh(NULL, 0, iHighest(NULL, 0, MODE_HIGH, 7,1));  //High[4] == Highestlevel ??
        Lowestlevel = iLow(NULL, 0, iLowest(NULL, 0, MODE_LOW, 7, 1));
 

o.k. thanks for the ihighest and ilowest. i didn't know that. but I have this loop and many other loops in this code that can take much time until they end. I need the code to get the bids constantly until the loops end. how do I do that?

for example:

while (orderstotal()==0)

look for ....


while (orderstotal()==1)

look for ...

 
roeysegal:

o.k. thanks for the ihighest and ilowest. i didn't know that. but I have this loop and many other loops in this code that can take much time until they end. I need the code to get the bids constantly until the loops end. how do I do that?

for example:

while (orderstotal()==0)

look for ....


while (orderstotal()==1)

look for ...


OrdersTotal()    are not only the trades of your EA on the chart So this will fail in many situations

let the tick finish and a new tick will come ... 

for this   RefreshRates(); is not needed

 
roeysegal: I need the code to get the bids constantly until the loops end. how do I do that?

No you don't. If the Bid is not high enough, return. Check again on the next tick. Nothing is changing until the next tick.

You originally said I have a flat tire. We told you to fix the tire with a spare. Now you say: but I have other flat also and fixing the one won't help. Fix them ALL the same way.

If ALL conditions to open are not true, return.

 
I know about the OrdersTotal().  I can't let the code to reach the start before it ends doing what I want it to do. so I have to make it get the next tick constantly until the breakout. I know there's a refreshrate(). but I don't know how to use it. please help me if you can.
 
roeysegal:
I know about the OrdersTotal().  I can't let the code to reach the start before it ends doing what I want it to do. so I have to make it get the next tick constantly until the breakout. I know there's a refreshrate(). but I don't know how to use it. please help me if you can.


break out

place  BuyStop SellStop at the levels to break

Reason: