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

 

I have data in a file like this:

2016.01.21 19:39:07;6;22

2016.01.21 19:40:08;6;21

2016.01.21 19:41:08;6;20

That is the date and a couple of values that I want to display in the indicator.

Is there such a function so that the values are displayed by time and not by bar number?

 
flajelet:

I have data in a file like this:

2016.01.21 19:39:07;6;22

2016.01.21 19:40:08;6;21

2016.01.21 19:41:08;6;20

That is the date and a couple of values that I want to display in the indicator.

Is there such a function so that the values are displayed by time and not by bar number?


Well put the time in iBarShift() and then the value by bar number.
 
Good(o) evening, afternoon, morning - Could you please suggest a code - I need to output the value of the last closed order (whether it is positive or negative) - the code that I know shows only a previously specified position - for example 1 order in the history of closed orders - if a new deal is done - with a further close, its value is not checked and not output or if I indicate 0 then after the first one closed also is not checked in future - how to make sure it always checks the last closed order How do I do this? Thank you in advance.
 
nikelodeon:
Sultry to the point of tears..... :-) I'll be aware of that.
It would be good if they created a trawl function to close the position at max profit! And with the terminal turned off to sleep well! ;))
 

Help me find the reason for this.

Tried to make an indicator to show the opening levels of the day. However, this is what happens. When there is a test in the tester all is normal.

I cannot understand what is wrong. But when I try to put it on the chart I get just a parallel drawing on the D1 chart.


I do not understand what is wrong.

I do not understand what is wrong:

#property indicator_chart_window
#property indicator_buffers 1
#property  indicator_color1 Red

//inputs
extern double tf   =  1440;
extern int period  =  1;
extern int method  =  1;
extern int shift   =  0;

//buffers
double ma[];
double factor=0;
static int    DayNow=0;
double открытие_дня;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   if(Period()>tf)
     {
      Print("Wrong timeframe!");
      return(-1);
     }
   SetIndexBuffer(0,ma);
   SetIndexStyle(0,DRAW_SECTION,STYLE_DASHDOTDOT,1);
   SetIndexLabel(0,"MA "+tf);
   IndicatorShortName("Moving Average ("+tf+", "+period+")");
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {

   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int i=Bars-counted_bars-1;

   while(i>=0)
     {
      if(iTime(Symbol(),tf,i)>DayNow)
        {
         DayNow=iTime(Symbol(),tf,i);
         открытие_дня=iOpen(Symbol(),tf,i);
        }
      if(открытие_дня>0)
        {
         ma[i]=открытие_дня;
        }
      else
        {
         ma[i]=EMPTY_VALUE;
        }
      Comment(" открытие_дня = ",открытие_дня," i =",i);
      i--;
     }
   return(0);
  }
//+------------------------------------------------------------------+
 
001:

Help me find the reason for this.

Tried to make an indicator to show the opening levels of the day. However, this is what happens. When there is a test in the tester all is normal.

But when I put it on the chart, it just turns out to be a parallel drawing of the D1 chart.


I do not understand what is wrong.

Here is the code:


Add it to init()

SetIndexEmptyValue(0,EMPTY_VALUE);
 
Vinin:

Add in init()

Thank you!
 
How do I know the value of a bar in an indicator from its time (by bar time)?
 
001:
How do I know the value of a bar in an indicator by its time (by bar time)?

iBarShift

 
Vinin:

iBarShift

This is the sequence number, not the bar value.
Reason: