Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 365

 
vadynik:


Just a problem on a level playing field as it seems to me)) OrderOpenPrice() is a double, but to see the real opening price I have to make a string out of it?))

I have to do a double from a string to do subtraction or addition, isn't that crazy? Or am I missing something?)


No, by taking out the OrderOpenPrice() value, you don't even need to normalise it, but to print it out you need to set the necessary precision. Many brokerage companies have variables printed by default with only four decimal places in the log, even though they use five decimal places when opening orders...
 
vadynik:


It's just a problem on the level as it seems to me))) OrderOpenPrice() is a double, but to see the real opening price I have to make a string?))

and to make a subtraction or addition again need to do a double of string, well, not nonsense, eh? or I do not understand something))


Although yes))) It must be historically)))) To see a five digit opening price you have to make a string out of it((.

As a rule, double values are only output with four decimal places by default. so you'll have to translate them into string.....(((((

 

How to tell me please some proven Expert Advisor in MQL4 and 5, and the time is very short, sometimes you need to check one idea or help someone to finally create a basis for the robot and to finish writing it yourself ...

I would be grateful, thanks in advance!!! =)

 
Ekburg:

How to tell me please some proven Expert Advisor in MQL4 and 5, and the time is very short, sometimes you need to check one idea or help someone to finally create a basis for the robot and to finish writing it yourself ...

I would be grateful, thanks in advance!!! =)

What is not a construction set? You take the "cubes" and build ;)
 
Sepulca:


Although yes)))) this must be historical))) To see a five digit opening price you have to make a string out of it((

As a rule, double default values are only output with four decimal places. so you have to translate them into string.....(((((


Why does normalisation not work on OrderOpenPrice() ?
 
evillive:
What's not a construction set? Take the "cubes" and build ;)


Very useful, thanks, I'll use it, but not that one)) I need exactly a constructor, I know a good one, but it's in English and makes experts in a different language...)
 
Sepulca:


Although yes))) it must be historical))) To see a five digit opening price, you have to make a string out of it((

As a rule, double values are only output with four decimal places by default. so you have to translate them into strings.....(((((

What's all the fuss about? In any case, when you print it out, you're converting everything you output to thong panties. Even if you just double PRICE=Ask; Print(PRICE); the PRICE will automatically be dressed up in thongs, and then printed out. With DoubleToStr(), you simply specify the size of the panties with which accuracy to output the double in the thong.
 

I'm so stupid...

The script

int start()
{

 for(int i=OrdersTotal()-1;i<=0;i--)
 {
    if(OrderSelect(i, SELECT_BY_POS)==true) 
      {
            Print("Normalized OOP order#", OrderTicket()," is ",NormalizeDouble(OrderOpenPrice(),5)); 
            Print("doubletostr OOP order#", OrderTicket()," is ",DoubleToStr(OrderOpenPrice(),5)); 
            Print("Symbol of order#",OrderTicket() ," is ",OrderSymbol()); 
            Print("Volume of order#",OrderTicket() ," is ",OrderLots()); 
      }
      else Print("OrderSelect() error - ",GetLastError());

 }
   return(0);
}

Doesn't show anything in the log, there are two market positions, one for eurodol. and one for yenodol.

 
evillive:

I'm so stupid...

The script

Doesn't show anything in the log, there are two market positions, one for eurodol. and one for yenodol.


You have an error in the loop assignment, it is originally wrong and therefore its body is not executed and you do not see the prints

int start()
  {
  for(int i=OrdersTotal()-1;i>=0;i--)
     {
     if(OrderSelect(i, SELECT_BY_POS)==true) 
        {
            Print("Normalized OOP order#", OrderTicket()," is ",NormalizeDouble(OrderOpenPrice(),5)); 
            Print("doubletostr OOP order#", OrderTicket()," is ",DoubleToStr(OrderOpenPrice(),5)); 
            Print("Symbol of order#",OrderTicket() ," is ",OrderSymbol()); 
            Print("Volume of order#",OrderTicket() ," is ",OrderLots()); 
        }
     else Print("OrderSelect() error - ",GetLastError());
     }
   return(0);
   }

That's right.

 
vadynik:
I am trying to close my order by a certain amount of points from the price, I am trying to make a virtual stop...


Because in the code you are not asking for market quotes, you are just counting, so the line:

((NormalizeDouble(priceopen,Digits) >=(NormalizeDouble(priceopen,Digits)-30*Point))||(NormalizeDouble(priceopen,Digits) <=(NormalizeDouble(priceopen,Digits) + 25*Point)))

is always true and the body of the operator will be executed.

Reason: