Walstreet.lv
Jaunākais forumāPalīdzībaLietošanas noteikumiReģistrācijaAizmirsu paroliLogin
Forumu saraksts/Hard & Soft/Indikators MT4 platformai
Lapas:12next
uldids
Pievienots: 20.04.2006
Ziņojumi: 54
Indikators MT4 platformai
11.07.2006 14:43
//+------------------------------------------------------------------+
//|                                                    FN Signal.mq4 |
//|                                                          Belomor |
//|                                                 |
//+------------------------------------------------------------------+
#property copyright "Belomor"
#property link      ""

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Silver
//---- input parameters
extern int       FN=34;
extern double    Deviation=3.0;
extern int       FastEMA=23;
extern int       SlowEMA=230;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(4);
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,3);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,3);
   SetIndexStyle(2,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexBuffer(3,ExtMapBuffer4);
   if(FN<2)
   FN=2;
   if(Deviation<0)
   Deviation=1;
   if(FastEMA<1)
   FastEMA=1;
   if(SlowEMA<1)
   SlowEMA=1;
   IndicatorShortName("FNCD ("+FN+","+FastEMA+","+SlowEMA+")");
   SetIndexDrawBegin(0,FN+SlowEMA);
   SetIndexDrawBegin(1,FN+SlowEMA);
   SetIndexLabel(0,"FN Up");
   SetIndexLabel(1,"FN Down");
   SetIndexEmptyValue(0,0);
   SetIndexEmptyValue(1,0);
   IndicatorDigits(4);
//----
   return(0);
  }
 
double NormalizedX(int F_period, int i)
   {
   double result;
   double A;
   double S;
   double C;
   if(i<Bars-F_period)
   {
   C=Close[i];
   A=iMA(NULL,0,F_period,0,MODE_SMA,PRICE_CLOSE,i);
   S=iStdDev(NULL,0,F_period,MODE_SMA,0,PRICE_CLOSE,i);
   result=(C-A)/S;
   }
   else
   result=0;
   return(result);
   }
  
double FisherNormalizedX(int F_period, double Dev, int i)
   {
   double result;
   double X;
   if(i<Bars-F_period && Dev>0)
   {
   X=NormalizedX(F_period,i)/Dev;
   if(X>0.99)
   X=0.99;
   if(X<-0.99)
   X=-0.99;
   result=0.5*MathLog((1+X)/(1-X));
   }
   else
   result=0;
   return(result);
   }
  
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   for(int i=0; i<limit; i++)
      ExtMapBuffer4[i]=FisherNormalizedX(FN,Deviation,i);
   for(i=0; i<limit; i++)
      ExtMapBuffer3[i]=iMAOnArray(ExtMapBuffer4,Bars,SlowEMA,0,MODE_EMA,i);
   for(i=0; i<limit; i++)
      {
      if(iMAOnArray(ExtMapBuffer4,Bars,FastEMA,0,MODE_EMA,i)>ExtMapBuffer3[i])
         {
         ExtMapBuffer1[i]=iMAOnArray(ExtMapBuffer4,Bars,FastEMA,0,MODE_EMA,i);
         ExtMapBuffer2[i]=0;
         }
      else
         {
         ExtMapBuffer1[i]=0;
         ExtMapBuffer2[i]=iMAOnArray(ExtMapBuffer4,Bars,FastEMA,0,MODE_EMA,i);
         }
      }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+
uldids
Pievienots: 20.04.2006
Ziņojumi: 54
Re: Indikators MT4 platformai
11.07.2006 14:45
Pamēģiniet šo indikatoru.  Labus rezultātus tas rāda M30 ar dažiem valūtu pāriem, bet īpaši ar USD/JPY, bet vislabāk ar USD indeksu.
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Indikators MT4 platformai
12.07.2006 21:28
Tu esi testejis uz vesturi kaadu sistemu, kas balstita uz so indikatoru?
uldids
Pievienots: 20.04.2006
Ziņojumi: 54
Re: Indikators MT4 platformai
12.07.2006 21:55
USD indeksu M30, vienkārši superīgi
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Indikators MT4 platformai
17.07.2006 09:54
ja nav noslepums kaa Tu testeji .. ar Experts Advisor palidzibu vai kaa savaadak?
uldids
Pievienots: 20.04.2006
Ziņojumi: 54
Re: Indikators MT4 platformai
17.07.2006 17:22
manuāli, atkārtoju bāru pēc pāra.
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Indikators MT4 platformai
18.07.2006 22:06
nju skaidrs. bus laicins .. obligati paskatisu. Bet te vismaz tas algoritms skiet taads daudzmaz saprotams un domaju nebutu problemu uz sii indikatora pamata arii EA uztaisit. Toties pavisam nesen manas rokaas nonaaca JMA (Jurik Moving Average) priekss MT4. Velns .. luuk tas nu gan ir sarezgiti izveidots indikators. 
uldids
Pievienots: 20.04.2006
Ziņojumi: 54
Re: Indikators MT4 platformai
19.07.2006 21:24
Uztaisi gan, varbūt, ka noder. Bet tas JMA ir derīgs indikators.?  Tev jau nav liela kolekcija ar ekspertiem?
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Indikators MT4 platformai
19.07.2006 21:59
vai deriigs indikators? smile He .. labs jautaajums. Es varetu teikt taa .. deriigs ir pat "visnederigakais" indikators, ja vien var atrast kur un kaa to labi piemerot wink
 Katraa zinjaa sis te JMA ir Moving Average tipa indikators vienigi, ka ar sarezgitu algoritmu. Ja kas varu izlikt to seit .. varesi papetit.
 Kas attiecas uz expertu kolekciju, tad nemaz tik liela taa i nav. Jo parsvaraa pats buveju savus expertus .. inetaa katraa zinjaa lidz sim neko izcilu neesmu atradis. Inetaa vairak aizgustu vnk idejas vai arii kaadus indikatorus dazreiz papeetu.
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Indikators MT4 platformai
19.07.2006 22:00
//+------------------------------------------------------------------+
//|                                                          JMA.mq4 |
//|                                             Weld, Jurik Research |
//|                                          http://weld.torguem.net |
//+------------------------------------------------------------------+
#property copyright "Weld"
#property link      "http://weld.torguem.net"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Aqua
//---- input parameters
int       Length = 14;
int       Phase  = 0;
//---- buffers
double JMAValueBuffer [];
double fC0Buffer [];
double fA8Buffer [];
double fC8Buffer [];
//---- temporary buffers
double list[128], ring1[128], ring2[11], buffer[62];
//---- bool flag
bool   initFlag;
//---- integer vars
int    limitValue, startValue, loopParam, loopCriteria;
int    cycleLimit, highLimit, counterA, counterB;
//---- double vars
double cycleDelta, lowDValue, highDValue, absValue, paramA, paramB;
double phaseParam, logParam, JMAValue, series, sValue, sqrtParam, lengthDivider;
//---- temporary int variables
int   s58, s60, s40, s38, s68;
//+------------------------------------------------------------------+
//| JMA initFlagization function                                     |
//+------------------------------------------------------------------+
int init()
  {
   double   lengthParam;
//---- 3 additional buffers are used for counting.
   IndicatorBuffers(4);
//---- drawing settings
   SetIndexStyle  (0, DRAW_LINE);
   SetIndexDrawBegin(0, 30);
//---- 4 indicator buffers mapping
   SetIndexBuffer (0, JMAValueBuffer);
   SetIndexBuffer (1, fC0Buffer);
   SetIndexBuffer (2, fA8Buffer);
   SetIndexBuffer (3, fC8Buffer);
//---- initialize one buffer (neccessary)   
   ArrayInitialize (ring2, 0);
   ArrayInitialize (ring1, 0);
   ArrayInitialize (buffer, 0);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName ("JMAValue(" + Length + "," + Phase + ")");
   SetIndexLabel (0, "JMAValue");
//---- initial part
   limitValue = 63;
   startValue = 64;
//----   
   for (int i = 0; i <= limitValue; i++) list [i] = -1000000;
   for (i = startValue; i <= 127; i++)   list [i] = 1000000;
//----
   initFlag  = true;
   if (Length < 1.0000000002) lengthParam = 0.0000000001;
   else lengthParam = (Length - 1) / 2.0;
//----   
   if (Phase < -100) phaseParam = 0.5;
   else if (Phase > 100) phaseParam = 2.5;
   else phaseParam = Phase / 100.0 + 1.5;
//----   
   logParam = MathLog (MathSqrt (lengthParam)) / MathLog (2.0);
//----
   if (logParam + 2.0 < 0) logParam = 0;
   else logParam = logParam + 2.0;
//----
   sqrtParam     = MathSqrt(lengthParam) * logParam;
   lengthParam   = lengthParam * 0.9;
   lengthDivider = lengthParam / (lengthParam + 2.0);
//----  
   return;
}
//+------------------------------------------------------------------+
//| JMA iteration function                                           |
//+------------------------------------------------------------------+
int start()
  {

//---- get already counted bars    
   int counted_bars = IndicatorCounted();
//---- check for possible errors
   if (counted_bars < 0) return (-1);
   int limit = Bars - counted_bars - 1;
//---- main cycle
   for (int shift = limit; shift >= 0; shift--) {
      series = Close [shift];
 
      if (loopParam < 61) {
         loopParam++;
         buffer [loopParam] = series;
      }
      if (loopParam > 30) {
         if (initFlag) {
            initFlag = false;
            
            int diffFlag = 0;
            for (int i = 1; i <= 29; i++) {
               if (buffer [i + 1] != buffer [i]) diffFlag = 1;
            } 
            highLimit = diffFlag * 30;
            
            if (highLimit == 0) paramB = series;
            else paramB = buffer[1];
            
            paramA = paramB;
            if (highLimit > 29) highLimit = 29;
         } else
            highLimit = 0;
//---- big cycle
         for (i = highLimit; i >= 0; i--) {
               if (i == 0) sValue = series; else sValue = buffer [31 - i];
       
               if (MathAbs (sValue - paramA) > MathAbs (sValue - paramB)) absValue = MathAbs(sValue - paramA); else absValue = MathAbs(sValue - paramB);
               double dValue = absValue + 0.0000000001; //1.0e-10;
   
               if (counterA <= 1) counterA = 127; else counterA--;
               if (counterB <= 1) counterB = 10;  else counterB--;
               if (cycleLimit < 12eek cycleLimit++;
               cycleDelta += (dValue - ring2 [counterB]);
               ring2 [counterB] = dValue;
               if (cycleLimit > 10) highDValue = cycleDelta / 10.0; else highDValue = cycleDelta / cycleLimit;
              
               if (cycleLimit > 127) {
                   dValue = ring1 [counterA];
                   ring1 [counterA] = highDValue;
                   s68 = 64; s58 = s68;
                   while (s68 > 1) {
                       if (list [s58] < dValue) {
                           s68 = s68 / 2.0;
                           s58 += s68;
                       } else
                       if (list [s58] <= dValue) {
                           s68 = 1;
                       } else {
                           s68 = s68 / 2.0;
                           s58 -= s68;
                       }
               }
            } else {
                  ring1 [counterA] = highDValue;
                  if ((limitValue + startValue) > 127) {
                      startValue--;
                      s58 = startValue;
                  } else {
                      limitValue++;
                      s58 = limitValue;
                  }
                  if (limitValue > 96) s38 = 96; else s38 = limitValue;
                  if (startValue < 32) s40 = 32; else s40 = startValue;
              }
//----             
              s68 = 64;
              s60 = s68;
              while (s68 > 1) {
                  if (list [s60] >= highDValue) {
                      if (list [s60 - 1] <= highDValue) {
                          s68 = 1;
                      }
                      else {
                          s68 = s68 / 2.0;
                          s60 -= s68;
                      }
                  }
                  else {
                      s68 = s68 / 2.0;
                      s60 += s68;
                  }
                  if ((s60 == 127) && (highDValue > list[127])) s60 = 128;
              }
               if (cycleLimit > 127) {
                   if (s58 >= s60) {
                       if (((s38 + 1) > s60) && ((s40 - 1) < s60))
                            lowDValue += highDValue;
                       else if ((s40 > s60) && ((s40 - 1) < s5eek)
                            lowDValue += list [s40 - 1];
                   }
                   else if (s40 >= s60) {
                       if (((s38 + 1) < s60) && ((s38 + 1) > s5eek)
                                lowDValue += list[s38 + 1];
                    }
                   else if ((s38 + 2) > s60)
                           lowDValue += highDValue;
                   else if (((s38 + 1) < s60) && ((s38 + 1) > s5eek)
                           lowDValue += list[s38 + 1];
           
                   if (s58 > s60) {
                       if (((s40 - 1) < s5eek && ((s38 + 1) > s5eek)
                           lowDValue -= list [s58];
                       else if ((s38 < s5eek && ((s38 + 1) > s60))
                           lowDValue -= list [s38];
                   }
                   else {
                       if (((s38 + 1) > s5eek && ((s40 - 1) < s5eek)
                           lowDValue -= list [s58];
                       else if ((s40 > s5eek && (s40 < s60))
                           lowDValue -= list [s40];
                   }
               }
               if (s58 <= s60) {
                   if (s58 >= s60) list[s60] = highDValue; else {
                       for (int j = s58 + 1; j <= (s60 - 1); j++) {
                           list [j - 1] = list[j];
                       }
                       list [s60 - 1] = highDValue;
                   }
               } else {
                   for (j = s58 - 1; j >= s60; j--) {
                       list [j + 1] = list [j];
                   }
                   list [s60] = highDValue;
               }
           
               if (cycleLimit <= 127) {
                   lowDValue = 0;
                   for (j = s40; j <= s38; j++) {
                       lowDValue += list[j];
                   }
               }
//----               
               if ((loopCriteria + 1) > 31) loopCriteria = 31; else loopCriteria++;
               double JMATempValue, sqrtDivider = sqrtParam / (sqrtParam + 1.0);
              
               if (loopCriteria <= 30) {
                   if (sValue - paramA > 0) paramA = sValue; else paramA = sValue - (sValue - paramA) * sqrtDivider;
                   if (sValue - paramB < 0) paramB = sValue; else paramB = sValue - (sValue - paramB) * sqrtDivider;
                   JMATempValue = series;
                 
                   if (loopCriteria == 30) {
                     fC0Buffer [shift] = series;
                     int intPart;
                     
                     if (MathCeil(sqrtParam) >= 1) intPart = MathCeil(sqrtParam); else intPart = 1;
                     int leftInt = IntPortion (intPart);
                     if (MathFloor(sqrtParam) >= 1) intPart = MathFloor(sqrtParam); else intPart = 1;
                     int rightPart = IntPortion (intPart);
                    
                     if (leftInt == rightPart) dValue = 1.0;
                     else
                         dValue = (sqrtParam - rightPart) / (leftInt - rightPart);
                
                     if (rightPart <= 29) int upShift = rightPart; else upShift = 29;
                     if (leftInt <= 29) int dnShift = leftInt; else dnShift = 29;
                     fA8Buffer [shift] = (series - buffer [loopParam - upShift]) * (1 - dValue) / rightPart + (series - buffer[loopParam - dnShift]) * dValue / leftInt;
               }
               } else {
                  double powerValue, squareValue;
                 
                  dValue = lowDValue / (s38 - s40 + 1);
                  if (0.5 <= logParam - 2.0) powerValue = logParam - 2.0;
               else powerValue = 0.5;
              
                   if (logParam >= MathPow(absValue/dValue, powerValue)) dValue = MathPow (absValue/dValue, powerValue); else dValue = logParam;
                   if (dValue < 1) dValue = 1;
                   
                   powerValue = MathPow (sqrtDivider, MathSqrt (dValue));
                   if (sValue - paramA > 0) paramA = sValue; else paramA = sValue - (sValue - paramA) * powerValue;
                   if (sValue - paramB < 0) paramB = sValue; else paramB = sValue - (sValue - paramB) * powerValue;
              }
         }
// ---- end of big cycle                                
         if (loopCriteria > 30) {
                JMATempValue = JMAValueBuffer [shift + 1];
            powerValue   = MathPow (lengthDivider, dValue);
            squareValue  = MathPow (powerValue, 2);
                        
                fC0Buffer [shift] = (1 - powerValue) * series + powerValue * fC0Buffer [shift + 1];
            fC8Buffer [shift] = (series - fC0Buffer [shift]) * (1 - lengthDivider) + lengthDivider * fC8Buffer [shift + 1];
           
            fA8Buffer [shift] = (phaseParam * fC8Buffer [shift] + fC0Buffer [shift] - JMATempValue) *
                                 (powerValue * (-2.0) + squareValue + 1) + squareValue * fA8Buffer [shift + 1]; 
            JMATempValue += fA8Buffer [shift];
         }
         JMAValue = JMATempValue;
      }
      if (loopParam <= 30) JMAValue = 0;
      JMAValueBuffer [shift] = JMAValue;
//---- End of main cycle
   }
   return;
}

//+------------------------------------------------------------------+
int IntPortion (double param) {
   if (param > 0) return (MathFloor (param));
   if (param < 0) return (MathCeil (param));
   return (0.0);
}
//+------------------------------------------------------------------+
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Indikators MT4 platformai
19.07.2006 22:04
velns .. saspraudaas tas mulkigais simbols. Isi sakot visur kur ir tas simbols eek .. jabut astotniekam un iekavai.
uldids
Pievienots: 20.04.2006
Ziņojumi: 54
Re: Indikators MT4 platformai
19.10.2006 17:06
//+------------------------------------------------------------------+
//|                                                      boon EA.mq4 |
//|                                           Copyright © 2006, boon |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "boon"
#property link      ".uforex.lv"

extern double    LotsIfNoMM = 1;
extern int       StopLoss=30;
extern int       Slip=0;
extern int       MM_Mode=0;
extern int       MM_Risk=10;

double Opentrades,orders,first,mode,Ilo,sym,b,tmp,GridCellPoint,OpenOrderStopLoss;
double b4signal,Signal,Triggerline,b4Triggerline,Nowsignal,NowTriggerline,sl,LastOpByExpert,LastBarChecked;
int cnt,cnt2,OpenPosition,notouchbar,PendingOrderTicket,OpenOrderTicket;
bool test;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
 
//return(0);
  
   //if ( ! IsTesting() ) Comment(" Trailingstop    ",  b, "\n","      Tick no. ", iVolume(NULL,0,0),"\n"," Lots    ",Ilo);

 

   if (MM_Mode < 0)  {
   Ilo = MathCeil(AccountBalance()*MM_Risk/10000)/10;
     if (Ilo > 100) { 
     Ilo = 100; 
     }
   } else {
   Ilo = LotsIfNoMM;
   }
   if (MM_Mode > 0) 
    {
   Ilo = MathCeil(AccountBalance()*MM_Risk/10000)/10;
    if (Ilo > 1) 
    {
    Ilo = MathCeil(Ilo);
    }
    if (Ilo < 1) 
    {
    Ilo = 1;
    }
    if (Ilo > 100) 
    { 
     Ilo = 100; 
     }
   }
       
Opentrades=0;
for (cnt=0;cnt<OrdersTotal();cnt++)
   {
   if ( OrderSelect (cnt, SELECT_BY_POS) == false )  continue;
   if ( OrderSymbol()==Symbol())
      {
      Opentrades=Opentrades+1;
      }
   }

if (Opentrades!=0)
   {
   if (OrderType()==OP_BUY)
      {
      if (Bid>=iHigh(Symbol(),0,Highest(Symbol(),0,MODE_HIGH,2,0)))
         {
         OrderClose(OrderTicket(),OrderLots(),Bid,Slip,Gold);
         Opentrades--;
         }
      }
      else if (OrderType()==OP_SELL)
      {
      if (Bid<=iLow(Symbol(),0,Lowest(Symbol(),0,MODE_LOW,2,0)))
         {
         OrderClose(OrderTicket(),OrderLots(),Ask,Slip,Gold);
         Opentrades--;
         }
      }
   }

if (Opentrades==0)
   {
  
   if (iMA(Symbol(),0,23,0,MODE_EMA,PRICE_CLOSE,1)<iMA(Symbol(),0,23,0,MODE_SMA,PRICE_CLOSE,1) && Bid<=iLow(Symbol(),0,Lowest(Symbol(),0,MODE_LOW,1,0)))
      {
      OrderSend(Symbol(),OP_BUY,Ilo,Ask,Slip,Ask-StopLoss*Point,0,"boon EA",0,0,Blue);
      }
     
   if (iMA(Symbol(),0,23,0,MODE_EMA,PRICE_CLOSE,1)>iMA(Symbol(),0,23,0,MODE_SMA,PRICE_CLOSE,1) && Bid>=iHigh(Symbol(),0,Highest(Symbol(),0,MODE_HIGH,1,0)))
      {
      OrderSend(Symbol(),OP_SELL,Ilo,Bid,Slip,Bid+StopLoss*Point,0,"boon EA",0,0,Red);
      }
 
   }

   return(0);
  }

 
uldids
Pievienots: 20.04.2006
Ziņojumi: 54
Re: Indikators MT4 platformai
19.10.2006 17:15
šis ir eksperts, kurš dod ļoti labus rezultātus testos īpaši jau MIG platforfā demo !!!!!! ,nezinu kādus rezultātus tas dotu reālajā. pasekojot tekošajai tirdzniecībai un salīdzinot ar testa rezultātiem dažās dienās, t. i . kādos 100 dīlos, atklājas pavisam nelielas atšķirības no  testiem, retu reizi par 1 punktu atverot dīlu.

ja būtu kāds gudrs, kurš mācētu pievienot maģisko skaitli, iespēju izlikt TP, un pavisam kruti būtu, ja maināmos indikatoru parametrus varētu izvirzīt mainīšanai  eksperta galviņā, tad šis būtu gana labs eksperts, ja vien demo atbilstu reālajam.
Seller of Smiles
Seller of Smiles
Pievienots: 16.08.2004
Ziņojumi: 9511
Re: Indikators MT4 platformai
19.10.2006 19:44
te jautājums no zāles.
priekš kam izlikt internetā svēto grālu?
dragonfly
Pievienots: 17.08.2004
Ziņojumi: 2022
Re: Indikators MT4 platformai
19.10.2006 19:55
SoS - lai tiktu uz skatuvessmile
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Indikators MT4 platformai
19.10.2006 21:56
Sorre, bet es gan te nekaadu sveeto graalu neredzu. 
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Indikators MT4 platformai
21.10.2006 12:34
2 uldids:

Tu zaraa par Migu bijis ielicis sekojosu tekstu:

"rau ko saka paši Metakvotu izstrādātāji par ekspertu uzbūvi : Мы постоянно повторяем - пишите робастых/толстокожих экспертов, у которых не сносит крышу от разницы в пару пипсов. Многие этого не понимают, не хотят принимать (даже наоборот требуют тиков и пытаются подстроиться под них) и делают одни и теже заявления вида "тестер плохой, тест от реала отличается". cerams, ka sapratīsi šo valodu."

 Taa kaa tas ko teiksu neattiecas uz Migu, tad atlavos postu parcelt uz sejieni. Es tikai gribeju pateikt, kadelj biezi vien daudzi aplauzas testejot ISTERMINJA strategijas un peec tam taas pielietojot uz reala konta. Pie nosacijuma, ka experts ir uzrakstits korekti, tas parasti notiek aiz diviem iemesliem:
1) vesturiskie dati ir nepareizi;
2) Ja expertaa ir ielikts verties valjaa pa tirgu, bet nevis izmantojot atliktos orderus, tad testaa saads experts ljoti smuki visu izpildis, bet realajaa saaksie requoti un slippage. Lidz ar to arii viss rezultats sanaaks pavisam savadaks. TAdelj testerii var izmantot tirgus orderus, bet realajaa tirdzniecibaa ir jaizmanto atliktie orderi.
uldids
Pievienots: 20.04.2006
Ziņojumi: 54
Re: Indikators MT4 platformai
21.10.2006 13:44
mja, tā ir, ka dzīvē viss ir savādāk. arī manējais eksperts testerī ir īsts zelta grāls, bet palaižot to tikai demo, lauskas vien sanāk, sākas cenu izslīdējumi, kāds dīls vispār nenostrādā uz sekundīgajām cenu svārstībām. un reālajā droši vien būtu vēl ļaunāk, ja jau pat vēsturiskie dati vienā platformā demo un reālajā nedaudz, bet tomēr atšķiras.
uldids
Pievienots: 20.04.2006
Ziņojumi: 54
Re: Indikators MT4 platformai
16.12.2006 14:19
//+------------------------------------------------------------------+
//| This MQL is generated by Expert Advisor Builder                  |
//|                http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ |
//|                                                                  |
//|  In no event will author be liable for any damages whatsoever.   |
//|                      Use at your own risk.                       |
//|                                                                  |
//|                Please do not remove this header.                 |
//+------------------------------------------------------------------+
#property copyright "Expert Advisor Builder"
#property link      "http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/"

extern int MagicNumber = 2;
extern bool SignalMail = False;
extern bool EachTickMode = True;
extern double Lots = 1;
extern int Slippage = 0;
extern bool StopLossMode = True;
extern int StopLoss = 220;
extern bool TakeProfitMode = True;
extern int TakeProfit = 220;
extern bool TrailingStopMode = True;
extern int TrailingStop = 300;

#define SIGNAL_NONE 0
#define SIGNAL_BUY   2
#define SIGNAL_SELL  1
#define SIGNAL_CLOSEBUY 4
#define SIGNAL_CLOSESELL 3

int BarCount;
int Current;
bool TickCheck = False;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init() {
   BarCount = Bars;

   if (EachTickMode) Current = 0; else Current = 1;

   return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit() {
   return(0);
}
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start() {
   int Order = SIGNAL_NONE;
   int Total, Ticket;
   double StopLossLevel, TakeProfitLevel;



   if (EachTickMode && Bars != BarCount) TickCheck = False;
   Total = OrdersTotal();
   Order = SIGNAL_NONE;

   //+------------------------------------------------------------------+
   //| Variable Begin                                                   |
   //+------------------------------------------------------------------+

      double Var1 = iAO("USDCHF", PERIOD_M15, Current + 0);
      double Buy1_1 = iAO("USDCHF", PERIOD_M15, Current + 0);
      double Buy1_2 = iAO("USDCHF", PERIOD_M15, Current + 1);
      double Sell1_1 = iAO("USDCHF", PERIOD_M15, Current + 0);
      double Sell1_2 = iAO("USDCHF", PERIOD_M15, Current + 1);
      double CloseBuy1_1 = iAO("USDCHF", PERIOD_M15, Current + 0);
      double CloseBuy1_2 = iAO("USDCHF", PERIOD_M15, Current + 1);
      double CloseSell1_1 = iAO("USDCHF", PERIOD_M15, Current + 0);
      double CloseSell1_2 = iAO("USDCHF", PERIOD_M15, Current + 1);

   //+------------------------------------------------------------------+
   //| Variable End                                                     |
   //+------------------------------------------------------------------+

   //Check position
   bool IsTrade = False;

   for (int i = 0; i < Total; i ++) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if(OrderType() <= OP_SELL &&  OrderSymbol() == Symbol()) {
         IsTrade = True;
         if(OrderType() == OP_BUY) {
            //Close

            //+------------------------------------------------------------------+
            //| Signal Begin(Exit Buy)                                           |
            //+------------------------------------------------------------------+

               if (CloseBuy1_1 > CloseBuy1_2) Order = SIGNAL_CLOSEBUY;

            //+------------------------------------------------------------------+
            //| Signal End(Exit Buy)                                             |
            //+------------------------------------------------------------------+

            if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
               OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);
               if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");
               if (!EachTickMode) BarCount = Bars;
               IsTrade = False;
               continue;
            }
            //Trailing stop
            if(TrailingStopMode && TrailingStop > 0) {                 
               if(Bid - OrderOpenPrice() > Point * TrailingStop) {
                  if(OrderStopLoss() < Bid - Point * TrailingStop) {
                     OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);
                     if (!EachTickMode) BarCount = Bars;
                     continue;
                  }
               }
            }
         } else {
            //Close

            //+------------------------------------------------------------------+
            //| Signal Begin(Exit Sell)                                          |
            //+------------------------------------------------------------------+

               if (CloseSell1_1 < CloseSell1_2) Order = SIGNAL_CLOSESELL;

            //+------------------------------------------------------------------+
            //| Signal End(Exit Sell)                                            |
            //+------------------------------------------------------------------+

            if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
               OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);
               if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell");
               if (!EachTickMode) BarCount = Bars;
               IsTrade = False;
               continue;
            }
            //Trailing stop
            if(TrailingStopMode && TrailingStop > 0) {                 
               if((OrderOpenPrice() - Ask) > (Point * TrailingStop)) {
                  if((OrderStopLoss() > (Ask + Point * TrailingStop)) || (OrderStopLoss() == 0)) {
                     OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * TrailingStop, OrderTakeProfit(), 0, DarkOrange);
                     if (!EachTickMode) BarCount = Bars;
                     continue;
                  }
               }
            }
         }
      }
   }

   //+------------------------------------------------------------------+
   //| Signal Begin(Entry)                                              |
   //+------------------------------------------------------------------+

      if (Buy1_1 < Buy1_2) Order = SIGNAL_BUY;
      if (Sell1_1 > Sell1_2) Order = SIGNAL_SELL;

   //+------------------------------------------------------------------+
   //| Signal End                                                       |
   //+------------------------------------------------------------------+

   //Buy
   if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
      if(!IsTrade) {
         //Check free margin
         if (AccountFreeMargin() < (1000 * Lots)) {
            Print("We have no money. Free Margin = ", AccountFreeMargin());
            return(0);
         }

         if (StopLossMode) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0;
         if (TakeProfitMode) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0;

         Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue);
         if(Ticket > 0) {
            if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
                Print("BUY order opened : ", OrderOpenPrice());
                if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");
            } else {
                Print("Error opening BUY order : ", GetLastError());
            }
         }
         if (EachTickMode) TickCheck = True;
         if (!EachTickMode) BarCount = Bars;
         return(0);
      }
   }

   //Sell
   if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
      if(!IsTrade) {
         //Check free margin
         if (AccountFreeMargin() < (1000 * Lots)) {
            Print("We have no money. Free Margin = ", AccountFreeMargin());
            return(0);
         }

         if (StopLossMode) StopLossLevel = Bid + StopLoss * Point; else StopLossLevel = 0.0;
         if (TakeProfitMode) TakeProfitLevel = Bid - TakeProfit * Point; else TakeProfitLevel = 0.0;

         Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink);
         if(Ticket > 0) {
            if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
                Print("SELL order opened : ", OrderOpenPrice());
                if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");
            } else {
                Print("Error opening SELL order : ", GetLastError());
            }
         }
         if (EachTickMode) TickCheck = True;
         if (!EachTickMode) BarCount = Bars;
         return(0);
      }
   }

   if (!EachTickMode) BarCount = Bars;

   return(0);
}
//+------------------------------------------------------------------+


vienvakar paniekojos un uztaisīju pēc programmas šo ekspertu. paniekojos un pamēģināju patestēt uz dažādām valūtām un laika intervāliem. uz eur/usd un gbp/usd M15 sanāk brīnišķīgi testa rezultāti, pastāvīgs peļņas kāpums 2 gadu garumā /cik man bija vēsturiskie dati/,  tikai palaižot ekspertu darboties tekošjā laikā, vairs tik smuki neizskatās, darījumi atveras savādāk kā testējot.
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Indikators MT4 platformai
18.12.2006 14:26
Es pameginaju iztestet seit iedoto variantu ... neko nemainot expertaa. Indikatori expertaa njem USDCHF un 15 min
Var1 = iAO("USDCHF", PERIOD_M15, Current + 0);
, tad uz sii valutas paara un perioda es arii izdzenaju expertu. Man sanaaca pastavigs un aatrs noleejiens.
 

Experta lielakais minuss manaa skatijumaa ir taads, ka tas generee parlieku daudz un parlieku tuvus tirdzniecibas signalus.
Iedomajaties, ka mums uz iepriekseja baara iAO bij 0.00052 un tagad indikators klust 0.00053 .. liidz ar to iAO tekosaa vertiba > par iAO vertibu ieprieksejam baaram .. rezultata mes perkam. Cena nedaudz nosvarstas un indikators jau klust 0.00051 un jau izpildias princips uz pardosanu. Lidz ar to sanaak, ka darijumi var but ljoti tuvu viens pie otra. Testa zurnaals raada, ka preteeji darijumi tikusi veikti pat 2-3 punktu robezaas. Un tas nav normaali.

Ieteikums .. izveidot filtru, kas samazinatu darijumu skaitu. Teiksim:
1) Ja ir noticis darijums, tad plusiem vai minusiem ir japarsniedz kaut kaada konkreta vertiba .. teiksim 40 punkti, lai varetu aizvert tekoso poziciju.
2) Var izveidot laka filtru. No pedeja darijuma briiza ir japiet kaut kaadam konkretam laikam, lai varetu likdvidet poziciju.
3) Var meginat savadak izveidot indikatoru nosacijumus. Teiksim ja tekosais iAO parsniedz ieprieksejo iAO par kaadu konkretu soli tikai tad ir signaals uz pirksanu.

 Expertaa ir vel taada divainiba, ka tiek sarezgits aizversanas un atversanas princips:
Pienemsims, ka mums butu operacija SELL.
 SELL Close signaals notiek, ja indikatora(iAO) tekosaa vertiba < par iAO vertibu ieprieksejam baaram.
BUY Open signaals tiek izdots pec identiska principa, ja iAO tekosaa vertiba < par iAO vertibu ieprieksejam baaram.
 Lidz ar to aizverot SELL poziciju pec idejas vajadzetu vienlaicigi atverties BUY pozicijai, bet skatot testa zurnalu ir redzams, ka vispirms tiek aizverts SELL un tikai pie nakamaa genereta tika .. parasti BUY signaals.
 Tas ir deelj taa, ka kodaa ir sii te rindinja
