[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1081

 
dzhini:

Something just doesn't seem to be working. PLEASE HELP.

The idea of the test is as follows: if the candle is greater than a certain value, then prohibit further trading.


I cannot understand what you are trying to achieve. After your last post, which you deleted, I made a script that displays all the data about the size of the candlestick and the parameters to be checked. Everything works.

Only strange logic seemed to me - if the candle is bullish, you prohibit buying, and if it is bearish, you prohibit selling... But it's up to your own logic...

//+------------------------------------------------------------------+
//|                                        Проверка высоты свечи.mq4 |
//|                             Copyright © 2010, Trishkin Artyom A. |
//|                                           support@goldsuccess.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Trishkin Artyom A."
#property link      "support@goldsuccess.ru"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
bool BuyOne =false;
bool SellOne=false;
int  CandleVolume=10;

int start()
  {
//----
   Alert ("Проверка дала результат = ",CheckVolume());
//----
   return(0);
  }
//+------------------------------------------------------------------+
int CheckVolume()                               // функция проверки высоты свечи
{
   double volume=High[1]-Low[1];                // проверка высоты свечи
   double signCandle=Open[1]-Close[1];          // проверка направления (положительное или отрицательное значение)
   double CVol=CandleVolume*Point;
   int    Res=0;

   BuyOne =true;
   SellOne=true;
   if (NormalizeDouble(CVol-volume,Digits)>=0) Res=1; // если свеча меньше, то всё ОК
   else {                                       // если свеча больше, то прверяем её направление
      if (signCandle<0) BuyOne =false;          // если значение меньше ноля (т.е. закрытие больше открытия), то блокируем покупки
      if (signCandle>0) SellOne=false;          // в противном случае блокируем продажи
      Res=-1;                                   // возвращаем отказ по сделке
      }
   Comment ("\n",
            "High[1] = ",High[1],"\n",
            "Low[1] = ",Low[1],"\n",
            "Высота свечи (High[1]-Low[1]) = ",volume,"\n",
            "Проверяемый размер свечи = ",CVol,"\n",
            "Open[1] = ",Open[1],"\n",
            "Close[1] = ",Close[1],"\n",
            "Open[1]-Close[1] = ",Open[1]-Close[1],"\n",
            "Направление свечи = ",signCandle,"\n",
            "BuyOne = ",BuyOne,"\n",
            "SellOne = ",SellOne,"\n"
            
            );
   return(Res);
}
 

How to implement such a piece of code:

We check the zero bar (which is not yet fully formed) until it is the first one (already fully formed). If the zero bar is now the first (instead of 0 it has a 1) - then we continue...

Pro, help me make this part of the code!!!

 
Help find an advisor that takes information from history ....
 
kolyango:

How to implement such a piece of code:

We check the zero bar (which is not yet fully formed) until it is the first one (already fully formed). If the zero bar is now the first (instead of 0 it has a 1) - then continue...

Pro, help me make this part of the code!!!

Check the first one right away. Why check zero while waiting for it to be the first?
 
itum:
Help find an advisor that takes information from history ....
What kind of information? About the location of the stars?
 
artmedia70:
What kind of information? About the location of the stars?
It's been discussed on this forum more than once about some advisor that goes into the history and takes information (quotes, etc.) So I'm looking for something like that !
 
itum:
It's been discussed on this forum more than once about an Expert Advisor that goes into the history and takes information (quotes, etc.) So I'm looking for something like that !
Maybe it's better to decide what information you want to get from the history and write the code?
 
artmedia70:
Wouldn't it be better to decide what information you want from the story and write the code?
Why write code if you already have something similar? Roughly speaking, I need an EA that would show very good results only on the tester ..... !!
 
artmedia70:
Check the first one straight away. Why check zero waiting for it to be first?

This will ensure that not every tick will execute all code further, but only when the zero bar is first...
 
kolyango:

This will ensure that not every tick will execute all the code further, but only when the zero bar is first...
bool Fun_New_Bar()                              // Ф-ия обнаружения ..
  {                                             // .. нового бара
   static datetime New_Time=0;                  // Время текущего бара
   bool New_Bar=false;                               // Нового бара нет
   if(New_Time!=Time[0])                        // Сравниваем время
     {
      New_Time=Time[0];                         // Теперь время такое
      New_Bar=true;                             // Поймался новый бар
     }
  }