[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 202

 
If you have to measure pips, then multiply the difference by MODE_POINT from MarketInfo()
 
splxgf >> :
if you want to measure pips, then multiply difference by MODE_POINT from MarketInfo()

"Chukcha, you don't get smart, you point your finger!"

from zuid_west_three_rumba_right

Example, please:)

 
tmp.0 >> :
Not a fact :)

In general, I never think about it, but I know that problems can arise. That's why I always make sure that the numerator and denominator in the division are double numbers. In other languages, it's a lot simpler, because I can do the following:


double x = (double)a / (double)b;


I don't think so, because I have to deal with different programming languages and rules are different everywhere. So I'd better insert an extra parentheses or convert the variable to a certain type at once, though it may be unnecessary. But at least you don't have to look through the code to find problems. The compiler will sort it out and fix everything unnecessary. And if something is missing, the compiler cannot fix it - it has no telepathic powers and will follow its own rules even if the programmer believes otherwise.

 
tmp.0 >> :

"Chukcha, you don't get smart, you point your finger!"

from zuid_west_three_rumba_right

Example, please:)

int start()
  {
//----
for(int i=1; i<=500; i++) 
   {
    int candle= MathAbs((High[ i]-Low[ i])*MarketInfo(Symbol(), MODE_POINT));
    int sum= sum+ candle;
   }  
//----
double total_size= sum/500;
Alert(" средний размер свечи (High-Low) = ", total_size);
//----
   return(0);
  }



Although if we are talking about average candle size I would still take the candle size modulo, with our DTs the minimum can be greater than the maximum.
 
splxgf >> :

>> Then it's like this:

int candle=MathAbs((High[ i]-Low[ i])/MarketInfo(Symbol(), MODE_POINT));


Collective intelligence is a scary force :)

 
tmp.0 >> :

Then that's it:


Collective intelligence is a terrible thing :)


Indeed, that's what it means to run out of dark beer and have to wash down the cognac with light beer for a second night.

 
dmmikl86 писал(а) >>

help me out: why Alert=0 ???

here is the code for the script - it reads the average size of the candle

int start()
  {
//----
double sum=0;
double candle;
for(int i=1; i<=500; i++) 
   {
    candle=High[ i]-Low[ i];
    sum= sum+ candle;
   }  
//----
double total_size= sum/500.0;
Alert(" средний размер свечи (High-Low) = ", total_size);
//----
   return(0);
  }
 
Dear experts, please help me to understand OrderCloseBy() function. I am totally confused. I have an Expert Advisor, which opens and closes positions by reversed conditions. That is, the conditions OPEN BUY and CLOSE SELL are the same, as well as OPEN SELL and CLOSE BUY, which means that right after exiting one position at the same price, a position opens in the opposite direction with the same size. So I decided to try and replace OrderClose() by opening a position in the opposite direction with double volume and then closing opposite orders with OrderCloseBy(). That is, the same algorithm should have been applied but it would have saved one spread per trade, but the tester has shown quite a different result. I cannot decide whether I have written the code incorrectly or have misunderstood the idea... I would be very grateful to you for clarification...
 
Dmirtiy >> :
In other words it should be the same, but with savings of one spread per trade, but something tester shows absolutely different. I cannot decide, if I have copied the code wrong or I misunderstood the idea... I will be very grateful to you for clarifications...

If this is all just about spread economy, then let me tell you that you will not save on that spread!!! With double the lot, double the spread, or rather the commission for the spread, ie, for example, 2p. spread from 1 lot is $20, with 2 lots of the same 2p. 40$

PS There's no such thing as free gingerbread)))

 
How is it then that closing counter orders by OrderCloseBy() in the example in the tutorial, is more profitable than closing them separately?
Reason: