Questions from a "dummy" - page 208

 
talliy: Can you please tell me how to make a variable take on a single value when a certain condition occurs, rather than over the duration of the condition?
Can you give me more details? The phrase "and not for the duration of the condition" is unclear.
 
Yedelkin:
What about the details? The phrase "not for the duration of the condition" is unclear.
For example, when finding a certain bar. This bar in the array is, say, the third one. While this bar is the third one in the variable truth. It is the third according to the timeframe. We will need to make an entry of it in the log. With every tick the number of records will increase until it becomes the fourth bar. So the question is how to make one-time assignment to the variable truth and one-time fulfill further conditions, but not with each tick until the variable has the truth.
 
Good morning, please advise. I signed up for a signal on your site. But I'm not quite sure how it's coming? And how it will be executed? Maybe I should make some settings in MT4 or it's enough, my subscription, my account number and broker server to copy the trades? What if my computer was switched off? These are the questions.
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация о счете
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация о счете
  • www.mql5.com
Стандартные константы, перечисления и структуры / Состояние окружения / Информация о счете - Документация по MQL5
 
talliy:
For example, when finding a certain bar. This bar in the array is say the third. As long as this bar is the third in the variable truth. It is the third according to the timeframe. We will need to make an entry in the log. With every tick the number of records will increase until it becomes the fourth bar. So here is the question, how to perform simultaneous assignment of variable truth and simultaneous fulfillment of further conditions, and not with each tick until the variable has truth.
Maybe you mean to determine the number of the bar you need not at every tick, but only when a new bar appears? Look here or search the forum for the word combination IsNewBar.
 
talliy: For example, when a certain bar is found. This bar in the array is, say, the third. As long as this bar is the third one the variable is true. It is the third according to the timeframe. This has to be entered into the journal. With every tick the number of records will increase until it becomes the fourth bar. So the question is how to make one-time assignment to the variable truth and one-time fulfill further conditions, not with each tick until the variable is true.

Alternatively, enter another variable to which you will assign the value true if the first variable is sent to print.

bool bar_printed=false;
...
if()                     //Проверяете нужное условие
  {
   ...
   if(!bar_printed)
     {
      Print("Нужное условие выполнено");
      bar_printed=true;
     }
  }
 

Hello, dear users and administration, could you please help me with the following problem. I decided to test free trading signals service https://www.mql5.com/ru/signals/mt4 I set the parameters as in the instructions, but nothing happens. I have entered the log with the following errors:

2012.11.16 11:04:14 '340421': Signal - synchronization failed, processing of trade actions disabled
2012.11.16 11:04:14 '340421': Signal - synchronization terminated, cannot copy position [#37469421 buy 10.00 USDCHF at 0.9411 sl: 0.9231 tp: 0.0000]
2012.11.16 11:04:14 Symbol: no prices for symbol U‰`¤"B<u}{њWr1zzfußtљUYShchµtuNЏEDT`P}sh197XT¬n "zlss®VYЏ--¶¶ԛl
KЂSh 9ґnhuP©h_Yu6nzj-KSQr-ÏŽS<"MSHr©±ЇР'Ì$eљ*t6&SО
.y*'HushR"±,emkЊG€a!ÇV®jtvЉGLYkҐj>5ґ DP@mii!)'HDњE "јў®ћLF‡...¦aў;srI


what's the problem with customisation? My broker is FBS

Торговые сигналы: MetaTrader 4
Торговые сигналы: MetaTrader 4
  • www.mql5.com
Торговые сигналы для MetaTrader 4 с автоматическим исполнением на вашем счете
 
Yedelkin:

Alternatively, enter another variable to which you will assign the value true if the first variable is sent to print.

In the case you suggest, the variable is false with every tick and becomes true after printing to the log. Then there is a new tick and the onTick() operator executes its program from top to bottom. And there the variable is again false, and in the condition if the variable is false then print. And hence the log is full of entries with every tick. Checked!!!

I usedTimeCurrent() function in trying to logically understand the execution of the program in the statement, here is the code:

As a consequence, only those entries are logged where the tick has a time of 0 by the minute and 0 by the second. It's more complicated with the clock. The only thing that changes is the hour signal. Putting 0 will serve as a filter and produce an entry if the "Hammer" is at 00 o'clock, which is rare. At the same time the number of recordings has decreased, but still wants better.

  double r=0;
  double x=0;
  double z=0;
  double rr=0;
  double xx=0;
  double zz=0;
  double a=0;
  r = Open[1];
  x = Close[1];
  z = r - x;
  xx=Low[1];
  a=x-xx;
  zz = 2*z;
MqlDateTime secc;
bool logno = false;
  if (Open[3]<Close[3] && Open[2] <Close[2])         
    if (Open[1]==High[1]&&Close[1]<Open[1])
     if (a>=zz){
    /* if (!logno){
     Print ("На графике свечная модель -Молот");
     logno = true;}*/
     TimeCurrent(secc);
     while(secc.sec==0 && secc.min==0 && !IsStopped())
     {
 Print ("На графике свечная модель -Молот");
 break;
     
        }

This is a quick attempt to depict and find the "Hammer" candlestick pattern on the chart. By the way the example with the variable which is false is commented out here as well.

A hammer pattern is: the lower shadow is at least 2 and at most 3 times the body. The upper shadow is absent or very short (not more than 10% of the candle's range). The colour of the body is irrelevant in long term play; in short term play, the white Hammer is much stronger than the black one.

 

I would also like to clarify how to prohibit a variable from moving behind a price.

Example: A simple stop trawl. We tell the variable to follow the price at a distance of 20 pips (for example). In other words, variable = bid price - 20 pips (assuming we have bought). The price goes up and we successfully follow it. Then the price goes down and we need the variable to remain in its value at the same level.

So my question is, how do we prevent the variable from taking a value at a certain point?

 
paladin800:
Maybe you mean to determine the number of the bar you need, not on every tick, but only when a new bar appears? Look here or search the forum for the word combination IsNewBar.

Thank you!!! Useful reference!!! Will come in handy in the future.

But a bit off, though.... You can think of a way to get around that as well.

 
talliy:

In the case you suggest, the variable with each tick is false and becomes true after a log print is executed. Then a new tick and onTick() operator executes its program from top to bottom. And there the variable is again false, and in the condition if the variable is false then print. And hence the log is full of entries with every tick. Checked!!!

I usedTimeCurrent() function in trying to logically understand the execution of the program in the statement, here is the code:

As a consequence, only those entries are logged where the tick has a time of 0 by the minute and 0 by the second. It's more complicated with the clock. The only thing that changes is the hour signal. Putting 0 will serve as a filter and produce an entry if the "Hammer" is at 00 o'clock, which is rare. That said, the number of recordings has decreased, but still wants better.

This is a quick attempt to depict and find the "Hammer" candlestick pattern on the chart. By the way the example with the variable which is false is commented out here as well.

A hammer pattern is: the lower shadow is at least 2 and at most 3 times the body. The upper shadow is absent or very short (not more than 10% of the candle's range). The colour of the body does not matter in the long term game; in the short term, the white Hammer is much stronger than the black one.


static bool logno = false;
Reason: