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

 
artmedia70:
And ask int b


why int ? According to the manual, ObjectGet should be of type double, and in the iBarShift function b should be of type datetime
 
rustein:

Thanks, so changed ErrNum to ErrNumber and that's it? The warning is gone, everything will work correctly?


string ErrorDescription(int ErrNumber)
{
  switch (ErrNumber)
  {
You can see that you're "in the tank"... :)))
 
how do I draw a horizontal line between two points and a vertical line? ..... I'm telling you I need a rectangle to draw at a given price and time interval
 

Help me find an error... The names of the functions say it should do...

extern double LOT         = 0.1;
extern int Magic          = 77;
extern double MartinStep  = 1.5;


double GetLastOrderProfit()
{
  int time = 0; double profit = 0; 
  for(int i = OrdersHistoryTotal()-1; i>=0; i--)
  {
    if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
    {
      if(OrderSymbol() == Symbol()&& OrderMagicNumber() == Magic)
      {
        if(time<OrderCloseTime())
        {
          time=OrderCloseTime();
          profit=OrderProfit();
        }
      }
    }
  }
  return(profit);
}

//+------------------------------------------------------------------+
double GetLastLot()
{
  int time = 0; double Lot = 0; 
  for(int i = OrdersHistoryTotal()-1;i>=0;i--)
  {
    if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
    {
      if(OrderSymbol() == Symbol()&& OrderMagicNumber() == Magic)
      {
        if(time<OrderCloseTime())
        time=OrderCloseTime();
        Lot = OrderLots(); 
      }
    }
  }

  if(Lot <= 0) Lot = LOT;

  return(Lot);
}

//+------------------------------------------------------------------+
double GetLastTenOrdersProfit()
{
  double profit = 0; int count = 0; 
  for(int i = OrdersHistoryTotal()-1;i>=0;i--)
  {
    if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
    {
      if(OrderSymbol() == Symbol()&& OrderMagicNumber() == Magic)
      {
        if (count<10)
        {
          profit=profit+OrderProfit();
          count++;
        } 
      }
    }
  }

  return(profit);
}
//+------------------------------------------------------------------+
double GetLot()
{
  double Lot = 0; double n = GetLastLot();
  
  if (GetLastTenOrdersProfit() < 0 || GetLastOrderProfit() < 0)
  Lot = NormalizeDouble (n * MartinStep,2);
  
  if (GetLastTenOrdersProfit() >= 0 && GetLastOrderProfit() >= 0 )
  Lot = LOT;
  
  return (Lot);
}

 

Why can't I display a comment from the EA? I can't see anything at all.

void OnTick()
{
//---
Comment
("\n ",TimeToStr(Time[1]));
}

 
Alexandr24:

Why can't I display a comment from the EA? I can't see anything at all.

void OnTick()
{
//---
Comment
("\n ",TimeToStr(Time[1]);
}


In the tester or on the graph?
 
In the tester it shows up but the graph is empty, I suspect it's because it's off, but it's weird.
 
Exactly, a day off, no ticks, nothing strange.
 
Alexandr24:

Why can't I display the comment in the EA? Nothing is displayed at all.

void OnTick()
{
//---
Comment
("\n ",TimeToStr(Time[1]);
}


I output everything, but I don't use functions, I use a single loop at the start, in which everything is defined and calculated.

Inthe comment, everything via DoubleToStr()! And the functions slow down unnecessarily!

 
borilunad:


I output everything, but I don't use functions, I use a single loop at the start in which everything is defined and calculated.

Inthe comment, everything via DoubleToStr()! And functions slow down unnecessarily!


Thanks, I'll have to give it a try.