[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 93

 
coronel:

Here's a tip.

There's a cool trick in the editor - the F1 hint.

Highlight the function you're quashing and press F1.

Help will open, and you should carefully study what the parameters of the function should be.

Don't miss the quantity and quality of parameters fed into the function.


Thank you!
 
100yan:

Please HOW to close an order correctly in parts at different times and once? I've been struggling for days...

https://www.mql5.com/ru/forum/131277/page69

If the position's lot after a partial close is smaller than before the close, and the bar at which the partial close occurred has not changed, then do not close again. This is one of the many ways to close part of a position "once" on the current bar.

You define your own criteria for closing a position (a part of a position), and then we will help you if you are not sure.

 

Hello.

Can you tell me how to make an alert appear after a given number of minutes?

I would like to use Time[], but I can't figure it out, so I did the following: Sleep(60000*step);.

Working frame M1

extern int  step = 3;   // периодичность появления алерта мин.

static int        prevtime = 0;
//-------------------------------------------
int start()
  {
   if (Time[0] == prevtime) return(0);
   // Запомним текущий бар
   prevtime = Time[0];
//-------------------------------------

   Alert ("прошло ",step," мин.");
   
   //Sleep(60000*step);

//--------------------------------------
   return(0);
  }


 
Zar:

Hello.

Can you tell me how to make an alert appear after a given number of minutes in the expo?

I would like to use Time[], but I can't figure it out, so I've done this: Sleep(60000*step);.

Working frame M1

 extern int  step = 3;     // периодичность появления алерта в мин.
 datetime  LastAlertTime;

//-------------------------------------
 int start()
  {
//-------------------------------------
       if(TimeCurrent() - LastAlertTime > step*60)
        {    
          Alert ("прошло ",step," мин.");
          LastAlertTime=TimeCurrent();  
        }
//--------------------------------------
   return(0);
  }
 
coronel:

Thank you, it's working.
 
artmedia70:

If the lot of the position after the partial close is smaller than before the close, and the bar on which the partial close occurred has not changed, then do not close again. This is one of many ways to close part of a position "once" on the current bar.

If you define the criteria to close the position (its part), we will help you if you are not sure.


+ sergeev - Thank you for your feedback!

The problem is described here https://www.mql5.com/ru/forum/131277/page69 In brief, the idea is to open an order and close it partially when certain TP levels are reached. The problem is that we trade on M5 - M30 and the order is closed not on bars, but on a much longer period (D1, etc.). Once TP1 is reached, the closing prameter for the 1st part is triggered, etc. I can't find a solution on how to identify the parts so as not to close the whole order. (My first thought was to set TR1, but later the price has been walking and giving closing signals for other parts...)

Thanks in advance!

 
100yan:


+ sergeev - Thanks for your feedback!

The problem is outlined here https://www.mql5.com/ru/forum/131277/page69 In brief the idea is to open an order, and close it in parts when certain TP levels are reached. The problem is that we trade on M5 - M30 and the order is not closed on bars, but on a much longer period (D1, etc.). When TP1 is reached, the closing prameter for the 1st part is triggered, etc. I can't find a solution on how to identify the parts so as not to close the whole order. (My first thought was to set TR1, but the price has been changing and gives signals for closing other pips...)

Thanks in advance!

Create flags, e.g.

For TP1 - bool TP1, for TP2 - bool TP2, etc. ...

Initially their values are false.

Before another closing, you do a check:

if (!TP1) {code for partial closing of the first part, after a successful closing write TP1=true}

if (!TP2) {code for partially closing the second part, after a successful closing write TP2=true}

... and so on for all parts...

so the flags will signal that each part has already been closed once...

 
How do I get the closing value of bar 3 from zero?
 
ScioMe:
How do I get the closing value of bar 3 from zero?
  double Bar3Close = iClose(NULL,0,3);   
 
Thank you, can you do this: Close[3]?
Reason: