[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 207

 

The calculation of margin per 1 lot is very simple:

  double МАРЖА=MarketInfo(Symbol(),MODE_MARGINREQUIRED);
  double МАРЖАИНИ=MarketInfo(Symbol(),MODE_MARGININIT);
  double МАРЖАПОДД=MarketInfo(Symbol(),MODE_MARGINMAINTENANCE);
  double МАРЖАЛОК=(MarketInfo(Symbol(),MODE_MARGINHEDGED)*2)/MarketInfo(Symbol(),MODE_LOTSIZE);

Return values are in the currency of the deposit.

Please note that they may return 0 and this is the norm.

Some Dealing Desks do not use initialisation and/or support margins.

They also use the "zero margin" of the overlapped...

*

Info-type calculation of overlapped, in principle, option:

  string МАРЖАЛОКИД="na";
  if( МАРЖАЛОК==0)    МАРЖАЛОКИД="0";
  if( МАРЖАЛОК==1)    МАРЖАЛОКИД="1";
  if( МАРЖАЛОК==0.5)  МАРЖАЛОКИД="1D";
  if( МАРЖАЛОК==2)    МАРЖАЛОКИД="2";  
 
kombat >> :

The calculation of the margin per lot is very simple:....

That's not what he wanted. He needs to calculate the margin of open orders separately by instrument. That is, sum the lots by instrument and multiply by the margin of the instrument.

 
granit77 >> :

This is not what he wanted. He needs to calculate the margin of open orders separately by instrument. This means to sum up the lots by instrument and multiply by the instrument's margin.

Well, it's simple, each instrument has its own summolot*margin

We know the margin, we know the gross:

double SumLot(){ double buy=0, sell=0, sl; int y;
for( y=0; y<OrdersTotal(); y++) {OrderSelect( y, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderType()==0) buy+=OrderLots();
if(OrderSymbol()==Symbol() && OrderType()==1) sell+=OrderLots();
} return( buy- sell);}
 
kombat писал(а) >>

The calculation of margin per 1 lot is very simple:

Return values are in the currency of the deposit.

Please note that they may return 0 and this is the norm.

Some Dealing Desks do not use initialisation and/or support margins.

Also, "zero margin" overlaps are used...

*

Info-type calculation of overlapped, by principle, an option:

Thank you.

What is the difference between initialisation and support margin and normal margin - what are they used for?

 
Finbest >> :

Thank you.

What is the difference between initialisation and support margins and regular margins - what are they used for?

This is the futures toolkit.

m.init = margin required to open

m.subd = displayed after opening

The calculations are quite complex and specific, so I am guided by dealing conditions.

m.subd usually ~75% of m.ini, examples here...

 

Another option is to look at the margins separately by instrument.

(slightly tweaked iExposure )

Files:
 

Hi. Help, please.

I have written this program... it does not work...


double ves[][6], hour[][6];
ArrayCopyRates(ves, Symbol(), Period());// array has all data from chart

int day= Day();
int hou= Hour();
da= day;
for (; q<= da; q++, w--){
if (TimeDay(ves[q][0])== w && TimeHour(ves[q][0])== hou){
ArrayCopy(hour, ves, e, q);
e++;
}
}

I have two arrays. ves array is a time array.

what i need........

take the current hour. from ves copy to hour. all 6 data.

take yesterday's day the same hour (yesterday's day) from ves copied to hour.

and so on...

 

Guys, help, I can't figure out how to do it.

I have a loop that calculates levels between LOW and HI with step Step.

for ( double c = LOW; c < HI; c = c + Step)

Now I need to save each level somewhere so it's easy to pull it out later and compare it with current price. Very much please in the form of code, not from laziness, but because until I see the example I still don't understand how to do it. Thank you!

 

Hello, Esteemed Connoisseurs. I keep asking you questions that I can't find answers to in the textbook and forum. How can this situation be?

Why in the test, showing a profit of 0, on the third trade the lot size suddenly increased?

It is calculated like this Lots=MathMin(20,NormalizeDouble(MathMax(Lots,AccountEquity( ) /3000),1));

TEST


Symbol EURCHF (Euro vs Swiss Franc)
Period 1 Minute (M1) 2009.08.30 23:02 - 2009.08.31 09:34 (2009.08.30 - 2009.09.05)
Model All ticks (most accurate method based on all smallest available timeframes)
Parameters min=0.1;

Bars in history 1519 Modelled ticks 2156 Modeling quality 24.95%
Chart mismatch errors 0




Initial deposit 450.00



Net profit -8.00 Total profit 0.00 Total loss -8.00
Profitability 0.00 Expected payoff -2.00

Absolute Drawdown 32.00 Maximum drawdown 38.00 (8.33%) Relative drawdown 8.33% (38.00)

Total trades 4 Short positions (% win) 1 (0.00%) Long positions (% win) 3 (100.00%)

Profitable trades (% of all) 3 (75.00%) Loss trades (% of all) 1 (25.00%)
Largest profitable trade 0.00 losing transaction -8.00
Average profitable deal 0.00 Deal loss -8.00
Maximum number continuous wins (profit) 3 (0.00) Continuous losses (loss) 1 (-8.00)
Maximum Continuous Profit (number of wins) 0.00 (0) Continuous loss (number of losses) -8.00 (1)
Average continuous winnings 3 Continuous loss 1

Time Type Order Volume Price S / L T / P Profit Balance
1 2009.08.31 00:16 buy 1 0.30 1.5161 1.5127 1.5163
2 2009.08.31 00:37 close 1 0.30 1.5161 1.5127 1.5163 0.00 450.00
3 2009.08.31 00:44 buy 2 0.30 1.5158 1.5124 1.5161
4 2009.08.31 02:58 close 2 0.30 1.5158 1.5124 1.5161 0.00 450.00
5 2009.08.31 03:14 buy 3 0.40 1.5152 1.5118 1.5154
6 2009.08.31 03:30 close 3 0.40 1.5152 1.5118 1.5154 0.00 450.00
7 2009.08.31 06:45 sell 4 0.40 1.5151 1.5185 1.5149
8 2009.08.31 08:18 close 4 0.40 1.5153 1.5185 1.5149 -8.00 442.00








































































 
001 >> :

Guys, help, I can't figure out how to do it.

I have a loop that calculates levels between LOW and HI with step Step.

for ( double c = LOW; c < HI; c = c + Step)

Now I need to save each level somewhere so it's easy to pull it out later and compare it with current price. Very much please in the form of code, not from laziness, but because until I see the example I still don't understand how to do it. Thank you!

As an option:

double c, levels[];
int nCount = 1+( HI - LOW)/ Step;
ArrayResize( levels, nCount);

for ( c = LOW, nCount = 0; c < HI; c += Step, nCount++) {
    levels[ nCount] = c;
}

// Use:
for (int j = 0; j < nCount; j++) {
    if ( levels[ j] > ...) {
        //...
    }
}
Reason: