[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 64

 

Make Raz a constant

#define Raz 5

 
Thank you!!!
 

If a variable array size is required, it's something like this:

// Поиск фракталов
void fFractals(bool     РегулярностьЛевогоКрыла,
               bool     РегулярностьПравогоКрыла,
               int      ДлинаЛевогоКрыла,
               int      ДлинаПравогоКрыла,
               int      LostBars,
               int&     LFractals,int& HFractals,
               double&  LowF[],double& HighF[]) {
   double R, C[];
   int dim, i, j, Error;
   dim=ArrayResize(C, ДлинаЛевогоКрыла+1+ДлинаПравогоКрыла);
   if( LostBars<Bars-1 ) {
      i=ДлинаПравогоКрыла+БарОкончания+LostBars;
   }
   else {
      i=FirstBar-ДлинаЛевогоКрыла;
   }
   while( i>=ДлинаПравогоКрыла+БарОкончания ) {
      j=0;
      R=0;
      while ( j<dim ) { C[j]=High[j+i-ДлинаПравогоКрыла]; j++; }
      if( ( ( C[ДлинаПравогоКрыла]-C[ДлинаПравогоКрыла+1]> Zero &&  РегулярностьЛевогоКрыла )
         || ( C[ДлинаПравогоКрыла]-C[ДлинаПравогоКрыла+1]>-Zero && !РегулярностьЛевогоКрыла ) )
       && ( ( C[ДлинаПравогоКрыла]-C[ДлинаПравогоКрыла-1]> Zero &&  РегулярностьПравогоКрыла )
         || ( C[ДлинаПравогоКрыла]-C[ДлинаПравогоКрыла-1]>-Zero && !РегулярностьПравогоКрыла ) ) ) {
         R=C[ДлинаПравогоКрыла];       // Локальный максимум
         j=1;
         while ( j < dim ) {
            if( ( j< ДлинаПравогоКрыла && C[j-1]-C[j]>-Zero &&  РегулярностьПравогоКрыла )
             || ( j> ДлинаПравогоКрыла && C[j]-C[j-1]>-Zero &&  РегулярностьЛевогоКрыла  )
             || ( j< ДлинаПравогоКрыла && C[j-1]-R   > Zero && !РегулярностьПравогоКрыла )
             || ( j> ДлинаПравогоКрыла && C[j]-R     > Zero && !РегулярностьЛевогоКрыла  ) ) {
               R=0;                    // Нет фрактала
               break;
            }
            j++;
      }  }
      if( R > Zero && HighF[i]<Zero ) {
         HFractals++;
         HighF[i]=R;
      }
      j=0;
      R=0;
      while ( j < dim ) { C[j]=Low[j+i-ДлинаПравогоКрыла]; j++; }
      if( ( ( C[ДлинаПравогоКрыла+1]-C[ДлинаПравогоКрыла]> Zero &&  РегулярностьПравогоКрыла )
         || ( C[ДлинаПравогоКрыла+1]-C[ДлинаПравогоКрыла]>-Zero && !РегулярностьПравогоКрыла ) )
       && ( ( C[ДлинаПравогоКрыла-1]-C[ДлинаПравогоКрыла]> Zero &&  РегулярностьПравогоКрыла )
         || ( C[ДлинаПравогоКрыла-1]-C[ДлинаПравогоКрыла]>-Zero && !РегулярностьПравогоКрыла ) ) ) {
         R=C[ДлинаПравогоКрыла];       // Локальный минимум
         j=1;
         while ( j < dim ) {
            if( ( j< ДлинаПравогоКрыла && C[j]-C[j-1]>-Zero &&  РегулярностьПравогоКрыла )
             || ( j> ДлинаПравогоКрыла && C[j-1]-C[j]>-Zero &&  РегулярностьЛевогоКрыла  )
             || ( j< ДлинаПравогоКрыла && R-C[j-1]   > Zero && !РегулярностьПравогоКрыла )
             || ( j> ДлинаПравогоКрыла && R-C[j]     > Zero && !РегулярностьЛевогоКрыла  ) ) {
               R=0;                    // Нет фрактала
               break;
            }
            j++;
      }  }
      if( R > Zero && LowF[i]<Zero ) {
         LFractals++;
         LowF[i]=R;
      }
      i--;
   }
   return(0);
}
 

I don't understand what this is about....

if () {buy}

else while (a<0)

{print ...}

if (...) ...

COUNTER DOES NOT EXIT from the loop when "a" is greater than zero and won't go to the next if

how can this be? everything prints and prints.... it took me 10 minutes to print almost 6 gigabytes of logs. is this normal? i can't remember this before... it's not the first time i print.... parameters

 
Awesome! Thanks!!!!!!
 
lottamer:

I don't understand what this is about....

if () {buy}

else while (a<0)

{print ...}

if (...) ...

COUNTER DOES NOT EXIT from the loop when "a" is greater than zero and won't go to the next if

how can this be? everything prints and prints.... it took me 10 minutes to print almost 6 gigabytes of logs. is this normal? i can't remember it happened before... it's not the first time i print.... parameters


Try adding parentheses:

if () {buy}

else{ while (a<0)

{print ...}}

if (...) ...

 
tara:

Try adding parentheses:

if () {buy}

else{ while (a<0)

{print ...}}

if (...) ...


didn't work.
 
what does 2013.01.09 19:37:44 Robot_zero EURUSD,M1: shutdown by timeout ?

 
lottamer:
what does 2013.01.09 19:37:44 Robot_zero EURUSD,M1: shutdown by timeout ?


shutdown by timeout
 

Hi all ! Help me if it is possible to redo it ? I want positions to be opened when candles close below or above the line . Maybe a separate script to add ?

THIS IS PART OF THE EXPERT

//+------------------------------------------------------------------+

//| Open a position|
//+------------------------------------------------------------------+
void OpenPositions() {
bool lbBuy=False, lbSell=False;
double ldStop=0, ldTake=0;

if ((Ask>gdPrevAsk && Ask>=gdUpPrice && ebBuyFromUp)
|| (Ask<gdPrevAsk && Ask<=gdDnPrice && ebBuyFromDn)) lbBuy=True;
if ((Bid>gdPrevBid && Bid>=gdUpPrice && !ebBuyFromUp)
|| (Bid<gdPrevBid && Bid<=gdDnPrice && !ebBuyFromDn)) lbSell=True;

if (lbBuy) {
if (ExistPositionByOP(OP_SELL)) CloseAllPositions();
if (!ExistPositionByOP(OP_BUY)) {
if (StopLoss!=0) ldStop=Ask-StopLoss*Point;
if (TakeProfit!=0) ldTake=Ask+TakeProfit*Point;
OpenPosition(OP_BUY, ldStop, ldTake);
}
}
if (lbSell) {
if (ExistPositionByOP(OP_BUY) CloseAllPositions();
if (!ExistPositionByOP(OP_SELL)) {
if (StopLoss!=0) ldStop=Bid+StopLoss*Point;
if (TakeProfit!=0) ldTake=Bid-TakeProfit*Point;
OpenPosition(OP_SELL, ldStop, ldTake);
}
}
}