Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 655

 
Good day! Can you please tell me how to implement this case?


I created a button in the indicator, when you press it, a certain condition is fulfilled. But when you switch timeframe or chart, it is reset to the initially NOT pressed state. I want it to happen only manually - by pressing the button.

What to do? I feel that the solution in one line, but experience and knowledge is not enough.
 
Kot:

Good afternoon!

Can you tell me if it's possible to create a script that, when dragged to a certain bar, would give its date? Is it possible to do this? If so, what function? Been reading the handbook and forums but haven't found anything so far. Give me an idea or direction. Thank you!

You can, here's ready to do someone, in the folder indicator drop

Sergei Nikolaev:
Good day, please advise how to implement this case?

In the indicator I have created a button, when you press it, a certain condition is fulfilled. But when you switch timeframe or chart, it resets to the initially NOT pressed state. I want it to happen only manually - by pressing the button.

What to do? I feel that the solution in one line, but experience and knowledge is not enough.

You need the source code, maybe you'll see.

otherwise read in the help when OnInit() is executed

Files:
HighLow_TF.mq4  28 kb
 
Igor Makanu:

I need the source code, maybe I can see


The code itself is very old and voluminous, the button was implemented in it by gut feeling
I am attaching the code stripped of all unnecessary things, except for the button itself


We need to implement so that when you change the timeframe button is not pressed, is this even possible7!

Files:
xmdz52.mq4  9 kb
 
Сергей Николаев:


The code itself is very old and bulky, the button was implemented by gut feeling
I am attaching the code, stripped of all unnecessary things, except for the button itself

I've posted one code recently, there, it has a button in it. May be useful for understanding...

 

Greetings. Can you please tell me where this value comes from when you subtract?

"Bid: ", Bid," buyPrice: ", buyPrice," Bid-buyPrice: ", Bid-buyPrice

buyPrice=Bid; set at opening

 
Andrey Sokolov:

Greetings. Can you please tell me where this value comes from when you subtract?

"Bid: ", Bid," buyPrice: ", buyPrice," Bid-buyPrice: ", Bid-buyPrice

buyPrice=Bid; set at opening

Comment("   Bid: ", (string)Bid,"   buyPrice: ", (string)buyPrice,"   Bid-buyPrice: ", string(Bid-buyPrice));

Or use DoubleToString() instead of (string) with desired accuracy.

 
Artyom Trishkin:

Or use DoubleToString() instead of (string) with desired accuracy.

Thank you. I used double(Bid-buyPrice) to calculate

Only why was it like this?

 
Igor Makanu:

2. debugger

https://www.mql5.com/ru/articles/654

Thanks, but there's a line like this:

"Using the debugger is a new feature of MetaEditor 5, it is not present in MetaEditor 4"

deadlock)

 
Ghabo:

Thanks, but there's a line like this:

"The use of the debugger is a new feature of MetaEditor 5, it is not present in MetaEditor 4"

deadlock)

There is. On current data. MT5 has debugging on historical data.

 
Andrey Sokolov:

Thank you. Used double(Bid-buyPrice) to calculate

But why was it like this?

1. What for?

2. What was? How was it?

Reason: