[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 690

 
When they run out, the bell tolls from a notorious figure...
 
artmedia70:
double AccountFreeMargin( )
Returns the value of the free funds allowed to open positions in the current account.
Example:

I have seen the reference. What is the difference between AccountFreeMargin() and balance and equity?

And accordingly, does it make sense to use AccountFreeMargin() in calculating risk for new trades?

 
chief2000:

I have seen the help. What is the difference between AccountFreeMargin() and balance and equity?

And accordingly, does it make sense to use AccountFreeMargin() in calculating risk for new trades?

What is a Margin CALL?
A Margin Call is a condition that results in a forced closing of a position.

This happens when your account balance (Equity) has reached zero of the required margin (Margin) for the sum of all open positions.

The operation is carried out automatically. In some companies the Margin Call is set at 30% of the collateral deposit.

 
artmedia70:
To conclude, I will give you an example of closing such trades by increasing equity by a specified number of percents. I increased it by 5%.

Graph, after 16 days. You can clearly see how the balance line falls to the equity line when all positions are closed when it increases by 5%


This is called the total profit of all positions.



Not a bad strategy, but I don't understand what happens if the chart - the price goes the other way?
 
IgorM:

It's not a bad strategy, but I do not understand what happens when the chart - the price goes in the other direction?

When many positions are open on both sides and all of them are in the red, nothing much happens - we will assume that two oppositely directed losing positions when the price is between them adds or subtracts nothing - one tends to be more negative, the other to be more positive. Everything depends on newly opened positions. If they go to the profit, they will increase equity. When its amount becomes equal to the trigger level - the Expert Advisor will close all positions adding 5% profit to equity (in this particular example). If they go in the red, the drawdown will increase until we reach MC, and then to CO...

So, we should not oversaturate, we should watch the end, the exhaustion of the trend and either do not trade at all or reduce lots to minimum... I still do not have enough to check the idea of finding divergences and... I have written here recently asking for help, but... so far... nothing...

 
artmedia70:

When many positions are open on both sides and all of them are in the red, nothing much happens - we will assume that two oppositely directed losing positions when the price is between them adds or subtracts nothing - one tends to be more negative, the other to be more positive. Everything depends on newly opened positions. If they go to the profit, they will increase equity. When its amount becomes equal to the trigger level - the Expert Advisor will close all positions adding 5% profit to equity (in this particular example). If they go in the red, the drawdown will increase until we reach MC, and then to CO...

So, we should not oversaturate, we should watch the end, the exhaustion of the trend and either do not trade at all or reduce lots to minimum... I still do not have enough to check the idea of finding divergences and... I have written here recently asking for help, but... so far... nothing...


Sorry I didn't even finish reading it - but I have to ask straight away - is this strategy only for Eurobucks or for any pair?
 
Candid:

1. There is no problem with finding extrema - just feed the indicator to the input of some ZZ instead of the price. Of course, one should realize that the procedure for identifying extrema is fundamentally ambiguous. I remember I showed a picture in this form some time ago. Oh, I found it :)



2. I will not invent a picture, but I have been going to do the following for several years and cannot do it at all: a line is defined by two coefficients, let A and B. You create two arrays, A[] and B[], and a line counter, i. When you create a new line, enter A and B in A[i] and B[i] and increment the line count. If the line count exceeds the size of arrays, increment them or reset the counter (that is, start throwing out old lines in the order of their creation). The rest is simple, you calculate the current position of each line point in arrays A[] and B[] in the loop and check the intersection with the indicator line.

By the way, you should pay for a sample of future indicator as a fee :)


I didn't notice it straight away, for some reason... I'm sorry. Thanks...
I was wandering around the forum and came across an interesting idea - to determine divergences not by extremums, but by linear regression and if their comparison is minus, it means that a divergence has been found... Even a function was posted there:
//+------------------------------------------------------------------+
//| Линейная регрессия                                               |
//|    параметры:                                                    |
//|    Temp[]   - массив с данными индикатора                        |
//|    sym      - символ по которому считаем регрессию               |
//|    tf       - таймфрейм                                          |
//|    sb       - начальный бар                                      |
//|    eb       - количество баров для расчета регрессии             |
//|    flag     - переключает расчет цена/массив с данными индикатора|
//+------------------------------------------------------------------+
double LinearRegression(double Temp[],string sym, int tf, int sb, int eb, bool flag) {
   int i;
   double a,b,c,
          sumy=0.0,
          sumx=0.0,
          sumxy=0.0,
          sumx2=0.0;

   for(i=sb;i<eb+sb;i++) {
      if(flag) {
         sumy+=iClose(sym,tf,i);
         sumxy+=iClose(sym,tf,i)*(i-sb+1);
      }  else {
            sumy+=Temp[i-sb];
            sumxy+=Temp[i-sb]*(i-sb+1);
         }
      sumx+=(i-sb+1);
      sumx2+=(i-sb+1)*(i-sb+1);
   }
   
   c=sumx2*(eb-sb)-sumx*sumx;
   if(c==0.0) {
      Print("LinearRegression error: can\'t resolve equation");
      return;
   }
      
   b=(sumxy*(eb-sb)-sumx*sumy)/c;
   //a=(sumy-sumx*b)/(eb-sb+1);
   return(b);
}
//+------------------------------------------------------------------+
Now the only thing that remains is to understand and handle this miracle... Then I'll put my findings here... If I figure it out... I'm a dummy... :)
 
IgorM:

I'm sorry, I didn't even finish reading it - but I'll ask you right away - is this strategy only for Eurobucks or for any pair?
It doesn't care which pair to work with, as long as it's volatile... I've already written about its main drawback - large drawdowns. I've already written about its main drawback - large drawdowns. I haven't solved them yet. If I can create the function I need, I think it will be good... It doesn't only closes by equity, it includes total profit of all open positions and works with all TFs. In the example, only M5.
 
artmedia70:
It doesn't care what currency pair to work with, as long as it is volatile... I have already written about its major disadvantage - large drawdowns. I have not solved it yet. If I can create the function I need, I think it will be good... It doesn't only closes by equity, it includes total profit of all open positions and works with all TFs. In the example, only M5.


I have found the volatility, but my aim is to work with only one order

But I don't agree about a specific TF - if you are linked to a TF it means you are calculating by bars, if you are not linked to a TF it means you are calculating by price

 
IgorM:


I think we should cooperate then - I think I have found the volatility - but my goal is to work with just one order

I don't agree about a specific timeframe - if you are linked to a timeframe, it means you are calculating by bar, if you are not linked to a timeframe, it means you are calculating by price.

I do not have binding to a specific TF - all the calculations are based on the values on the first bar. It's just that each TF has its own calculation of target values and percentage of closing by total profit.
Reason: