[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 583

 
alsu:
The ticket stays as it was


????

How do I check if the order is closed or not?

 
Cruc:

Thank you very much for the recommendation, I almost figured it out, just can't remember if the order is triggered, does the ticket take a value of -10?
The ticket does not change. Just the OrderCloseTime becomes greater than zero
 
ilunga:
The ticket does not change. It just has an OrderCloseTime greater than zero


And if a stop or profit is triggered, it also becomes less than zero, if I'm not mistaken -1 ?

How do I set the condition correctly ? Please advise.

 
Cruc:


And if a stop or profit is triggered, it will be less than zero, if I am not mistaken -1 ?

How do I set the condition correctly ? Please give me a hint.

It will not become different, it remains the same. Closed positions go to the deal history list with the same tickets.

Go through this very list of transaction history and look for the order there.

 
artmedia70:

Why so? Output all flags at once in one Comment`.

Right there:




there was no rise on the ADX, i.e. the condition

// check for rising ADX > 20, or just rising ADX ---- check for strength of movement.
if (x<20 && x0>20) {f3 = 1; }

is not met, but the trade is open

 
Ivn:


there was no rise on the ADX, i.e. the condition

// check for rising ADX > 20, or just rising ADX ---- check for strength.
if (x<20 && x0>20) {f3 = 1; }

is not met and the trade is open.

Judging by the comment in the screenshot - you are controlling the zero bar to make decisions.

This is not good... On a zero bar, indicators can go back and forth many times during bar formation, thus creating false signals (chatter).

To avoid this, check the first bar already formed.

 
I have been working on this for a long time now. I often notice on the chart that the price seems to be hitting a level where usually the high or low of the candle is almost equal to each other. But I don't know how to do it mathematically. I have been digging the forum and the database for 3 days but i can't find anything like that.
 

Greetings!

I'm trying to display information about a previous candle (non-zero bar) - bullish or bearish candle, size of its body and shadows and ratio of shadows to the candle's body.

But it doesn't output a stone flower. It outputs wrong values.

int start()
  {
   int counted_bars=IndicatorCounted();
   if (counted_bars<0) return(-1);        //---- check for possible errors
   if (counted_bars>0) counted_bars--;    //---- last counted bar will be recounted
   int limit=Bars-counted_bars;
   
   double kerzen_typ;                  //тип свечи
   string kerzen_name;                 //наименование свечи
   double kerzen_body;                 //размер тела свечи
   double kerzen_shadow_up;            //размер верхней тени
   double kerzen_shadow_down;          //размер нижней тени
   double kerzen_shadow2body_up;       //отношение верхней тени к размеру тела
   double kerzen_shadow2body_down;     //отношение нижней тени к размеру тела

//---- main loop
   for(int bar=0; bar<limit; bar++)
      {
//определение контрольной свечки - белая, черная или додж и сбор информации
   if (Close[bar]>Open[bar])
      {
         kerzen_typ=1;
         kerzen_name="бычья или белая свеча";
         kerzen_shadow_up=High[bar]-Close[bar];
         kerzen_shadow_down=Open[bar]-Low[bar];
         kerzen_body=Close[bar]-Open[bar];
      }
   if (Open[bar]>Close[bar])
      {
         kerzen_typ=-1;
         kerzen_name="медвежья или черная свеча";
         kerzen_shadow_up=High[bar]-Open[bar];
         kerzen_shadow_down=Close[bar]-Low[bar];
         kerzen_body=(Open[bar]-Close[bar]);
      }
   if (Open[bar]==Close[bar])
      {
         kerzen_typ=0;
         kerzen_name="додж";}  
         kerzen_shadow_up=High[bar]-Open[bar];
         kerzen_shadow_down=Close[bar]-Low[bar];
      }
//определение соотношения тени к телу свечки      
if (kerzen_body==0)
      {
         kerzen_shadow2body_up=kerzen_shadow_up;
         kerzen_shadow2body_down=kerzen_shadow_down;
         }
if (kerzen_body!=0)
      {
         kerzen_shadow2body_up=kerzen_shadow_up/kerzen_body;
         kerzen_shadow2body_down=kerzen_shadow_down/kerzen_body;
      }     
 
//---- done
   Comment  (
               "Контрольный бар типа ",kerzen_name,"\n",
               "Верхняя тень - ",kerzen_shadow_up*10000," в ",kerzen_shadow2body_up, " раз больше","\n",
               "Тело - ",kerzen_body*10000,"\n", 
               "Нижняя тень - ",kerzen_shadow_down*10000," в ",kerzen_shadow2body_down, " раз больше"
            );
   return(0);
  }
 
gabba:

Greetings!

I'm trying to display information about a previous candle (non-zero bar) - bullish or bearish candle, size of its body and shadows and ratio of shadows to the candle's body.

But it doesn't output a stone flower. It outputs wrong values.


Why do I need a cycle if I only take 1 bar? Just use 1 instead of "bar". Only check for new bars so that you don't have to recalculate everything on every tick.
 
Cruc:


And if a stop or profit is triggered, it will go below zero, if I'm not mistaken - -1 ?

How do I set the condition correctly ? Can you give me a hint?

one more time.

The simplest variant (schematic)

if (ticket > 0)
{
   OrderSelect(ticket, SELECT_BY_TICKET);
   if (OrderCloseTime() > 0)
   {
      // ордер закрылся
   }
   else
   {
      // ордер пока еще открыт
   }
}
else
{
   //первый запуск советника 
}
Reason: