[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 20

 
Dimka-novitsek:
Ugh, not Smoothness, but Slowdown. Here's ten:

Here's a look at how textbook stochastic counts.

 

Chiripaha:

The text is bound to the line price + 3*Point (i.e. I put it slightly higher), but still, when I change the size of the chart (window) the text is now above the line, now below, now at the level of the line (it jumps)... Why does this happen? - I'm kind of giving the exact price coordinate. How is it solved?

I've looked and tried how others do it, but the effect is similar. I want to understand how this "bounce" gets rid of. And most importantly, why it appears if the coordinates are hard: price and time?

TarasBY:

Text is entered in the object description and the chart is allowed to show object descriptions (one of the ways).

How to implement it programmatically? I searched and searched - have not found. By hands it works, but what kind of commands should be....
 
Chiripaha:
How to implement this programmatically? I've searched and poked around and couldn't find it. By hand it works, but what kind of commands should be....

bool ObjectSetText( string name, string text, int font_size, string font_name=NULL, color text_color=CLR_NONE)
Change of object description. For OBJ_TEXT and OBJ_LABEL objects this description is shown on the chart as a text string. If successful, the function returns TRUE, otherwise FALSE. To get more information about the error, call GetLastError().
The font_size, font_name and text_color parameters are only used for OBJ_TEXT and OBJ_LABEL objects. For other object types, these parameters are ignored.
See also ObjectDescription().
Parameters:
name- object name.
text- Text describing the object.
font_size- Font size in points.
font_name- Font name.
text_color- Text_colour.
Example:
ObjectSetText("text_object", "Hello world!", 10, "Times New Roman", Green);
 
TarasBY:


See also ObjectDescription().

Woohoo... DESCRIPTION... : )))) I've been looking for where it's done.... Thanks a lot! : )))

 
Chiripaha:

Woohoo... DESCRIPTION... : )))) I've been wondering where it's done.... Thank you so much! : )))

ObjectDescription() only returns a property (in this case a description), BUT does not set it!!!

 
TarasBY:

ObjectDescription() only returns a property (in this case a description), BUT does not set it!!!

Yes... Here, I've just worked that out... How do you install it? : ((

It's reflected there manually if you set it through the properties window.

 
Chiripaha:

Yes... Here, I've just worked that out... How do you install it? : ((

It's there manually if you set it in the properties window.

Who am I talking to? - https://forum.mql4.com/ru/52892/page20#732354
 
TarasBY:
And who am I answering to? - https://forum.mql4.com/ru/52892/page20#732354

: ))))))) Yay! I figured it out... - Now I've experimented with it after the bashing. I didn't know you could do that... : )) I looked at how others do it and did it by analogy. And it turns out, this function "..SetText" is independent. I thought it would only work after the text object was created.

Thanks a lot again! : ))) Still learnt something. : ))

 
rigonich:


Print out the state of the flags separately for each condition. This is because the conditions do not take into account the state of the second flag.

P.S. And it is more convenient to printPrint("flag=",flag, "flagg=",flagg) to avoid confusion;


print("flag=",flag, "flagg=",flagg);

prints flag=1 flagg=0 AS ORDER!

but somehow the signal passes EVERY TICK!

i.e. condition if(Ma_1<Ma_2 && flag==0) flag is ignored FULL! how come? flag prints flag=1 and immediately passes if(Ma_1<Ma_2 && flag==0) ->Sound

-----------------

you can simplify this code to the following

if(Ma_1<Ma_2 && flag==0) {PlaySound("ok.wav"); flag=1 }

as a result the sound should go ONE time. And it beeps at every tick!!!

 
lottamer:


printed Print("flag=",flag, "flagg=",flagg);

prints flag=1 flagg=0 AS ORDERED!

but somehow the signal passes EVERY TICK!

i.e. condition if(Ma_1<Ma_2 && flag==0) flag is ignored FULL! how come? flag prints flag=1 and immediately passes if(Ma_1<Ma_2 && flag==0) ->Sound

-----------------

you can simplify this code to the following

if(Ma_1<Ma_2 && flag==0) {PlaySound("ok.wav"); flag=1 }

as a result the sound should go ONE time. And it beeps at every tick!!!


Do you have flag as a local variable?

P.S. When it's not quite clear what's going on, it's better to print out the values before and after the function or operator you want to check, to see how exactly they change. Sometimes input values are not what we expect them to be, and finding where and why they become what they are is much easier in code than guessing why the program doesn't work correctly.
Reason: