You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Topic 14.3: Indicating dangerous values by flashing parts of elements (frames, bases, text, sliders and slider boards).
Flashing of elements is an excellent addition to the colour indication signalling the transition of parameters into the zone of dangerous values. The implementation of the new solution is similar to the previous one, but if the colour indication works according to the principle that the closer the value is to the critical value, the brighter the colour, the blinking only increases the frequency of change of the initial colour with the colour set for blinking. The user can programmatically adjust the flashing delay, gradually decreasing it to 25ms or increasing it to 2.5 seconds. In this case, both mechanisms can be operated simultaneously. The colour shifts from light green to bright red and burgundy and, and the flashing increases in speed. One mechanism does not interfere with the second. Next, we'll break down practical examples.
*Important: the flashing is activated independently of the colour indication functions. The two mechanisms are technically unrelated and can work in parallel or separately.
To implement blinking, new properties have been added to interactive elements:
Added new properties to control speed and stop of blinking:
Let's summarise the above:
Tomorrow we will move on to practical examples.
Today just a small demo to understand what we are talking about.
Unfortunately, there are lags when recording. The processor is loaded. But the demo shows that elements flash asynchronously and at different speeds. Different parts of the elements are also flashing. All this is set programmatically. And the tab on Taskbar automatically found the fastest blinking element and turned blue. Then, when the element started blinking less often, it found the other fastest blinking element and became red.
We'll explore this in more detail tomorrow.
P.S. We will also discuss options for using these very useful features.
Following up on yesterday's topic...
Today we will conceptually summarise and finish the topic of element flashing.
Yesterday I only looked at flashing in the context of signalling dangerous values, but the application can be much broader than that. Here's an example:
Let's imagine a multi-currency Expert Advisor analysing the situation of several marketplaces. Suppose it selects optimal entry/exit points according to a set of complex criteria. The Expert Advisor works in semi-automatic mode and the trader cannot or does not want to programme the whole logic of the trading strategy. Its robot monitors marketplaces, collects data and informs about important points. The expert's work is limited to analysing and displaying the results in tables and diagrams. The final decision on transactions is made by a person.
In this variant, trading activity consists in observing real-time data streams and packing the series of running values into custom parameters. The latter help to scale situational awareness.
However, live engagement requires timely decisions. The problem arises when analysis results are displayed in different windows through multiple graphical views. The amount of information requiring attention grows and the focus of attention splits. As a result, the market perspective becomes clouded in the trader's mind and the efficiency of his work decreases. Fatigue comes.
In this case flashing elements are a good help:
Let's get down to a practical breakdown of the new functionality:
//----------------------------------------------------------------------------------------------------------
1. Order of preparatory actions:
Now let's find the case of the "Start" button in the API file and write the calls of Blink_start() and Blink_stop() functions on the event of pressing and pressing the button:
Let's move on to filling the functions with content:
1. We need the frame of the "Start" button to blink. Let's write a call for blinking of the frame as shown in the code below. The identifier of the blinking property of the button frame is p1_BLINK_frame. Specify the colour of blinking and the object of blinking.
2. Now let's implement the disabling of blinking when the button is released. The identifier p1_BLINK_STOP is responsible for switching off the blinking . You don't need to put anything in brackets except for it.
Let's check the result:
3. Let's switch on the flashing of the button text instead of the frame. The identifier of the pn_BLINK_text property is responsible for blinking of the text:
Result: the button text blinks blue and stops blinking when the button is pressed.
4. Let's switch on the flashing of the button base. The identifier of the pn_BLINK_base property is responsible for the base:
Result: the button base blinks red and stops blinking when pressed.
Now let's combine the flashing of the button's frame and its text:
Result: Thebutton frame and the button text flash synchronously in different colours, as intended.
5. Let's connect other elements in this window to the flashing:
Let's also write the disabling of blinking inside the Blink_stop( ) function :
Result: the new elements are included in Blink_start() and Blink_stop() and blink as intended.
6. Let's cause the window frame to blink when the button is clicked. (Let's temporarily disable blinking of lagging elements.)
Result: the window frame flashes as it should.
*Important: all the considered elements and the window frame blinked at the default speed.
Further we will regulate the flashing speed of the elements with the slider handle and the field with buttons.
7. Let's bind the blinking speed to the value in the field with buttons and slider. All elements and the window frame will blink simultaneously, and the blinking speed will be set manually by these elements.
Let me remind you that the blinking speed depends on the pn_BLINK_DELAY delay .
To solve the problem, let's do the following:
.
We added disabling of window frame blinking inside the Blink_stop() function:
Writing the Blink_delay() function:
Call the Blink_delay() function on the slider and input field elements event, and pass the current value of the elements to it:
*Important note: it turned out that it is impossible to change the blinking speed of the checkbox and dropdown list elements. This speed is always equal to 20 (half a second). This was done intentionally, but I will probably change it in the future. The other elements can change the blinking speed.
Let's write a call to the Blink_delay() function from the event of the "Spin_the_value" element (the field with buttons). The field is connected to the slider, so there is no need to put the call in the slider case. The connection will work and the slider without a direct call will change the blinking speed through the field with buttons:
Result: the field with buttons and the slider change the blink rate of the elements in the window.
Results:
I consider this topic exhausted.
Next on the list - cancellation of entered values by pressing the "Cancel" button.