Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1068

 
Сергей Таболин:

It's up to you, of course, but PI (Pi, pI, pi) is a bit different after all )))

what?

P = price of opening transaction

i = i-th trade

L = Lot

 
Roman Sharanov:

what?

P = opening price of the trade

i = i-th trade

L = Lot

simpler

P=Price

L-Lot

i is not needed here at all

Why mess with people's heads with incomprehensible abbreviations?

 
Fast235:

easier

P=Price

L-Lot

i is not needed here at all.

if you want quick help, write it properly.

Because there may be 20 transactions, and you need to do an operation for each of them.

 

there is a constant in the OPENCL cl_platform.h plugin and it is

#define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
by double-checking the degree of two in 1024 got...

2^1024 = 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216

And then below that is the number of pi after

#define CL_M_PI 3.141592653589893115998

3.141592653589793238462643383279502884197169

Explain why ????
 
Roman Sharanov:

what?

P = opening price of the trade

i = i-th trade

L = Lot

Pn - does not work?

 
Сергей Таболин:

Pn doesn't work?

n is the total number, i is the iteration over the elements

 
Roman Sharanov:

n is the total number, i is the iteration over the elements

I'm not going to argue, but in Latin there are a bunch of other liters besides i and n...

 
Сергей Таболин:

I'm not going to argue, but in Latin there are plenty of other letters besides i and n...

OK, is there anything on the subject?

 
Roman Sharanov:
Can you give me a hint, I'm having some kind of problem. I need to calculate the lot for a deal opened at the current price so that the breakeven on all deals was in Pip points from the current price Ask. All trades are unidirectional, let it be buy.

Breakeven formula:

breakeven = sum(Pi*Li)/sum(Li). Where Piis the opening price of a trade, Li is the lot of that trade

Now I want to open an order with lot X at the current price, so that the distance to the CU of all trades is Pip.

So we get the following formula

Ask+Pip=(sum(Pi*Li)+Ask*X)/(sum(Li)+X)

And using mathematics we come to the lot

X=(sum(Pi*Li)-sum(Li)*(Ask+Pip))/Pip

But for some reason we end up with a very small number, of course not correct, what is wrong?

My Baumanka student said that the final formula is not correct.

If I was able to read his scribbles and renaming variables correctly, the formula turns out to be

X = (sum(Li*(Ask+Pip)-sum(Pi*Li)/(2Ask+Pip)

 
Alexey Viktorov:

My Baumanka student said that the final formula is not correct.

If I was able to read his scribbles and renaming of variables correctly, the formula turns out to be

X = (sum(Li*(Ask+Pip)-sum(Pi*Li)/(2Ask+Pip)

Brackets are missing, maybe it's like this?

X = (sum(Li*(Ask+Pip))-sum(Pi*Li))/(2Ask+Pip)

Reason: