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

 
evillive:
No, he then thought about it and decided that 140.15 or 140.35 is also a steep price and may be needed. The customer has not yet decided what he needs simply ))))

artmedia70:
Well... When he finally decides what he wants, let him start thinking ...


Good day !

You gentlemen are very polite, given the title of this thread.

I STARTED to think. And realised that what you advised does not solve the problem.

There is no customer))), I am writing for myself. The task was fundamentally how to explain the adviser price after the decimal point, at which the action is performed.

The price may be XXX.01 or XXX.34 - it doesn't matter. XXX.00 I pointed out for an example.

It turned out to be simple.

int start()                                   // Спец. функция start
  {
//----
   double Price, Level, Level_2;                 // Текущая цена и уровень для расчета
   Price=Bid;                                    // Запрашиваем цену
   Level=MathFloor(Bid);                         // Задаем уровень XXX.00
   Level_2 = MathFloor(Bid)+50*Point;            // Задаем уровень ХХХ.50
                              
//----
   if (Price==Level)                                      // Если цена на уровне ХХХ.00
     {
      Comment("Курс был равен  заданному уровню ", Level);    // Сообщение трейдеру
     }
     
   if (Price==Level_2)                                    // Если цена на уровне ХХХ.50
     {
      Comment("Курс был равен  заданному уровню ", Level_2);   // Сообщение трейдеру
     }
   
   return;// Выход из start()

"Level2" = 50 can be taken out into external variables and set any level that is of interest at the moment.

The question is removed.

P.S. The example is for yen pairs (two decimal places). For 4 digits it should be written a little differently (!Beginners, if interested, ask a pro how)) ).

I write in forums very seldom. The desire to change habits has not appeared.


Good day to you all and good luck.

 
Do alerts and prints in the code affect optimisation time?
I.e. does the optimisation know how to bypass them or does it need to be done at the user level?
 
chief2000:
Do alerts and prints in the code affect optimisation time?
I.e. does the optimisation know how to bypass them or does it need to be done at the user level?


Affect, especially if you output the result of a time-hungry calculation. Better insert IsOptimization() check before the alerts.
 
evillive:

They do, especially if you output the result of a time-hungry calculation. It is better to insert IsOptimization() check before the alerts.

I meant the Alert and Print commands themselves rather than calculations for output. They are of no use during optimization, but can they be automatically disabled by the optimizer or not? (Each additional check also affects the optimization speed).
 
chief2000:

I wasn't referring to the output calculations, but to the Alert and Print commands themselves. They are of no use during optimization, but are they automatically disabled by the optimizer or not? (each additional check also affects the optimization speed)


Both Alert, Print and Check have an effect. But checking is less time-consuming.
 
evillive:

Both the alert and the print and the check are affected. But checking is less time-consuming.

As far as I know, Alert and Print in optimisation mode (not testing) are simply skipped by the tester, thus not affecting anything... MarketInfo has a much bigger impact on the speed, it can really slow down the process. It really helps if(IsTesting()) and if(IsOptimization()); for example, if the program constantly monitors the current spread, it is not necessary in the tester.

 
alsu:

As far as I know, Alert and Print in optimisation mode (not testing) are simply skipped by the tester, thus not affecting anything... MarketInfo has a much bigger impact on the speed, it can really slow down the process. It really helps here if(IsTesting()) and if(IsOptimization()); for example, if program constantly controls current spread, there is no need in tester.


If this isn't fixed then the comments can really slow down the MT.
About MarketInfo - do you mean the command itself? And for example the use of Bid/Ask (in its pure form, for the current symbol)?
 
chief2000:

If this isn't fixed, comments can really slow MT down.
About MarketInfo - are you referring directly to the command itself? And for example using Bid/Ask (in its pure form, for the current symbol)?

In the tester MarketInfo() doesn't work, and Bid and Ask are slow and distorted. So on Xrust's advice I get them from iClose(NULL,0,0):

  if(IsOptimization() || IsTesting() || IsVisualMode())
  {
    Spread = 21; 
    spr = NormalizeDouble(Spread*Point,Digits);
    bid = NormalizeDouble(iClose(Symbol(),0,0),Digits);
    ask = NormalizeDouble(iClose(Symbol(),0,0)+spr,Digits);
  }
  else
  {
    Spread = MarketInfo(Symbol(),MODE_SPREAD);
    spr = NormalizeDouble(Spread*Point,Digits);
    bid = MarketInfo(Symbol(),MODE_BID);
    ask = MarketInfo(Symbol(),MODE_ASK);
  }
 
borilunad:

In the tester MarketInfo() doesn't work, and Bid and Ask are slow and distorted. Therefore, on Xrust's advice I get them from iClose(NULL,0,0):


Crutches, imho.
 
tara:

Crutches, imho.
+