Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 438

 
tara:

Is your code particularly secret, or are you too lazy to post it?

The error is in it, not in the environment, imho.



double p1;
int p;

bool Х;// о.зарылся по СТОПУ
bool N;// значение Х1 не меняется
bool N1;//значение Х не меняется 
int ot;

int pY2;
int pY3;

int start()  
 {
int pY=Bars;    //  ЕСЛИ ОСТАВИТЬ ТОЛЬКО ЛЮБУЮ ОДНУ ИЗ ПЕРЕМЕННЫХ pY ИЛЛИ pY1,(и соответственно изменить некоторые дальнейшие строки)ТО ПРОГРАММА КОРРЕКТНО РАБОТАЕТ В СООТВЕТСТВИИ С ЗАМЫСЛОМ.
int p=pY%3337; //А КОГДА ПЕРЕМЕННЫЙ 2 ,ТО УПРАВЛЕНИЕ В ЭТИ ПЕРЕМЕННЫЕ И ДАЛЕЕ ПОПАДАЕТ ПОЧЕМУ-ТО НЕ НА КАЖДОЙ СВЕЧЕ КРАТНОЙ  3337 и 3204,А ПО НЕПОНЯТНОМУ МНЕ АЛГОРИТМУ

int pY1=Bars+239;
int p2=pY1%3204;         //ОСТАТОК ОТ ДЕЛЕНИЯ
          
ot = OrdersTotal(); 
if (ot>0)               
 {              
   if (OrderSelect (ot-1,SELECT_BY_POS))                
      if ( OrderType ()==OP_SELL||OrderType ()==OP_BUY)                 
        int last = iBarShift (Symbol (),0,OrderOpenTime () );   
 }
if ( p2<1||p<1)        

{                           // СЮДА УПРАВЛЕНИЕ ДОЛЖНО ПОПАДАТЬ НА КАЖДОЙ ОЧЕРЕДНОЙ СВЕЧЕ ТФ 5 МИН КРАТНОЙ 3204 ИЛИ 3337 НО ПОПАДАЕТ НЕ НА КАЖДОЙ ОЧЕРЕДНОЙ СВЕЧЕ ТФ 5 МИН.
p1=Open[0];//нужно привести ключи в исходное положение
 N=true;
 N1=true;
 
}
//---------------------------------------------------------------
if(p1 - Bid >=1500*Point && N==true)   
{
Х= false;                            
N1= false;                                    


}
//---------------------------------------------------------------                                    
if(Bid - p1  >=300*Point && N1==true)    

N = false;            

//---------------------------------------------------------------
if(ot==0||last>0
&& p2<1||p<1
&&Х== false)
{
OrderSend(Symbol(),OP_BUY,0.1,Ask,1,Bid-1500*Point,Bid+300*Point,"jfh",1 );                                    
Х=true;                                   
N=true;
N1=true;

}
                           
return(0);
}
 
solnce600:



I mean the whole code.
 
tara:

I mean the whole code.

That's it... there's nothing else.

The point is to open an order

- on a multiple of 3337 or 3204

- on a candlestick multiple of 3337 or 3204 BUT ONLY after a "virtual" STOP LOSS

NOTE: the second candle is "virtually" shifted by 239 bars.

 

Got it.

I'm going to bed, and tomorrow, if you want to, you can tell me what you need, OK?

 
tara:

Got it.

I'm going to bed, and tomorrow, if you want, you can tell me what you need, OK?

Just a little late..... Good night!

Looking forward to seeing you awake....... but hopefully not tomorrow but tonight.

 
Zver4991:

I can't figure out what my mistake is again


now=Open Time[0] ;
 
Hello. Please tell me how to fix the following situation: I have a variable high1, its task (according to the plan) is to show maximum values only for the first 7 bars from the beginning of the day. Please advise how I can bring it to my senses, so that until the end of the day, or a given time (so it would be better) it does not change the indicators. Thank you in advance.
double high1   =High[iHighest (Symbol(), Period(), MODE_HIGH, 7,1)];
 
xxxKillxxx:
Hello. Please tell me how to fix the following situation: I have a variable high1, its task (according to plan) is to show maximal values only for the first 7 bars from the beginning of the day. Please advise how I can bring it to my senses, so that until the end of the day, or a given time (so it would be better) it does not change the indicators. Thank you in advance.

At a rough guess, something like this:

     DayTime = iTime(NULL, PERIOD_D1, 0);             // Начало времени в секундах текущего дня
     cb = iBarShift(NULL,0,DayTime);                  // Получим на текущем ТФ индекс бара 
     if(cb>=7)                                        // Есть 7 сформированных баров от начала дня
         high1 = High[iHighest (Symbol(), Period(), MODE_HIGH, 7, cb-6)];

We also need to add a condition to track day changes, but that's up to you.

 
pu6ka:

At a rough guess, something like this:

We also need to add a condition to track the change of day, but that's up to you



Thank you very much, can you tell me what consequences I may face if there is a "hole" in the chart (missing candle)?

 
xxxKillxxx:



Thank you very much, but can you tell me what consequences may occur if there is a "hole" on the chart (no candle) ???

iBarShift() in case of a "hole" by default returns the shift of the nearest bar (downwards index). I.e., if there is no bar at 00:00, at 00:01, there is no bar at 00:02, at 00:03, etc., then 7 bars formed at the 15th minute will appear. You can have iBarShift() return -1 in holes, depending on what you need.

Reason: