Errors, bugs, questions - page 1381

 
Karputov Vladimir:
Please showSYMBOL_VOLUME_STEP for these three symbols.

0.01 for ES

0.1 for SPX

1 for RTS.

Once again - I have 2 different tasks:

The 1st task is to equalise the volume for any instrument in the world.

The 2nd task is to get a quote for any instrument in the world from the number.

About the first task. I don't know where to get information about what values SYMBOL_VOLUME_STEP has in principle.

The fact that I personally encountered 1 and 0.1 and 0.01 is not an argument that there will always be only that. Who says that there is not, say, 0.25 or 0.5?


About the second problem. I don't know how to get an offset. I've only once encountered such a tricky case with a quote with price increments of 0.13, 0.38, 0.63, 0.88. But where is the guarantee that this is an isolated exception?

Is it really necessary to become an expert in all the instruments in the world to get an exact quote in the terminal from a number? Why should that be my problem?

 
Fry:

...

About the first task. I don't know where to get information about what values SYMBOL_VOLUME_STEP has.

...

Go through all instruments in market overview and getSYMBOL_VOLUME_STEP for each one. Then do the same operation on another trading server. And so on, until you have gone all over the world.

Then you will know whatSYMBOL_VOLUME_STEP valuesexist in the world.

 
Fry:

0.01 for ES

0.1 for SPX

1 for RTS

Once again - I have 2 different problems:

The 1st task is to equalise the volume for any instrument in the world.

The 2nd task is to get a quote for any instrument in the world from the number.

About the first task. I don't know where to get information about what values SYMBOL_VOLUME_STEP has in principle.

The fact that I personally encountered 1 and 0.1 and 0.01 is not an argument that there will always be only that. Who says that there is not, say, 0.25 or 0.5?


About the second problem. I don't know how to get an offset. I've only once encountered such a tricky case with a quote with price increments of 0.13, 0.38, 0.63, 0.88. But where is the guarantee that this is an isolated exception?

Is it really necessary to become an expert in all the instruments in the world to get an exact quote in the terminal from a number? Why should that be my problem?

What is the problem? The easiest case is the step of 0.01, 0.1, 1. Correspondingly, you normalize the volume to 2, 1, 0. If the step is 0.13 etc., in case the volume is fixed and specified in the input settings - during initialisation you check if the integer number is obtained when dividing the input volume by the step. If not, you adjust the volume, for example, to the nearest suitable one by multiplying the resulting integer value by the step.

 
Karputov Vladimir:

Go through all instruments in the market overview and getSYMBOL_VOLUME_STEP for each one. Then do the same operation on another trading server. And so on, until you have gone around the world.

Then you will know whatSYMBOL_VOLUME_STEP valuesexist in the world.

If this is sarcasm, I don't understand the reason.

If you're seriously suggesting that I do this crap on a regular basis, it's easier to change the platform. I'll code, for example, under TSLab or something else I'll choose.

I'm not asking for something super natural. Just 2 basic functions (out of any number, a peer to peer volume and a quote).

It would be quite logical to expect such a service just from the API, rather than doing "sharpening with a file" on the situation.

 
Fry:

If this is sarcasm, I don't understand the reason.

If you're seriously suggesting that I do this crap on a regular basis, it's easier to change platforms. I'll code on TSLab, for example, or something else I'll choose.

I'm not asking for something super natural. Just 2 basic functions (out of any number, a peer to peer volume and a quote).

It would be quite logical to expect such a service just from the API, rather than doing "sharpening with a file" on the situation.

I do not understand your "want": there is a standard functionSYMBOL_VOLUME_STEP- use it. You can use any step for each instrument. If you want to add 100 minimum volumes: volume=SYMBOL_VOLUME_STEP*100. If you want to add 12 minimum volumes: volume=SYMBOL_VOLUME_STEP*12. What's the problem?
 
Karputov Vladimir:
I don't understand your "want": there is a standard functionSYMBOL_VOLUME_STEP- use it. You can use any step for each instrument. You want to add 100 minimum volumes: volume=SYMBOL_VOLUME_STEP*100. You want to add 12 minimum volumes: volume=SYMBOL_VOLUME_STEP*12. What's the problem?

I see. Okay. Let's look at a concrete example.

I need to set an order that will close, let's say, 70% of the position, and I want to keep the rest of it. I.e. I create a partial take profit.

After the position is fully closed, its volume is easily known.

How do I get ~ 70% exactly on SYMBOL_VOLUME_STEP?

Give me the formula. =)

 
Fry:

I see. Good. Let's look at a specific example.

I need to set an order that will close, let's say, 70% of the position, and I want to keep the rest of it. I.e. I create a partial take profit.

After the position is fully closed, its volume is easily known.

How do I get ~ 70% exactly on SYMBOL_VOLUME_STEP?

Give me the formula. =)

Like this:

MathFloor((POSITION_VOLUME*0,7)/SYMBOL_VOLUME_STEP)

And an example in numbers:

step 0.1
POSITION_VOLUME=12,3
12,3*0,7=8,61
8.61/0.1=86.1
MathFloor(86,1)=>86
86 минимальных шагов

step 0.1
POSITION_VOLUME=0,51
0.51*0.7=0.357
0.357/0.1=3.57
MathFloor(3,57)=>3
3 минимальных шага
 
Fry:

I see. Good. Let's look at a specific example.

I need to set an order that will close, let's say, 70% of the position, and I want to keep the rest of it. I.e. I create a partial take profit.

After the position is fully closed, its volume is easily known.

How do I get ~ 70% exactly on SYMBOL_VOLUME_STEP?

Give me the formula. =)

Hi, if you're willing to parse this code. The archive contains a test class for standard trading operations - Opening, Closing (volume of position to be closed is set in %), Reverse...

and a set of test scripts to demonstrate these functions

Files:
MQL5.zip  148 kb
 
Fry:

I see. Good. Let's look at a specific example.

I need to set an order that will close, let's say, 70% of the position, and I want to keep the rest of it. I.e. I create a partial take profit.

After the position is fully closed, its volume is easily known.

How do I get ~ 70% exactly on SYMBOL_VOLUME_STEP?

Give me the formula. =)

Dear, I told you above how and what to do, you somehow ignored it. No one will write such functions for your sake. It's not a need - it's a whim.

And yes, 70% even can't always be arranged. That's what SYMBOL_VOLUME_STEP was invented for.

 
Tapochun:

I told you above how and what to do, but for some reason you ignored it. No one will write such functions for your sake. This is not a need - it is a whim.

And yes, 70% even can't always be arranged. That's what SYMBOL_VOLUME_STEP was invented for.

I didn't ignore it. I just didn't have enough time to get into it. Your writing is confusing, and I'll probably get it tomorrow. =) I need to sit quietly, to understand. Thanks for your answer, in any case.


A whim? Necessity? The criteria are blurred. For me a necessity, for you a fad.

I have a suspicion that I'm not the only one who needs it. But it's not up to me.

The fate and direction of the product is in the hands of the developers. I'm just a user and maybe not for long =)