Correct calculation of the lot from the % of the deposit - page 6

 
gochu:

constructive criticism is accepted


As I wrote above to comrade Vinin:


TICKVALUE gives the price for TICKSIZE.

And the distance to SL is given in POINT points.

POINT is not always the same as TICKSIZE (see the 3-digit pair XAUUSD at Alpari).

So you must convert the distance to SL from POINT to TICKSIZE.

Otherwise - we will get 10 times overestimated lot in such cases (that's what I saw on the pair XAUUSD, until I added recalculation).

Recalculation is done as follows (before multiplying by TICKVALUE): MarketInfo(lSymbol,MODE_TICKSIZE) / MarketInfo(lSymbol,MODE_POINT)

PS: and you have no check for pipsLoss==0, which could give a "division by 0" error


 
EverAlex:

As I wrote above to comrade Vinin:


TICKVALUE gives the price for TICKSIZE.

And the distance to SL is given in POINT points.

POINT is not always the same as TICKSIZE (see the 3-digit pair XAUUSD at Alpari).

So you must convert the distance to SL from POINT to TICKSIZE.

Otherwise - we will get 10 times overestimated lot in such cases (that's what I saw on the XAUUSD pair, until I added recalculation).

Recalculation is done like this (before multiplying by TICKVALUE): MarketInfo(lSymbol,MODE_TICKSIZE) / MarketInfo(lSymbol,MODE_POINT)

PS: and you have no check for pipsLoss==0, which could give a "division by 0" error


Thank you, I will check and finalise!
 

I've fixed it, knock on the door...

off-topic question, has anyone worked with the list of currency pairs available in the terminal...?

I am not sure what to do with them!

 
gochu:

I've fixed it, knock on the door...

off-topic question, has anyone worked with the list of currency pairs available in the terminal...?

I am not sure what to do with them!

It is here. See also function list neighbours (left column)
 

what I need it for... I want to find the pairs that will make the difference between TICKSIZE and POINT

found and tweaked the script (attached https://www.mql5.com/en/code/8317) ... but it takes a very long time ... (12 minutes on my computer)... I'd like something faster

If I can't find anything good, I'll write my own...

 

here is a function for TICKSIZE and POINT mismatch

string CurrArray[];

string TICK_NOT_POINT()
{
   string resultString = "\nКоличество валютных пар="+IntegerToString(SymbolsTotal(false))+"\n";
   int quantCurr = SymbolsTotal(false);
   ArrayResize(CurrArray,quantCurr);
   Print(ArraySize(CurrArray));
   for(int i=0;i<ArraySize(CurrArray);i++)
     {
         CurrArray[i]=SymbolName(i,false);
         Print(SymbolName(i,false));
     }
     resultString+="\nНесовпадают TICKSIZE и POINT:";
   for(int i=0;i<ArraySize(CurrArray);i++)
     {
         if((int)(MarketInfo(CurrArray[i],MODE_TICKSIZE)/MarketInfo(CurrArray[i],MODE_POINT)) != 
        (int)(MarketInfo(CurrArray[i],MODE_POINT)/MarketInfo(CurrArray[i],MODE_POINT)))
           {
              resultString +="\n"+ CurrArray[i]+
              " TICKSIZE"+ DoubleToStr(MarketInfo(CurrArray[i],MODE_TICKSIZE), (int)MarketInfo(CurrArray[i],MODE_DIGITS))+ 
              " POINT"+DoubleToStr(MarketInfo(CurrArray[i],MODE_POINT), (int)MarketInfo(CurrArray[i],MODE_DIGITS));
           }      
     }
     return resultString;
}

only on the alpari 53 pairs demo, I never saw a single pair that had a different TICKSIZE

 
gochu:

here is a function for TICKSIZE and POINT mismatch

only on the alpari demo on 53 pairs, I never saw a single pair that had them different


So what is the conclusion from this?

Can we not add a line of conversion from pips to ticks?

Let the users of your function get a 10x increase in lot when going from 2 digits to 3 digits ?

I already reported above - that there was a discrepancy in lot calculation on 3-digit XAUUSD in Alps until I added the recalculation (account real, ECN-new).

If TICKVALUE sets the price for TICKSIZE, but the distance (to SL, for example) is set in Point, we should recalculate from Point to TICKSIZE.

Just because the TICKSIZE is now somewhere equal to the Point doesn't mean anything and

not to recalculate into ticks is a bomb to the users of your function.

 

No, not in any way ... the idea of calculation was to calculate the coefficient between TICKSIZE and POINT, taking it into account in the lot calculation, which I did, but did not put.... (I meant the function for calculating lots), the last function is needed for a simple check of all pairs available on a particular platform (to find pairs that have these aforementioned parameters different) ... and no more

I do not claim to be the final authority... always happy to have a healthy conflict

I am writing for myself, but to make my idea work, I understand file functions, but that is not a question for this thread

 

Colleagues, an off-topic question, please ask for a hint, with a redirect to a resource.

How to find out the intreval of non-trading currency pairs,

I would like to explain, there are platforms (the same Alpari) where USDRUB is not traded at night, I would like to calculate this interval, when trading is prohibited I would be grateful for the help, I will share the results.

 
gochu:

Colleagues, an off-topic question, please ask for a hint, with a redirect to a resource.

How to find out the intreval of non-trading currency pairs,

I would like to explain, there are platforms (the same Alpari) where USDRUB is not traded at night, I would like to calculate this interval, when trading is prohibited I would be grateful for the help, I will share the results.


What's this got to do with platforms... he really doesn't bargain at night... everyone is asleep... :-)))