need help with margin call/stopout - page 2

 
WHRoeder:
ticksize and tickvalue is in points not pips.

Yes sorry. I always think in points so these mistakes happen when responding to forum posts in pips, editted
 
GumRai:


I realise that my post wasn't that well written, but neither ticksize or tickvalue are expressed in points.

Ticksize is the smallest possible move in the instrument.

Tickvalue is the monetary value of the smallest possible move (for 1 lot) expressed in the deposit currency.


What he means is, usually humans talk in pips, and mt4 talks in points.

The output of MODE_TICKVALUE is in points, so usually, you need to times this value by 10 to get the 'tickvalue' for a pip.

So frustrating... guys, just change to points, it's easier ^_^

 

I think I understood but I did not!

The following is from my code, and now I put on a simple test specificlly for this following part---- this EA opened a 0.26 lot position(but a friend of mine, who often use this kind of heavy position, says usually it should be 0.5 lot under this circumstance), and the SL is 50 (means I hold maxmimum position and will stopout if 50 pip retracement), but then I keep this EA running and finally it hits stopout after

80 pips of retracement. So there must be something wrong in my formula.

......
  double SL = (Ask - price1)/Point/mypoint;        // stoploss(in pip) is below wave 1 low, but can not be too near or too far.
  if( SL < 50*mypoint ) SL = 50;                      // in my simple test, I just let it be 50.
  if( SL >100*mypoint ) SL = 100;
  
  if(AccountStopoutMode()==0)
    {
    double one_point_value = MarketInfo(Symbol(), MODE_TICKVALUE);
    double one_lot_margin = MarketInfo(Symbol(),MODE_MARGINREQUIRED);
    double maxlots              = AccountBalance() / ( one_lot_margin + SL * mypoint * one_point_value );
    ordersend(....maxlots.....)
.......

Please help.

 
alladir: The output of MODE_TICKVALUE is in points, so usually, you need to times this value by 10 to get the 'tickvalue' for a pip.
No. The output of tickvalue is in TickSteps not points. You use TickValue and TickStep as a ratio and multiply by the change in price. https://www.mql5.com/en/forum/143709
 
alladir:


What he means is, usually humans talk in pips, and mt4 talks in points.

The output of MODE_TICKVALUE is in points, so usually, you need to times this value by 10 to get the 'tickvalue' for a pip.

So frustrating... guys, just change to points, it's easier ^_^


The output of MODE_TICKVALUE is NOT in points, it is a monetary value dependent on deposit currency.
 

Hope this time it's right:

double maxlots = AccountBalance() / ( one_lot_margin * AccountStopoutLevel()/100 + SL * mypoint * one_point_value );
 
WHRoeder:
No. The output of tickvalue is in TickSteps not points. You use TickValue and TickStep as a ratio and multiply by the change in price. https://www.mql5.com/en/forum/143709

What is TickStep?
 
GumRai:

What is TickStep?

MODE_TICKSIZE
Reason: