Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 790

 
Awwl:

The built-in Heiken Ashi looks a bit underdeveloped (I wonder if it's just me on the 745?), but it's clear how it works. And it is unclear how WmiFor is built!

In the Heiken Ashi code a candle is drawn from 4 bar histograms:

That is, as the buffer number increases (from 0 to 3), new bars are drawn on top of the old ones. The order is as follows:

LowHigh - HighLow - Open - Close.

The order of candlesticks should be the following to get their proper look, with bodies and tails:

max(Open,Close)//thick colour line// - min(Open,Close)//thick white// - High//thick colour line// - Low//thick white//.

Let's compile the indicator, put it on the chart, and see all the problems (see picture).

But this method, like Heiken Ashi, has a disadvantage - under each "candle" we get a white loop in the background colour that covers everything lower. But with WmiFor everything is perfect! Undocumented features?

First picture - Heiken Ashi (placed in a separate window), second picture - WmiFor, background is in light green for clarity.

We are comparing a soft and round one? Why put Haken in a separate window if it is designed for a chart window and drawn there as a candlestick with shadows and body? And no new bars are drawn on top of the old ones. If the buffer value changes, the same bar will change its size and not a new one will be drawn on top of it.

The MT4 does not have a method for drawing in the form of candlesticks, so only a histogram is possible, and how you calculate the buffer values is your own business. WmiFor, by the way, also draws by histogram. Let's put it in a separate window too and stare at its glitches )))

To make candlesticks in a separate window look like candlesticks with shadows, they should be drawn relatively 0, like the Accelerator. Or you can draw them as objects, see for example All_Stars.

 

Good afternoon everyone!

My brain is fuzzy; I haven't found an answer in the documentation, but maybe someone has encountered it. Here is the line in the Expert Advisor (fraction of positive trades):

Print(OderPluseCount,"/",OderTotal,"=",DoubleToStr((OderPluseCount/OderTotal),2),"=",BestOd,",2/5*100,",100*2/5);

Prints it into the journal (e.g.):

3/6=0.00=0 0 40

At the same time, if the solution is 1:

3/3=1.00=1 0 40

Variable BestOd=OderPluseCount/OderTotal is of double type, the rest are int.

That is, as soon as a value less than 1 is encountered, the compiler turns it into 0 automatically... The last two expressions from constants produce surprising results - looks like the same thing, but not ))))

I tried different substitutions and everything greater than 1 has the correct fractional part.

 
Igor_:

Good afternoon everyone!

My brain is fuzzy; I haven't found an answer in the documentation, but maybe someone has encountered it. Here is the line in the Expert Advisor (fraction of positive trades):

Print(OderPluseCount,"/",OderTotal,"=",DoubleToStr((OderPluseCount/OderTotal),2),"=",BestOd,",2/5*100,",100*2/5);

Prints it into the journal (e.g.):

3/6=0.00=0 0 40

At the same time, if the solution is 1:

3/3=1.00=1 0 40

Variable BestOd=OderPluseCount/OderTotal is of double type, the rest are int.

That is, as soon as a value less than 1 is encountered, the compiler turns it into 0 automatically... The last two expressions from constants produce surprising results - looks like the same thing, but not ))))

I tried different substitutions, everything greater than 1 has the correct fractional part.

Try this

DoubleToStr((double)(OderPluseCount/OderTotal),2)

 
AlexeyVik:

Try this

DoubleToStr((double)(OderPluseCount/OderTotal),2)

Doesn't help. But thanks )
 
Igor_:
It doesn't help. But thanks )
DoubleToStr((double)(OderPluseCount/(OderTotal*1.0)),2)
 
Vinin:
DoubleToStr((double)(OderPluseCount/(OderTotal*1.0)),2)

It works like this, thank you. Looks like shamanism ))))

Honestly, I'm more worried not about the display, but the correctBestOd calculation.Had to correct it too.

I did it this way:

BestOd=(OderPluseCount/(OderTotal*1.0));

Is there any explanation for this? After all, it would be very difficult to catch this error if it were not for the print. In what cases might it occur?

 
Igor_:

It works like this, thank you. Sounds like shamanism )))

Honestly, I'm more worried not about the display, but the correct calculationof BestOd. Had to correct it too.

I did it this way:

BestOd=(OderPluseCount/(OderTotal*1.0));

Is there any explanation for this? After all, it would be very difficult to catch this error if it were not for the print. In what cases can it pop up?

In any operation with integer values the result will be an integer.
 

I found the answer myself in the reference book, section"Type conversion".

Если два значения объединяются бинарным оператором, то перед выполнением операции операнд младшего типа преобразовывается к более старшему типу в соответствии с приоритетом, указанным на схеме: 

But the type double in this scheme is the most senior. And I had both int's. Therefore, the result is integer. Introduction of a constant of a higher type (double, float), converted all the int's to it.

You learn for a long time, and consult the documentation)))

 
Hello, I have the following question.
How should I make an EA that goes through and modifies open positions, so that it would not modify repeatedly the orders that have been modified during the next pass. You have to "oil" them somehow.
I cannot think of anything.
I would be very grateful for it.
 
Gobsek:
so that it does not modify again the orders that have been modified during the next pass. They need to be "oiled" somehow

What are you interested in, just a transfer to a lossless position?