Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

mql High, iHighest, iBarShift analogs
 Post subject: mql High, iHighest, iBarShift analogs Post rating: 0   New post Posted: Mon 15 Aug, 2011, 06:02 

User rating: 0
Joined: Sat 06 Aug, 2011, 23:17
Posts: 27
Location: Russian Federation,
Hi all.

I try code this function from mql to JForex:


int barsCount = 10;
....

//+--------------------------------------------------------------------------------------------------------------+
void updateExtraSignal() {
//+--------------------------------------------------------------------------------------------------------------+

highPrice = High[iHighest(NULL,Period(),MODE_HIGH,barsCount,1)];
lowPrice = Low[iLowest(NULL,Period(),MODE_CLOSE,barsCount,1)];

}

I try in JForex this:

        //+--------------------------------------------------------------------------------------------------------------+
   public void updateExtraSignal() throws JFException {
   //+--------------------------------------------------------------------------------------------------------------+
   
       //--- Делаем выборку баров с 10-го (по barsCount) по первый бар
       List<IBar> high = history.getBars(instrument, Period.FIFTEEN_MINS, OfferSide.BID, lastBarTime(), firstBarTime());
       List<IBar> low = history.getBars(instrument, Period.FIFTEEN_MINS, OfferSide.BID, lastBarTime(), firstBarTime());
      
            highPrice = high.getHigh(); //--- Получаем максимум среди high
       lowPrice = low.getLow(); //--- Получаем минимум среди low
       
        //---
        return;
   }

//+--------------------------------------------------------------------------------------------------------------+
    //| barOpenTime. Возвращет время открытия нулевого бара в миллисекундах.
    //+--------------------------------------------------------------------------------------------------------------+
    public long firstBarTime() throws JFException{
    //+--------------------------------------------------------------------------------------------------------------+

        long time = 0;
        IBar bar = history.getBar(instrument, timeFrame, OfferSide.BID, 1);
        time = bar.getTime();
        return (time);
    }
   
    //+--------------------------------------------------------------------------------------------------------------+
    //| barOpenTime. Возвращет время открытия нулевого бара в миллисекундах.
    //+--------------------------------------------------------------------------------------------------------------+
    public long lastBarTime() throws JFException{
    //+--------------------------------------------------------------------------------------------------------------+

        long time = 0;
        IBar bar = history.getBar(instrument, timeFrame, OfferSide.BID, barsCount);
        time = bar.getTime();
        return (time);
    }



My function updateExtraSignal dont compile.

2) Next function:


in MQL:

//+--------------------------------------------------------------------------------------------------------------+
//| GetHigh. Функция сравнения баров по iHigh. Используется в GetMaximumForInterval
//+--------------------------------------------------------------------------------------------------------------+
double getHigh(int shift, int lenght, int tf) {
//+--------------------------------------------------------------------------------------------------------------+

double high;
double maxhigh = iHigh(Symbol(),tf,shift);

if (maxhigh < Point) return(0);

for (int i = shift + 1; i < shift + lenght; i++)
   {
   high = iHigh(Symbol(),tf,i);
   if (high < Point) return(0);
   if (high > maxhigh) maxhigh = high;
   }

//---
return(maxhigh);

}

I try in JForex this

       //+--------------------------------------------------------------------------------------------------------------+
   //| getHigh. Функция сравнения баров по iHigh. Используется в GetMaximumForInterval
   //+--------------------------------------------------------------------------------------------------------------+
   public double getHigh(int shift, int lenght) throws JFException {
   //+--------------------------------------------------------------------------------------------------------------+
   
      double high = 0;
      double maxhigh = high(shift, OfferSide.BID, Period.FIFTEEN_MINS);
      
      if (maxhigh < point) return(0);
      
      for (int i = shift + 1; i < shift + lenght; i++) {
          high = high(i, OfferSide.BID, Period.FIFTEEN_MINS);
          if (high < point) return(0);
          if (high > maxhigh) maxhigh = high;
        }
      
      //---
      return(maxhigh);
   
   }

    //+--------------------------------------------------------------------------------------------------------------+
    //| high. Массив-таймсерия, содержащий максимальные цены каждого бара текущего графика.
    //+--------------------------------------------------------------------------------------------------------------+
    public double high(int index, OfferSide side, Period period) throws JFException{
    //+--------------------------------------------------------------------------------------------------------------+
   
        return history.getBar(instrument, period, side, index).getHigh();
    }



Function is true?

3) And next function


in mql

//+--------------------------------------------------------------------------------------------------------------+
//| GetMaximumForInterval. Расчет интервала максимума. Используется в функции CheckForDrawdown для проверки
//| ордеров на продажу.
//+--------------------------------------------------------------------------------------------------------------+
double getMaximumForInterval(int time1, int time2) {
//+--------------------------------------------------------------------------------------------------------------+

int shift = iBarShift(Symbol(),Period(),time1,1);
int lenght = iBarShift(Symbol(),Period(),time2,1);

if ((lenght >= 0) && (shift >= 0))
   {
   return(getHigh(shift,lenght,Period()));
   }

//---
return(0);

}

in JForex:

        //+--------------------------------------------------------------------------------------------------------------+
   //| GetMaximumForInterval. Расчет интервала максимума. Используется в функции CheckForDrawdown для проверки
   //| ордеров на продажу.
   //+--------------------------------------------------------------------------------------------------------------+
   public double getMaximumForInterval(long time1, long time2) throws JFException {
   //+--------------------------------------------------------------------------------------------------------------+
      
        double result = 0;
       
        //---
      List<IBar> shift = history.getBars(instrument, Period.FIFTEEN_MINS, OfferSide.BID, time1, firstBarTime());
      List<IBar> lenght = history.getBars(instrument, Period.FIFTEEN_MINS, OfferSide.BID, time2, firstBarTime());
      
      if ((lenght >= 0) && (shift >= 0)) {
          result = getHigh(shift, lenght);
        }
      
      //---
      return(result);
   }



This function dont compile, becose if ((lenght >= 0) && (shift >= 0)) {


Please help me find true analog mql High, iHighest, iBarShift functions.


 
 Post subject: Re: mql High, iHighest, iBarShift analogs Post rating: 0   New post Posted: Tue 16 Aug, 2011, 19:45 

User rating: 0
Joined: Sat 06 Aug, 2011, 23:17
Posts: 27
Location: Russian Federation,
Or tell me, how to realize only this function on JForex

in MQL

//+--------------------------------------------------------------------------------------------------------------+
//| UpdateExtraSignal. Обновление значений HighPrice и LowPrice, необходимых для принятия решения об открытии.
//+--------------------------------------------------------------------------------------------------------------+
void updateExtraSignal() {
//+--------------------------------------------------------------------------------------------------------------+

highPrice = High[iHighest(NULL,Period(),MODE_HIGH,barsCount,1)];
lowPrice = Low[iLowest(NULL,Period(),MODE_CLOSE,barsCount,1)];

}


I try this:

   public void updateExtraSignal() throws JFException {
   
       //--- Делаем выборку баров с 10-го (по barsCount) по первый бар
       List<IBar> high = history.getBars(instrument, Period.FIFTEEN_MINS, OfferSide.BID, lastBarTime(), firstBarTime());
       List<IBar> low = history.getBars(instrument, Period.FIFTEEN_MINS, OfferSide.BID, lastBarTime(), firstBarTime());
      
      //highPrice = high.getHigh(); //--- Получаем максимум среди high
      //lowPrice = low.getLow(); //--- Получаем минимум среди low
       
        //---
        return;
   }


Please support help me


 
 Post subject: Re: mql High, iHighest, iBarShift analogs Post rating: 0   New post Posted: Wed 17 Aug, 2011, 09:17 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See the following example in wiki:
https://www.dukascopy.com/wiki/index.php ... igh_values


 
 Post subject: Re: mql High, iHighest, iBarShift analogs Post rating: 0   New post Posted: Mon 22 Aug, 2011, 11:00 

User rating: 0
Joined: Sat 06 Aug, 2011, 23:17
Posts: 27
Location: Russian Federation,
Thanks for help!


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com