[Archive] Learn how to make money villagers! - page 659

 
Roman.:

Interesting solution - averaging over time... I meant the multiplication coefficient between the averaging orders how do we calculate? what is the lot to open the 1st averaging order, the 2nd averaging order...? where is the coefficient? The first start order is opened with an MM based on the deposit size - that much is clear...
All others, too, with the same MM, if we get profit at once, the scaling in is done with a larger lot, if we have gone into drawdown, the smaller one, so as not to load the deposit, and a trailing stop may be used to connect all orders from the breakeven point.
 
Roman.:

Interesting solution - averaging over time... I mean the multiplication factor between the averaging orders how do we calculate? what is the lot to open the 1st averaging order, the 2nd averaging order...? where is the factor? The first start order - with MM of the deposit size - is clear...

A difficult task and it boils down to calculating the amount of collateral based on the maximum number and total volume of open orders.

I now apply the formula:

MiniLot^(x^0)+MiniLot^(x^1)+MiniLot^(x^2) ... + MiniLot^(x^(N-1))=VolMax,

where N is the maximum expected number of orders,

VolMax-maximum possible total volume of all N orders

But so far I have found x by a simple search.

Maybe someone knows the solution to this equation where only x is unknown?

 
new-rena:

Look at the 30 year history. Where have you seen a super trend? What are you afraid of? You may determine by software how many pips it will be and that's it.

I even showed the insides of the turkey (1-5 pages ago).


By the way, here's the Calculation of the maximal backfree movement from the dickfx: see here. From there we have to calculate, i.e. divide this distance by the number (maximal) of averaging positions - as the result we obtain the averaging step for taking profit when the pullback happens. You can set the dates - you can use the maximal depth of quotes history that your brokerage company provides for the chosen symbol.

What's the most characteristic - I transferred this function to my owl in the init function - it doesn't count somehow... Run the script for execution - different (closer to reality) value...

Watching. Eliminate errors when transferring this script to my owl... Further, we simply divide this value in pps by the maximal number of averaging orders = averaging step using variables in the ops start.

#property show_inputs

extern int MinPips = 100;
extern datetime StartTime = D'2010.01.01';
extern datetime EndTime = D'2011.01.01';

#define MAX_POINTS 10000

// Заполняет массив размерами колен ЗигЗага с условием колена >= MinPips пунктов
int GetZigZagData( int MinPips, datetime& StartTime, datetime& EndTime, int& Data[] )
{
  bool FlagUP = TRUE;
  int Pos = iBarShift(Symbol(), Period(), StartTime);
  int PosEnd = iBarShift(Symbol(), Period(), EndTime);
  int Max = High[Pos] / Point + 0.1;
  int Min = Low[Pos] / Point + 0.1;
  int Count = 0;
  int PriceHigh, PriceLow;
 
  StartTime = Time[Pos];
  EndTime = Time[PosEnd];
  
  ArrayResize(Data, MAX_POINTS);

  Pos--;
  
  while (Pos >= PosEnd)
  {
    PriceHigh = High[Pos] / Point + 0.1;
    PriceLow = Low[Pos] / Point + 0.1;   

    if (FlagUP)
    {
      if (PriceHigh > Max)
        Max = PriceHigh;
      else if (Max - PriceLow >= MinPips)
      {
        Data[Count] = Max - Min;
        Count++;
        
        FlagUP = FALSE;
        Min = PriceLow;
      }
    }
    else
    {
      if (PriceLow < Min)
        Min = PriceLow;
      else if (PriceHigh - Min >= MinPips)
      {
        Data[Count] = Max - Min;
        Count++;
        
        FlagUP = TRUE;
        Max = PriceHigh;
      }
    }
    
    Pos--;
  }
  
  ArrayResize(Data, Count);
    
  return(Count);
}

void start()
{
  int ZigZagData[];
  int Amount = GetZigZagData(MinPips, StartTime, EndTime, ZigZagData);
  
  ArraySort(ZigZagData);
  
  Print("На интервале " + TimeToStr(StartTime) + " - " + TimeToStr(EndTime) +
        " максимальное безоткатное (> " + MinPips +
        " пунктов) движение " + ZigZagData[Amount - 1] + " пунктов.");
        
  return;
}
 
BeerGod:
All other orders also use the same MM, if I go straight to the profit, then scale in with a larger lot, if I go into drawdown, then scale in a smaller lot in order not to overload the deposit and trailing stop is used to connect all orders from the breakeven point.

Would you post the code?
 
Roman.:

in the code - can you post it?
On the previous page the function code is
LotsOptimized()
OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,stop,Ask+Takeprofit*Point,"",MagicNumber,0,Green);
 
new-rena:

Well look at 30 years of history. Where have you seen a super-trend? What is there to be afraid of. Define by software how many pips it will be and that's it.

I even showed you the insides of the indyuk (1-5 pages ago).

Yes, I understand about pips, trends and the indicator. Thank you! Only one more question about directions (Buy/Sell) - which one is taken, how do they change?
 
mt4trade:
Yes, about the points, trends and the inductor is clear. Thank you!!! Another question about directions (Buy/Sell) - which one do we take, how do they change?

I don't know which one is indicated by the indicator. In other words, we start BUY, so we go in the same direction. As they say, who's the first, is the father.

We'll look at the direction again when we once again close a series of unidirectional orders plus))).

 
BeerGod:
On the previous page the function code


I see. I'm not going to check it right now in the owl (it even has the same function by name) - just replace it (that one) with this one (yours)... I'll have a closer look later...

Write in a line the approximate lots for the averaging orders for a starting date, e.g. 10,000 units of currency. 10.000 currency units, i.e:

0. starting volume = 0.01 lot.

1st averaging market = 0.02 lot.

3rd averaging market = 0.03 lot.

4th = 0.05 lot.

5th = 0.09 lot

6

7

8

9

And the next averaging order should be placed after 900 sec. after the opening of the previous averaging market order, if all previous single-directional start and averaging orders were losing?

 
Roman.:

Thank you, Renat, for your answer.

...How is that?

If you know, please write the solution to this equation through logarithms and I tell you further...

I now apply the formula:

MiniLot^(x^0)+MiniLot^(x^1)+MiniLot^(x^2) ... + MiniLot^(x^(N-1))=VolMax,

where N is the maximal possible number of orders (),

VolMax-maximum possible total volume of all N orders (Depo/MarketInfo(Instr,MODE_MARGINREQUIRED))

but so far I have found x by a simple enumeration

Does anyone know the solution to this equation where only x is unknown?
 
new-rena:

If you know, please write down the solution to this equation via logarithms and I tell the rest...

I now apply the formula:

MiniLot^(x^0)+MiniLot^(x^1)+MiniLot^(x^2) ... + MiniLot^(x^(N-1))=VolMax,

where N is the maximal possible number of orders (),

VolMax-maximum possible total volume of all N orders (Depo/MarketInfo(Instr,MODE_MARGINREQUIRED))

but so far I have found x by a simple enumeration

Does anyone know the solution to this equation where only x is unknown?

Asked the question in the relevant thread - see this thread. I don't know myself, it's been a long time since I've had a "high school"... :-)
Reason: