[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 397

 

Another question, unrelated to the previous one:

extern int    x1 = 20;
extern double y1 = 0;
extern double z1 = 0;

start() {

   z1 = . . . ;
   y1 = ( x1+100) / 100 * z1;

 . . . 
}


- What should the expression [(x1+100) / 100] be equal to when calculating y1? (z1 is no longer 0)

 
First you need to check the calculation order https://docs.mql4.com/ru/basis/operations/rules it looks like 1,2*z1 As for the previous question, it is easier to write an EA to be tested on a period of one day and which opens one order at a certain time. By changing stop and profit values we may look at the result. But considering that there is no data on ticks, the spread with the test will be in any case.
 
chief2000 писал(а) >>

Another question, unrelated to the previous one:

- What should the expression [(x1+100) / 100] be equal to when calculating y1? (z1 is no longer 0)

More correctly would be

extern int    x1 = 20;
double y1;
double z1;

start() {

   z1 = . . . ;
   y1 = ( x1+100.0) /100.0 * z1;

. . . 
}
 
splxgf >>:
для начала надо глянуть порядок вычислений https://docs.mql4.com/ru/basis/operations/rules похоже 1,2*z1 По предыдущему вопросу проще написать советник тестируемый на периоде в один день и который открывает один ордер в определенное время. Меняя стоп и профит смотреть на результат и вкуривать. Но учитывая что нет данных по тикам, то разброс с тестом будет в любом случае.

Good idea about the Councillor!

 
Vinin >>:

Более правильно было бы так

Apparently so! Even before I got the answer, I changed x1 from int to double and also got the desired 1.2 - but how long it took me to realise what was going on! It's like that joke: I guessed all the letters, but couldn't say the word :)

 
chief2000 >>:

Решил изменить свой Советник таким образом, чтобы его можно было оптимизировать по ценам открытия.

С открытиями нет проблем, но что делать с фиксированными Stop Loss и Take Profit? Я не совсем понимаю как это работает в этом режиме.

Допустим Бар открылся выше [Stop Loss = 30 пипс] и закрылся ниже Stop Loss. Будет ли убыток = 30 пипс или он будет рассчитан по

цене открытия следующего Бара (если откроется ниже СЛ)?

Также, есть ли какие-нибудь советы, рекомендации по этой теме?

Спасибо!





the loss will be exactly 30 pips, but there is a more complicated question: if a new bar has caught both stoploss and takeprofit, what will the tester execute? Obviously, it should do what happened earlier, but how will it know about it if it works only with opening prices? That is why they say that this method of testing is very inaccurate, unless the EA opens and closes positions only at the moment when new bars are opened - and no stoplosses, sorry.

 
alsu >>:

убыток будет ровно 30 пипс, но есть вопрос и посложнее: если новый бар зацепил и стоплосс и тейкпрофит, что будет исполнять тестер? Очевидно, должен то, что произошло раньше, но откуда он об этом узнает, если работает только по ценам открытия??? Вот по-этому и говорится, что данный метод тестирования очень неточный, если только в советнике как открытие, так и закрытие позиций не происходит только в моменты открытия новых баров - и никаких стоплоссов, уж извиняйте.

- This is fine (exactly 30 pips).

- If one bar overlaps both SL and TP - it seems in this case MT will choose the most pessimistic option and protect the trade

as unprofitable (better check again). Apparently this (in my specific case has not yet seen) a rare occurrence -

may be found when testing on all ticks (after optimizing on opening prices).

- If we close trades by bar closes - how can we calculate the number of lots to open a position?

 
How do I make the MACD (fx5_div) change the colour of the bar depending on whether it is equal to the previous bar, larger or smaller?
 
make three buffers (different colours) and enter the corresponding values in them...
 

Comment("Sample text" );


Hi all, here is the comment displayed by the EA. Then you disconnect the EA from the chart, but the comment remains. I understand that we have to make the comment an object and then prescribe deleting this object in deinit. Theoretically it's clear, but in practice, not so much. Professionals, can you give me a code template on how to do this, please?

Reason: