Help with some code - Stuck in a loop - page 2

 
smoknfx:

i am sure that whatever he thinks about my post, it wont even make him blink compared to when mr whroeder comes in with his rant about slaves and nobody works for free around here, lmfao...

what do you think that he will think about that?

I helped that user, because he posted some of his code, he tried. He didn't just ask for someone to code it for him.

Now, you, try do stay off this forum you troll

smoknfx: Is a troll, a babbling troll, more babble
Please do not feed the troll.
When you respond, you give the troll power. When you ignore the troll, he starves for attention and eventually dies.

 
WHRoeder:
Doubles rairly compare equal. See Can price != price ? - MQL4 forum




So would I be right in thinking that if I changed it to something like

if (Bid >= S1 - 0.00001 && Bid <= S1 + 0.00001)

which would enter if price is one point either side of pivot line. Or do you think I could go further and perhaps use either 6 or 7 decimal places to make it more accurate. Or would that depend on any NormalizeDouble's that I have used elsewhere in the code.

Also If I am using a range rather that a specific finite value would there be any need for the while loops ? I used them because I was having problems that it was not entering an order due to an error130 so it would loop until it succesfully placed an order.

Also in reply to an earlier post the value of Gap

Gap = (MarketInfo(Symbol(),MODE_STOPLEVEL)+20)*Point;

So the stoploss can never be to close.

Also I am not on an ECN broker

 
falsedave:


Also in reply to an earlier post the value of Gap

So the stoploss can never be to close.

Also I am not on an ECN broker


It's not just about the StopLoss and the Open price, it's also about the TakeProfit, how is BR3TP, BR2TP, etc calculated, can you show the code for those variables please.

You need to read this: https://book.mql4.com/appendix/limits and check your code against it.

 

BR3TP and BR2TP are midpoint pivot calculation so TP can be changed using a bool for either full or mid pivots.

I think I've sorted it now. I changed Bid for Ask. It was trying to send the order to close to the current price. I got rid of the while loops entirely but added this to the end for error checking.

Think I have any problems with looping again I will take out the buystops() line.

if (buyticket <= 0)
      {
         Print("Error Sending BuyStop order ", GetLastError());
         buystops();
      }

Also as regards to etiquette on these forums is It polite to start a new thread for other problems or should I just continue with this one ?

 
falsedave:


Also as regards to etiquette on these forums is It polite to start a new thread for other problems or should I just continue with this one ?

If the new problem is associated/linked with the problem in this thread then add it here . . . if its totally different then start a new thread. :-)
Reason: