Avalanche - page 520

 
DJDJ22:

There's no need for a story. We are gentlemen, we take your word for it. Just the results in the form of at least a month's worth of results. I don't really insist. Just like that:

Here tested on real from 17.04.2015-07.05.2015. This is the previous version, it didn't work for a month, I disabled it because I made a new improved netting version with less drawdown and put it on real on 14.05.2015.

 
khorosh:

Here was testing on real from 17.04.2015-07.05.2015. This is the previous version, month didn't work out, disabled it as I made a new improved netting version with less drawdown and put it on real on 14.05.2015.

Thanks. Just great for a martin. Good luck, I somehow parted with martin rather ignominiously. Decided not to dig.
 
khorosh:

How many winters, how many years). Congratulations on your return to Mother Russia! I'm back to the avalanche.


Thanks for the congratulations - Maya - if someone had asked me a year ago whether I believed that I would become part of Russia, I would have laughed, but here I had to drive around a bit :)

And how lucky we are compared to Donbass! ... Mozgovoy was killed, I met him here, shook his hand, came to visit us ... This is the third time I've changed my country of residence without leaving my couch :)

But here ... nothing changes...

I look - all new is well-forgotten old :) The world evolves in a spiral and we notice it so we get old...

 
elmucon:

Thanks for the congratulations - man - if man had been asked a year ago whether you believed you would become part of Russia, I would have laughed, but here you are ;_ I even had to drive around a bit :)

And how lucky we are compared to Donbass! ... Mozgovoy was killed, I met him here, shook his hand, came to visit us ... This is the third time I've changed my country of residence without leaving my couch :)

But here ... nothing changes...

Look - all new is well forgotten old :) The world is developing in a spiral and we notice it so we get old ...


++++++++
 
khorosh:

Here was testing on real from 17.04.2015-07.05.2015. This is the previous version, month didn't work out, disabled it as I made a new improved netting version with less drawdown and put it on real on 14.05.2015.

Yuri, good afternoon. Is the advisor working? You were talking about a secret formula for safely increasing the lot. Does it remain a secret? Have you developed an EA. I would like to add the calculation.

 
Gentlemen, I have a proposal. The value of the MA slope angle from one of the 1-2-3 timeframes is transmitted from the indicator to the Expert Advisor via the global variable of the terminal. Based on this value, you can take different lot increase multipliers for different directions in stop orders. This will help reduce drawdown and increase profits. It will also be possible to take different values of the virtual trailing stop during a flat and a trend, this is if the adviser grazes the total positive profit of a group of orders, or so that it works on different take profit values. And not to start a new series of orders when the slope is close to zero during a flat, it will be easy to set a small multiplier for increasing lots during a flat. I redid someone's indicator, it does its job, the value is transferred to any Expert Advisor through the global. The problem is that I'm a recent programmer and the indicator has been rewritten clumsily. It is necessary that the indicator can also be used for runs in the tester through iCustom (something needs to be done with the buffers, I myself will be thinking for a very long time). It may very well be that Avalanche's performance will improve from this. I also suggest evaluating the performance of different versions of the Avalanche by the value of dollars per hour of work per 0.01 lot initially set in the settings (SMDB - Broker Machine Milking Speed :-)©. Also the ratio of drawdown to this value. For many vehicles, this indicator is useful. Expert Advisors will be able to detect the beginning of a trend by the difference in angles between the EMA and SMA somewhere on the last 5---9 bars better than when using other indicators.
The indicator code is attached.
 //+------------------------------------------------------------------+
//|                                                   MA_Angle_E.mq4 |
//|                                                                  |
//+------------------------------------------------------------------+
/*


Период 13, 35 - значение порогового угла, ема.  На 5-минутках.
Можно 10 и 39.
*/
#property   copyright "Mr_A"
//---- indicator settings
#property   indicator_chart_window   
#property   indicator_buffers 5    
#property indicator_color1 Red
#property indicator_color2 LimeGreen
//#property  indicator_color1  LimeGreen
//#property  indicator_color2  Yellow
//#property  indicator_color3 FireBrick
#property   indicator_width1 1
#property   indicator_width2 2
//----
double CrossUp[];
double CrossDown[];
double prevtime;
double Range,AvgRange;
double fasterMAnow,fasterMAprevious,fasterMAafter;
double mediumMAnow,mediumMAprevious,mediumMAafter;
double slowerMAnow,slowerMAprevious,slowerMAafter;
//----
extern int FasterMA    =     5 ;
extern int FasterShift =   - 5 ;
extern int FasterMode= 1 ; // 0 = sma, 1 = ema, 2 = smma, 3 = lwma
extern int MediumMA    =   20 ;
extern int MediumShift =   - 5 ;
extern int MediumMode= 1 ; // 0 = sma, 1 = ema, 2 = smma, 3 = lwma
extern int SlowerMA    =   34 ;
extern int SlowerShift =     0 ;
extern int SlowerMode=     1 ; // 0 = sma, 1 = ema, 2 = smma, 3 = lwma
extern int SoundAlert=     1 ; // 0 = disabled
//#property  indicator_width3  

//---- indicator parameters
//extern int MAPeriod=21;
extern double MA_Period = 10 ;
extern double Coef = 0.0 ;
extern int SetPrice = 0 ;
//extern string  m = "--Moving Average Types--";
//extern string  m1 = " 1 = EMA";
//extern string  m2 = " 2 = SMMA";
//extern string  m3 = " 3 = LWMA";
//extern string  m4 = " 4 = LSMA";
extern int MA_Type = 1 ; //0=SMA, 1=EMA, 2=SMMA, 3=LWMA, 4=LSMA
//extern string  p0 = " 0 = close";
//extern string  p1 = " 1 = open";
//extern string  p2 = " 2 = high";
//extern string  p3 = " 3 = low";
//extern string  p4 = " 4 = median(high+low)/2";
//extern string  p5 = " 5 = typical(high+low+close)/3";
//extern string  p6 = " 6 = weighted(high+low+close+close)/4";
extern int MA_AppliedPrice = 0 ;   //0=close, 1=open, 2=high, 3=low, 4=median(high+low)/2, 5=typical(high+low+close)/3,
                                 //6=weighted(high+low+close+close)/4 --- способы расчёта значений
extern double AngleTreshold= 2 ; //чем больше значение, тем круче д.б. тренд для сигнала
extern int PrevMAShift= 1 ;
extern int CurMAShift= 0 ;

int MA_Mode;
string strMAType;
int ExtCountedBars= 0 ;   //сумма баров
//---- indicator buffers -- три массива буферов создаются
//double DownBuffer[];
//double ZeroBuffer[];
double LiniaBuffer[];
string GP_MA_E= "GV_GP_MA_E" ;
string GP_MA_S= "GV_GP_MA_S" ;
string GP_MA_Napr= "GV_GP_MA_Napr" ;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   GlobalVariableSet (GP_MA_E, 0 );
   GlobalVariableSet (GP_MA_S, 0 );
   GlobalVariableSet (GP_MA_Napr, 0 );
//---- 2 additional buffers are used for counting.
   IndicatorBuffers( 4 );   //было 3        
//---- drawing settings
   SetIndexStyle( 0 , DRAW_LINE );  
   SetIndexShift( 0 , 0 );
   IndicatorDigits(MarketInfo( Symbol (),MODE_DIGITS)+ 2 );   //IndicatorDigits      Установка формата точности (количество знаков
   //после десятичной точки) для визуализации значений индикатора.
   
   SetIndexStyle( 3 , DRAW_ARROW ,EMPTY); //0 заменил на 2
   SetIndexArrow( 3 , 233 );
   SetIndexBuffer ( 3 ,CrossUp);
   SetIndexStyle( 4 , DRAW_ARROW ,EMPTY); //1 заменил на 3
   SetIndexArrow( 4 , 234 );
   SetIndexBuffer ( 4 ,CrossDown);
                                                         
//********SetIndexShift(0, MA_Shift);

int draw_begin = 0 ;
SetIndexDrawBegin( 0 , draw_begin); // с какого элемента начинаются значимые данные индикаторного массива.
SetIndexBuffer ( 0 , LiniaBuffer); //сделали индик. массивом
//---- 3 indicator buffers mapping  --- карта буферов
 // if(!SetIndexBuffer(0,UpBuffer) && !SetIndexBuffer(1,DownBuffer) && !SetIndexBuffer(2,ZeroBuffer))
     // Print("cannot set indicator buffers!");
switch (MA_Type)
   {
       case 1 : strMAType= "EMA" ; MA_Mode= MODE_EMA ; break ;
       case 2 : strMAType= "SMMA" ; MA_Mode= MODE_SMMA ; break ;
       case 3 : strMAType= "LWMA" ; MA_Mode= MODE_LWMA ; break ;
       case 4 : strMAType= "LSMA" ; break ;
       default : strMAType= "SMA" ; MA_Mode= MODE_SMA ; break ;
   }
//---- name for DataWindow and indicator subwindow label
   //IndicatorShortName("MA_" + strMAType+"_Angle("+MA_Period+","+AngleTreshold+","+PrevMAShift+","+CurMAShift+")");
   return ( 0 );
      
} /*
//+------------------------------------------------------------------+
//| LSMA with PriceMode                                              |
//| PrMode  0=close, 1=open, 2=high, 3=low, 4=median(high+low)/2,    |
//| 5=typical(high+low+close)/3, 6=weighted(high+low+close+close)/4  |
//+------------------------------------------------------------------+
double LSMA(int Rperiod, int prMode, int shift)
{
   int i, mshift;
   double sum, pr;
   int length;
   double lengthvar;
   double tmp;
   double wt;

   length = Rperiod;
 
   sum = 0;
   for(i = length; i >= 1  ; i--)
   {
     lengthvar = length + 1;
     lengthvar /= 3;
     tmp = 0;
     mshift = length-i+shift;
     switch (prMode)
     {
     case 0: pr = Close[mshift];break;
     case 1: pr = Open[mshift];break;
     case 2: pr = High[mshift];break;
     case 3: pr = Low[mshift];break;
     case 4: pr = (High[mshift] + Low[mshift])/2;break;
     case 5: pr = (High[mshift] + Low[mshift] + Close[mshift])/3;break;
     case 6: pr = (High[mshift] + Low[mshift] + 2 * Close[mshift])/4;break;
     }
     tmp = ( i - lengthvar)*pr;
     sum+=tmp;
    }
    wt = MathFloor(sum*6/(length*(length+1))/Point)*Point;
    return(wt);
}*/
//+------------------------------------------------------------------+
//| The angle for MA                                                |
//+------------------------------------------------------------------+
int start()
{
   double fCurMA, fPrevMA;
   double fCurMA_S, fPrevMA_S;
   double fAngle, fAngle_S, mFactor, dFactor; //mFactor - множитель для йены либо остальных валют
   int nLimit, i, n;                   //dFactor - величина обратная радиану
   int nCountedBars;
   ExtCountedBars = IndicatorCounted();
   if (ExtCountedBars < 0 ) return (- 1 );
   if (ExtCountedBars > 0 ) ExtCountedBars--;
   ema();
   //double angle;  //не использовано
   int ShiftDif;
   string Sym;
   if (CurMAShift >= PrevMAShift)
   {
       Print ( "Error: CurMAShift >= PrevMAShift" );
      PrevMAShift = 6 ;
      CurMAShift = 0 ;      
   }  
   nCountedBars = IndicatorCounted(); //Функция возвращает кол-во баров, не измененных после посл. вызова индикатора.
   if (nCountedBars< 0 ) 
       return (- 1 );
   if (nCountedBars> 0 ) 
      nCountedBars--; //---- last counted bar will be recounted
   nLimit = Bars -nCountedBars; //Bars - количество баров на текущем графике;
   dFactor = 3.14159 / 180.0 ;
   mFactor = 1000.0 ;
   Sym = StringSubstr ( Symbol (), 3 , 3 ); //отрезание первых трёх символов из названия пары
   if (Sym == "JPY" ) mFactor = 10.0 ;   //для йены свои особенные настройки
   ShiftDif = PrevMAShift-CurMAShift;   //на сколько значение изменилось
   for (i= 0 ; i<nLimit; i++) //---- main loop
   {
       if (MA_Type == 4 ) //не использовать
      {
         //fCurMA=LSMA(MA_Period,MA_AppliedPrice, i+CurMAShift);   //текущее значение 
         //fPrevMA=LSMA(MA_Period,MA_AppliedPrice, i+PrevMAShift); //предыдущее значение
      }
       else //вот это использовать
      {
        fCurMA= iMA ( NULL , 0 ,MA_Period, 0 ,MA_Mode,MA_AppliedPrice,i+CurMAShift); //значения для текущего
        fPrevMA= iMA ( NULL , 0 ,MA_Period, 0 ,MA_Mode,MA_AppliedPrice,i+PrevMAShift); //и предыдущего баров
      }
      fAngle = (fCurMA - fPrevMA)/ShiftDif;   //здесь тангенс угла получается
       // take ArcTan of value to get the angle in radians and convert to degrees
      fAngle = mFactor * MathArctan (fAngle) / dFactor * F146_Koeff(); //тут сам угол высчитывается; 
       if (i == 0 )
      {
         GlobalVariableSet (GP_MA_E, fAngle);
      }
   }
   nCountedBars = IndicatorCounted(); //Функция возвращает кол-во баров, не измененных после посл. вызова индикатора.
   if (nCountedBars< 0 ) 
       return (- 1 );
   if (nCountedBars> 0 ) 
      nCountedBars--; //---- last counted bar will be recounted
   nLimit = Bars -nCountedBars; //Bars - количество баров на текущем графике;
   ShiftDif = PrevMAShift-CurMAShift;   //на сколько значение изменилось
   for (n= 0 ; n<nLimit; n++)
   {
      fCurMA_S= iMA ( NULL , 0 ,MA_Period, 0 , MODE_SMA ,MA_AppliedPrice,n+CurMAShift); //значения для текущего
      fPrevMA_S= iMA ( NULL , 0 ,MA_Period, 0 , MODE_SMA ,MA_AppliedPrice,n+PrevMAShift); //и предыдущего баров//MODE_SMA
      fAngle_S = (fCurMA_S - fPrevMA_S)/ShiftDif;   //здесь тангенс угла получается
      fAngle_S = mFactor * MathArctan (fAngle_S) / dFactor * F146_Koeff(); //тут сам угол высчитывается
       if (n == 0 )
      {
         GlobalVariableSet (GP_MA_S, fAngle_S);
      }
   }
   //второй индикатор------------------------------ - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   int d,counter;
   int counted_bars=IndicatorCounted();
   if (counted_bars< 0 ) return (- 1 );
   if (counted_bars> 0 ) counted_bars--;
   int limit= Bars -counted_bars;
   if (counted_bars== 0 ) limit-= 1 + 9 ;
//----   
   for (d= 0 ; d<=limit; d++)
     {
      counter=d;
      Range= 0 ;
      AvgRange= 0 ;
       for (counter=d;counter<=d+ 9 ;counter++)
        {
         AvgRange=AvgRange+ MathAbs (High[counter]-Low[counter]);
        }
      Range=AvgRange/ 10 ;
       //----       
      fasterMAnow      = iMA ( NULL , 0 , FasterMA, FasterShift, FasterMode, PRICE_CLOSE , d+ 1 );
      fasterMAprevious = iMA ( NULL , 0 , FasterMA, FasterShift, FasterMode, PRICE_CLOSE , d+ 2 );
      fasterMAafter    = iMA ( NULL , 0 , FasterMA, FasterShift, FasterMode, PRICE_CLOSE , d- 1 );
       //----      
      mediumMAnow      = iMA ( NULL , 0 , MediumMA, MediumShift, MediumMode, PRICE_CLOSE , d+ 1 );
      mediumMAprevious = iMA ( NULL , 0 , MediumMA, MediumShift, MediumMode, PRICE_CLOSE , d+ 2 );
      mediumMAafter    = iMA ( NULL , 0 , MediumMA, MediumShift, MediumMode, PRICE_CLOSE , d- 1 );
       //----      
      slowerMAnow      = iMA ( NULL , 0 , SlowerMA, SlowerShift, SlowerMode, PRICE_CLOSE , d+ 1 );
      slowerMAprevious = iMA ( NULL , 0 , SlowerMA, SlowerShift, SlowerMode, PRICE_CLOSE , d+ 2 );
      slowerMAafter    = iMA ( NULL , 0 , SlowerMA, SlowerShift, SlowerMode, PRICE_CLOSE , d- 1 );
       //----      
       if ((fasterMAnow>slowerMAnow && 
         fasterMAprevious<=slowerMAprevious && 
         fasterMAafter>slowerMAafter && 
         mediumMAnow>slowerMAnow)
         || 
         (fasterMAnow>slowerMAnow && 
         mediumMAnow>slowerMAnow && 
         mediumMAprevious<=slowerMAprevious && 
         mediumMAafter>slowerMAafter))
        {
         CrossUp[d]=Low[i]-Range* 0.5 ;
        }
       if ((fasterMAnow<slowerMAnow && 
         fasterMAprevious>=slowerMAprevious && 
         fasterMAafter<slowerMAafter && 
         mediumMAnow<slowerMAnow)
         || 
         (fasterMAnow<slowerMAnow && 
         mediumMAnow<slowerMAnow && 
         mediumMAprevious>=slowerMAprevious && 
         mediumMAafter<slowerMAafter))
        {
         CrossDown[d]=High[i]+Range* 0.5 ;
        }
     }
   if ((CrossUp[ 0 ]> 2000 ) && (CrossDown[ 0 ]> 2000 )) { prevtime= 0 ; }
   if ((CrossUp[ 0 ]==Low[ 0 ]-Range* 0.5 ) && (prevtime!=Time[ 0 ]) && (SoundAlert!= 0 ))
   
     {
      prevtime=Time[ 0 ];
       Alert ( Symbol (), " 3 MA Cross Up @  Hour " ,Hour(), "  Minute " ,Minute());
       //глобалку менять здесь
     }
   if ((CrossDown[ 0 ]==High[ 0 ]+Range* 0.5 ) && (prevtime!=Time[ 0 ]) && (SoundAlert!= 0 ))
     {
      prevtime=Time[ 0 ];
       Alert ( Symbol (), " 3 MA Cross Down @  Hour " ,Hour(), "  Minute " ,Minute());
       //глобалку менять здесь
     }
//Comment("  CrossUp[0]  ",CrossUp[0]," ,  CrossDown[0]  ",CrossDown[0]," ,  prevtime  ",prevtime);
//Comment("");
   return ( 0 );
  }
//------------------------------------------------------------
void ema() {
   double pr;  
   if (Coef == 0.0 ) { 
      pr = 2.0 /(MA_Period+ 1 );
   } else {
      pr = Coef;
   }
   int pos = Bars - 2 ;
   if (ExtCountedBars > 2 ) pos = Bars - ExtCountedBars - 1 ;
//---- main calculation loop
   while (pos >= 0 ) {
       if (pos == Bars - 2 ) 
         LiniaBuffer[pos+ 1 ] = (Open[pos+ 1 ]+Close[pos+ 1 ])/ 2 ;
      LiniaBuffer[pos] = GetPrice(pos)*pr+LiniaBuffer[pos+ 1 ]*( 1 -pr);
           pos--;
   }
}


//-------------------------------------------------------------------------------------------------------------------

//+------------------------------------------------------------------+
double GetPrice( int Shift) {
   double price;
//----
   switch (SetPrice) {
       case 0 :  price = Close[Shift]; break ;
       case 1 :  price = Open[Shift]; break ;
       case 2 :  price = High[Shift]; break ;
       case 3 :  price = Low[Shift]; break ;
       case 4 :  price = (High[Shift]+Low[Shift])/ 2.0 ; break ;
       case 5 :  price = (High[Shift]+Low[Shift]+Close[Shift])/ 3.0 ; break ;
       case 6 :  price = (High[Shift]+Low[Shift]+ 2 *Close[Shift])/ 4.0 ; break ;
       case 7 :  price = (Open[Shift]+High[Shift]+Low[Shift]+Close[Shift])/ 4.0 ; break ;
       case 8 :  price = (Open[Shift]+Close[Shift])/ 2.0 ; break ;
       default : price = 0.0 ;
   }
//----
   return (price);
}
//=====================================================================================================//
//     ------------------ F146___ПОПРАВОЧНЫЕ КОЭФФИЦИЕНТЫ ДЛЯ РАЗНЫХ ТАЙМФРЕЙМОВ ------------------- 
//=====================================================================================================//
double F146_Koeff()
{
   switch ( Period ())
   {
       case PERIOD_M1 :     return ( 12.0 );
       case PERIOD_M5 :     return ( 12.0 );
       case PERIOD_M15 :   return ( 2.5 );
       case PERIOD_M30 :   return ( 0.8 );
       case PERIOD_H1 :     return ( 0.33 );
       case PERIOD_H4 :     return ( 0.55 );
       case PERIOD_D1 :     return ( 0.15 );
       case PERIOD_W1 :     return ( 0.2 );
       case PERIOD_MN1 :   return ( 0.09 );
   }
}
 
Ftor_007:
Gentlemen, I have this suggestion. The indicator sends to the EA via a global variable of the terminal the value of the MA slope angle from one of 1-2-3 timeframes. On the basis of this value we can take different multipliers of lot increase for different directions in stop orders. It will help to decrease the drawdown and increase the profit. You can also take different values of the virtual trailing stop for a flat and a trend, if the Expert Advisor grabs the total profit of a group of orders or if it works with different Take Profit values. And we should not start a new series of orders when the angle of slope is close to zero during the flat. I have redesigned someone's indicator; the value is passed to any EA through global. The problem is that I have been programming recently and the indicator is poorly rewritten. It is necessary to enable the indicator to be used in the tester via iCustom (I should do something with buffers, it will take me too long to figure it out). It may very well be that Avalanche's performance will improve from this. I also propose to evaluate the performance of different versions of Avalanche by the value of dollars per hour of work per 0.01 lot initially set in the settings (CMDB - Machine Milking Broker Speed :-)©. Also the ratio of drawdown to this value.
The code of the indicator is attached.
The wife of my classmate in difficult but cheerful 90s was interrogating: "Don't tell me about the consumption of petrol per 100 km, tell me, what is the consumption of the car in rubles per day?
 
Jokes are jokes, but for this TS it is possible to strengthen the protection against losing a deposit and increase profitability. All it takes is less flooding and more code.
 
Ftor_007:
The joke is on me, but for this TS it is possible to strengthen the protection against losing a deposit and increase the profitability. All you need for this is less flooding, more code.

Let's divide the duties: I do less fluffing, you do more coding.

I almost forgot: I am ready to help you with programming, if you do not succeed.

 

The drawdown has become much lower with two order corridors - external and internal, respectively with geometric and arithmetic progression of the lot growth. During a flat, a large set of lot amounts does not occur anymore, the probability of MC also decreases. USDJPY gives the best results. As soon as I will be able to insert indicator into expert function, I will try to increase profitability. Deposit in the tester was set at $70, lot 0.01.