IsTrade = False;

 Ekspertaa ir dazaadas paarbaudes bez kuraam skiet mierigi varetu iztikt. Teiksim EachTickMode un TickCheck.
uldids
Pievienots: 20.04.2006
Ziņojumi: 54
Re: Indikators MT4 platformai
18.12.2006 15:09
peļņa testējot ir tikai eurusd, gbpusd un zeltam, pārējos pāros ir nolējiens. interesanti ir rezultāti eksperta kodā pārmainot period_M15 vietā uzliekot H4 un palaižot testēties intervālos M1...M30, tad dīli tiek atvērti tikai ik pa 4 stundām, vai uzliekot H1 un testējot minūšu intervālos, tas dīli tiek atvērti tikai apaļās stundās. peļņa ir pastāvīga un ilglaicīga.
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Indikators MT4 platformai
18.12.2006 15:35
tas vai Tu testee uz 15 minutem vai 4 stundaam .. butiba ir vienalga. Viss ko tas atskir ir kaa testers generees tickus .. it ipasi tajaa gadijumaa, ja Tev nebus datu par zemakajiem laika periodiem.
 Pielauju, ka tas vai tajaa pasaa baraa veras valjaa vai nee ir atkarigs no mainiga EachTickMode un TickCheck. Lai gan tas viss kods ir absoluti lieki sarezgits. To visu varetu panaakt ar daudz mazakam pulem.
  Teiksu atklaati .. man neizraisa simpatijas kaa ir uzrakstits sis experts. Parak daudz lieka tur ir.
nezinu
Pievienots: 01.03.2006
Ziņojumi: 397
Re: Indikators MT4 platformai
13.02.2007 12:10
Piedāvājam treideru uzmanībai skriptu "Forex kalendārs".

Skripts "Forex kalendārs" ir paredzēts, lai Forex kalendāra ekonomiskos notikumus, gan iepriekšējos, gan gaidāmos, attēlotu tirdzniecības platformā pieejamajos cenu grafikos.
Šāda iespēja dod divas būtiskas priekšrocības:
1. Nav niepieciešams ik pa brīdim ielūkoties ekonomisko notikumu kalendārā, lai uzzinātu nākotnē gaidāmos ekonomiskos notikumus, jo šie notikumi, pateicoties dotajam skriptam, jau būs savlaicīgi attēloti uz cenu grafika.
2. Iepriekšējo ekonomisko notikumu attēlošana uz cenu grafika, dod fantastiskas iespējas veikt analīzi balstoties uz vēsturiskajiem datiem. Ja treiderim pašam jāattēlo katrs ekonomiskais notikums uz cenu grafika, lai redzētu kādu ietekmi tas ir atstājis uz cenu, tad tas ir ļoti darbietilpīgs process. Savukārt ar dotā skripta palīdzību, attēlošanu var paveikt ļot viegli un ātri.

Veiksmīgu tirdzniecību vēlot,
RM-Forex.lv
uldids
Pievienots: 20.04.2006
Ziņojumi: 54
Re: Indikators MT4 platformai
14.02.2007 18:44
//+-------------------------------------------------------------------+
//| Original Version ASCTrend1sig.mq4
/// nedaudz pārtaisīts manā variantā, piemērots eur/usd M5 Fibo reālās
/// tirdzniecība platformā. ja jums ir noderīgs šis indikators un pēc šī
/// indikatora pelnāt naudiņu, variet man pateikties arī materiāli sazinoties
/// www.financenet.lv forumā. visus riskus strādājot ar šo indikatoru
/// uzņemieties paši uz savu atbildību.
///                                         boon aka uldids
//|
//+-------------------------------------------------------------------+


#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Lime

//---- input parameters
extern int RISK=27;
extern int CountBars=30000;
extern int SoundON=1;
extern int EmailON=0;
 

//---- buffers
double val1[];
double val2[];
int flagval1 = 0;
int flagval2 = 0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,174);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,174);
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);
   GlobalVariableSet("AlertTime"+Symbol()+Period(),CurTime());
   GlobalVariableSet("SignalType"+Symbol()+Period(),OP_SELLSTOP);
//----
   return(0);
  }
 
int deinit()
{
   GlobalVariableDel("AlertTime"+Symbol()+Period());
   GlobalVariableDel("SignalType"+Symbol()+Period());
   return(0);
}
 
//+------------------------------------------------------------------+
//| ASCTrend1sig                                                     |
//+------------------------------------------------------------------+
int start()
  {
   if (CountBars>=100000) CountBars=95000;
   SetIndexDrawBegin(0,Bars-CountBars+11+1);
   SetIndexDrawBegin(1,Bars-CountBars+11+1);
   int i,shift,counted_bars=IndicatorCounted();
   int Counter,i1,value10,value11;
   double value1,x1,x2;
   double value2,value3;
   double TrueCount,Range,AvgRange,MRO1,MRO2;
   double Table_value2[100000];
   double tmp=0;

   value10=55;
   x1=67+RISK;
   x2=33-RISK;
   value11=value10;
//----
   if(Bars<=11+1) return(0);
//---- initial zero
   if(counted_bars<11+1)
   {
      for(i=1;i<=0;i++) val1[CountBars-i]=0.0;
      for(i=1;i<=0;i++) val2[CountBars-i]=0.0;
   }
//----
   shift=CountBars-11-1;
   while(shift>=0)
     {
    
   Counter=shift;
    Range=0.0;
    AvgRange=0.0;
    for (Counter=shift; Counter<=shift+9; Counter++) AvgRange=AvgRange+MathAbs(High[Counter]-Low[Counter]);
       
    Range=AvgRange/10;
    Counter=shift;
    TrueCount=0;
    while (Counter<shift+9 && TrueCount<1)
        {if (MathAbs(Open[Counter]-Close[Counter+1])>=Range*2.0) TrueCount=TrueCount+1;
        Counter=Counter+1;
        }
    if (TrueCount>=1) {MRO1=Counter;} else {MRO1=-1;}
    Counter=shift;
    TrueCount=0;
    while (Counter<shift+6 && TrueCount<1)
        {if (MathAbs(Close[Counter+3]-Close[Counter])>=Range*4.6) TrueCount=TrueCount+1;
        Counter=Counter+1;
        }
    if (TrueCount>=1) {MRO2=Counter;} else {MRO2=-1;}
    if (MRO1>-1) {value11=3;} else {value11=value10;}
    if (MRO2>-1) {value11=4;} else {value11=value10;}
    value2=100-MathAbs(iWPR(NULL,0,value11,shift)); // PercentR(value11=9)
    Table_value2[shift]=value2;
    val1[shift]=0;
    val2[shift]=0;
    value3=0;
    if (value2<x2)
        {i1=1;
        while (Table_value2[shift+i1]>=x2 && Table_value2[shift+i1]<=x1){i1++;}
        if (Table_value2[shift+i1]>x1)
            {
            value3=High[shift]+Range*0.5;
           if (shift == 1 && flagval1==0){  flagval1=1; flagval2=0; }
            val1[shift]=value3;           
            }
        }
    if (value2>x1)
        {i1=1;
        while (Table_value2[shift+i1]>=x2 && Table_value2[shift+i1]<=x1){i1++;}
        if (Table_value2[shift+i1]<x2)
            {
            value3=Low[shift]-Range*0.5;
            if (shift == 1 && flagval2==0) { flagval2=1; flagval1=0; }
            val2[shift]=value3;           
            }
        }
     
      shift--;
     }

   if (flagval1==1 && CurTime() > GlobalVariableGet("AlertTime"+Symbol()+Period()) && GlobalVariableGet("SignalType"+Symbol()+Period())!=OP_BUY) {
      if (SoundON==1) Alert("SELL signal at Ask=",Ask,", Bid=",Bid,", Date=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime())," Symbol=",Symbol()," Period=",Period());
      if (EmailON==1) SendMail("SELL signal alert","SELL signal at Ask="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
      tmp = CurTime() + (Period()-MathMod(Minute(),Period()))*60;
      GlobalVariableSet("AlertTime"+Symbol()+Period(),tmp);
      GlobalVariableSet("SignalType"+Symbol()+Period(),OP_BUY);
   }
  
   if (flagval2==1 && CurTime() > GlobalVariableGet("AlertTime"+Symbol()+Period()) && GlobalVariableGet("SignalType"+Symbol()+Period())!=OP_SELL) {
      if (SoundON==1) Alert("BUY signal at Ask=",Ask,", Bid=",Bid,", Time=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime())," Symbol=",Symbol()," Period=",Period());
      if (EmailON==1) SendMail("BUY signal alert","BUY signal at Ask="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
      tmp = CurTime() + (Period()-MathMod(Minute(),Period()))*60;
      GlobalVariableSet("AlertTime"+Symbol()+Period(),tmp);
      GlobalVariableSet("SignalType"+Symbol()+Period(),OP_SELL);
   }

   return(0);
  }
//+------------------------------------------------------------------+

 
uldids
Pievienots: 20.04.2006
Ziņojumi: 54
Re: Indikators MT4 platformai
17.09.2007 16:39
//+------------------------------------------------------------------+
//|   Qualitative Quantitative Estimation Indicator for Metatrader 4 |
//|                                     Copyright © 2006Roman Ignatov|
//|                                   mailto:roman.ignatov@gmail.com |
//|                                       e-pastiņš: uldids@gmail.com|
//+------------------------------------------------------------------+
#property copyright "Copyright © 200 Roman Ignatov"
#property link      "mailto:roman.ignatov@gmail.com"

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_color1 Lime
#property indicator_style1 STYLE_SOLID
#property indicator_width1 4

#property indicator_color2 Red
#property indicator_style2 STYLE_SOLID
#property indicator_width2 4


extern int SF = 1;

int RSI_Period = 14;
int Wilders_Period;
int StartBar;

double TrLevelSlow[];
double AtrRsi[];
double MaAtrRsi[];
double Rsi[];
double RsiMa[];

int init()
{
    Wilders_Period = RSI_Period * 2 - 1;
    if (Wilders_Period < SF)
        StartBar = SF;
    else
        StartBar = Wilders_Period;
        
    IndicatorBuffers(6);
    SetIndexBuffer(0, RsiMa);
    SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
    SetIndexLabel(0, "Value 1");
    SetIndexDrawBegin(0, StartBar);
    SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);
    SetIndexBuffer(1, TrLevelSlow);
    SetIndexLabel(1, "Value 2");
    SetIndexDrawBegin(1, StartBar);
    SetIndexBuffer(2, AtrRsi);
    SetIndexBuffer(3, MaAtrRsi);
    SetIndexBuffer(4, Rsi);
    IndicatorShortName(StringConcatenate("QQE(", SF, ")"));
    return(0);
}


int start()
{
    int counted, i;
    double rsi0, rsi1, dar, tr, dv;
   
    if(Bars <= StartBar)
        return (0);

    counted = IndicatorCounted();
    if(counted < 1)
        for(i = Bars - StartBar; i < Bars; i++)
        {
            TrLevelSlow[i] = 0.0;
            AtrRsi[i] = 0.0;
            MaAtrRsi[i] = 0.0;
            Rsi[i] = 0.0;
            RsiMa[i] = 0.0;
        }
   
    counted = Bars - counted - 1;
       
    for (i = counted; i >= 0; i--)
        Rsi[i] = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, i);

    for (i = counted; i >= 0; i--)
    {
        RsiMa[i] = iMAOnArray(Rsi, 0, SF, 0, MODE_EMA, i);
        AtrRsi[i] = MathAbs(RsiMa[i + 1] - RsiMa[i]);
    }

    for (i = counted; i >= 0; i--)
        MaAtrRsi[i] = iMAOnArray(AtrRsi, 0, Wilders_Period, 0, MODE_EMA, i);

    i = counted + 1;
    tr = TrLevelSlow[i];
    rsi1 = iMAOnArray(Rsi, 0, SF, 0, MODE_EMA, i);
    while (i > 0)
    {
        i--;
        rsi0 = iMAOnArray(Rsi, 0, SF, 0, MODE_EMA, i);
        dar = iMAOnArray(MaAtrRsi, 0, Wilders_Period, 0, MODE_EMA, i) * 4.236;

        dv = tr;
        if (rsi0 < tr)
        {
            tr = rsi0 + dar;
            if (rsi1 < dv)
                if (tr > dv)
                    tr = dv;
        }
        else if (rsi0 > tr)
        {
            tr = rsi0 - dar;
            if (rsi1 > dv)
                if (tr < dv)
                    tr = dv;
        }
        TrLevelSlow[i] = tr;
        rsi1 = rsi0;
    }
   
    return(0);
}

 
Lapas:12next
Forumu saraksts/Hard & Soft/Indikators MT4 platformai
© 2004-2024 wallstreet.lv
e-mail: 
Pārpublicēšanas gadījumā atsauce uz wallstreet.lv obligāta!
Top.LV