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

 
Vitaly Muzichenko:

You in a branch of clown theorists, there love to draw it is not clear what, and not clear why

And there are plenty of similar threads on this forum - at least discuss them!

I do not understand Vitaly! - Are you serious? - Or are you kidding?

As is well known, the Trading Theory as such does not exist in the wild.

There are different "Elliott Waves", Fibonacci Numbers, Weierstrass Functions, etc...

But it has nothing to do with the "theory of trading".

And what "trading theory" can we talk about, if 99.9999% of forum users, developers and traders cannot build the simplest moving average trend.

So they draw "I do not know what" and "I do not know why" - as you said.

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

And you cannot "draw" the simplest trend correctly either. - I am sure of it. Forgive me for being blunt. But you can't.

But you easily talk about CLOWNS, and speak out about something that you do not know and cannot do.

This is the paradox we are witnessing.

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

But it's not this that amazes me the most, it's something else entirely.

I see thousands of freelancers and all sorts of academics in the forex market offering their services to everyone.

There's ADVERTISEMENT everywhere. Pay - and they will help, pay - and they will teach ...

All right - I'll pay you, I answer them.

But you show me your qualifications.

BUILD ME THE SIMPLEST TREND!!!

No one has ever built it. Neither freelancers, nor academics, nor developers - NO ONE.

They are afraid of being embarrassed. Because they do not know how. Although at first glance there is nothing difficult.

This is the standard procedure. We have it in MT4/MT5. They simply built it and showed their mastery.

But there are no such cases. They all draw "I do not understand what" and "I do not understand why". Everyone is a clown?

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

And you say THEORETICAL CLOWNS!

Who are the most CLOWNS here - I don't even know!!!

 
Artyom Trishkin:

1. Why?

2. What was it? How was it?

1. Why? - for the calculations.

2. what was it? - So different numbers,Bid-buyPrice= 1.000000000000000006551e-05 and not 0.00001. and whydouble(Bid-buyPrice) gave 0.00001, those required conversion todouble, if I understood correctly, when Bid and buyPrice are already type double?

 
Andrey Sokolov:

1. why? - For the calculations.

2. what was it? - So different numbers,Bid-buyPrice= 1.000000000000000006551e-05 and not 0.00001. and whydouble(Bid-buyPrice) gave 0.00001, those required conversion todouble, if I understood correctly, when Bid and buyPrice are already type double?

Why do you explicitly convert types to double if you operate with double numbers? I showed you a conversion of type double to type string when printed.

Are you sure that 1.0000000000000000000006551e-05 and 0.00001 are different numbers? Different output format - you didn't specify output method in Comment(), so it's a scientific output format. That's why I wrote - either do an explicit conversion of double type to string, or use DoubleToString() with required accuracy.

There's everything in the help - and it's not even in step-by-step accessibility, just a mouse click away in the documentation menu.

Here's one from the help, I've marked what I need:

Comment

Outputs a user-defined comment to the upper left corner of the chart.

void  Comment(
   argument,     // первое значение
   ...           // последующие значения
   );

Parameters

...

[in] Any values, separated by commas. A line feed character "\n" or "\r\n" can be used to split the output over multiple lines. The maximum number of parameters is 64. Total message length (including non-displayable service characters) cannot be more than 2045 characters (superfluous characters will be truncated at output).

Returned value

No return value

Note

Arrays cannot be passed to Comment(). Arrays should be printed out as items.

Data of double type is printed to 16 decimal digits after the decimal point, and can be output in either traditional or scientific format - depending on how the entry is most compact. Data of float type is output with 5 decimal digits after the point. To output real numbers in a different precision or in an explicitly specified format, use DoubleToString().

Data of bool type is output as "true" or "false". Dates are printed as YYYY.MM.DD HH:MI:SS. To output the date in another format, use the TimeToString() function. The data of the color type are output either as a string R,G,B or as a colour name, if this colour is present in the colour set.

Whenworking in the strategy tester in optimisation mode, the Comment()function is not executed.

 
Artyom Trishkin: Are you sure 1.0000000000000000000006551e-05 and 0.00001 are different numbers? Different output format - you didn't specify output method in Comment(), so it's the scientific output format that's being substituted for you by the terminal. That's why I wrote - either do an explicit conversion of double type to string, or use DoubleToString() with the desired accuracy.

The question arose because the condition where the variable*Point was compared and the result of this subtraction did not work, where another variable with the value double was subtracted from Bid with the value double and the result of subtraction had to be converted to double again.

Why is it not the double type in the subtraction process?

I read the help but didn't see any answer, so I'm asking here.

 
Andrey Sokolov:

The question arose because the condition where the variable*Point was compared and the result of this subtraction did not work, where another variable with the value double was subtracted from Bid with the value double and the result of subtraction had to be converted to double again.

Why is it not the double type in the subtraction process?

I read the help but didn't see any answer, so I'm asking here.

When you subtract double from double, the result will be double. It's a sure thing.

But only you know what you are comparing it to.

 
Artyom Trishkin:

When you subtract double from double, the result is double. That's for sure.

But only you know what you are comparing there with.

extern double First_PartialTrailingStart=15;

if(Digits() ==3 || Digits()==5) {First_PartialTrailingStart*=10; }

if(double(Bid-buyPrice)>=First_PartialTrailingStart*Point) - works

if((Bid-buyPrice)>=First_PartialTrailingStart*Point) - does not work

 
Andrey Sokolov:

extern double First_PartialTrailingStart=15;

if (Digits() ==3 || Digits()==5) {First_PartialTrailingStart*=10; }

if(double(Bid-buyPrice)>=First_PartialTrailingStart*Point) - works

if((Bid-buyPrice)>=First_PartialTrailingStart*Point) - does not work

Everything works. Script:

//+------------------------------------------------------------------+
//|                                                  TestCompare.mq5 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                             https://mql5.com/ru/users/artmedia70 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://mql5.com/ru/users/artmedia70"
#property version   "1.00"
#property script_show_inputs
#define   Bid       SymbolInfoDouble(Symbol(),SYMBOL_BID)
//--- input parameters
input uint     InpFirstPartialTrailingStart  =  15;   // Старт трала через (пунктов)
input uint     InpMultiplier                 =  10;   // Множитель пунктов
input int      InpPriceShift                 =  20;   // Отступ цены Buy от Bid
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
double part_trailing_start=double(InpFirstPartialTrailingStart<1 ? 1 : InpFirstPartialTrailingStart);
double multiplier=double(InpMultiplier<1 ? 1 : InpMultiplier);
double value=part_trailing_start*multiplier*Point();
double shift=InpPriceShift*Point();
double buy_price=Bid-shift;
//---
   double res=NormalizeDouble(Bid-buy_price,Digits());
   bool   cmp=NormalizeDouble(res-value,Digits())>=0;
   Alert
     (
      "Старт трала через ",(string)value," пп."
      ", Цена Bid=",(string)Bid,
      ", цена Buy=",(string)buy_price,
      ", Bid-цена Buy=",DoubleToString(res,Digits()),
      ", Bid-buy_price>=value: ",string(cmp)
     );
//---
  }
//+------------------------------------------------------------------+
 
Artyom Trishkin:

Everything works. The script:

Thanks, I'll look into it.

 
Is it possible to get the closing price of a candle on its last tick?
 
Andrey Sokolov:
Is it possible to get the closing price of a candle on its last tick?
This is the Bid price. Another question: how do you know that this is the last tick?
Reason: