[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 415

 

Remove the extern from some of the parameters that are little used, and there will be no confusion.

Attention my questions:

Why do objects appear under candlesticks, what is the reason for this?

Can you remind me how to make a checkbox to price, what is the object property.

 
PapaYozh:

I'd say "about 80."

I'd say exactly 80. And sss2019 has everything right with the parameters. But what is this wild indicator with so many parameters???
 
Tried to put it in my place, it's also slow. Never saw anything from it, I only got Metatrader.
 
Sepulca:

I'll tell you exactly, there are exactly 80 of them. And sss2019 has everything right with the parameters. But what is this wild indicator with so many parameters?

That's the thing, it's correct, but it's still an error.
 

wrote a modification of the orders. When the price is reached, move the stoploss to the opening price level. Error 130 comes out. I don't understand what's wrong. I was able to write trailing orders before...

if (UseTrailing)
{ 
  for (int trall=0; trall<OrdersTotal(); trall++) 
  {
    if (!(OrderSelect(trall, SELECT_BY_POS, MODE_TRADES))) continue;
    if (OrderSymbol()!=Symb)continue;        
 
    if (Tip==0 && top!=1) 
       {
        RefreshRates();
        SLM=OrderOpenPrice();
        if (Bid-OrderOpenPrice() > WithoutLoss*Point   ) 
           {
           if (OrderStopLoss() < Bid-WithoutLoss*Point) 
              {
              OrderModify(Ticket_B, OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(), 0, Blue);
              top=1;
               }
         if (Fun_Error(GetLastError())==1)      // Обработка ошибок
         continue;                              // Повторная попытка
         return;                                // Выход из start()

            }
        }
 
    if (Tip==1 && top!=2) 
       {
        RefreshRates();
        SLM=OrderOpenPrice();
       if ( OrderOpenPrice()-Ask > WithoutLoss*Point) 
          {
          if (OrderStopLoss() > Ask+WithoutLoss*Point) 
             {
              OrderModify(Ticket_S, OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(), 0, Blue);
              top=2;
              }
         if (Fun_Error(GetLastError())==1)      // Обработка ошибок
         continue;                              // Повторная попытка
         return;                                // Выход из start()

           }
         }
 
Egori4:

wrote a modification of the orders. When the price is reached, move the stoploss to the opening price level. Error 130 comes out. I don't understand what's wrong. I was able to write trailing orders before...

You are working in a loop on all orders, but there is a variable Tip which never changes and nobody knows what it is equal to. Plus, you analyse one order and modify an entirely different one with the ticket stored in the Ticket_B or Ticket_S variable respectively
 
ilunga:
You work in a loop on all orders, but there is some variable Tip, which does not change and does not know what it equals. Plus you analyse one order and modify a completely different order with a Ticket_B or Ticket_S variable respectively
then I need to check also Order Type? (if Tip=0, then it is buy, if Tip=1 it is sell. and Ticket_B is open buy, Ticket_S is open sell)
 
Sepulca:


When you open a pending order, set an expiry time, say 23:59, the order will close by itself.

nt OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)

I tried to set expiration time in 24 hours (OrderOpenTime()+86400), but if the order opens an hour or two later, it will close later, too...
 

Good afternoon.People, someone please help with the WindowScreenShot function. For the 3rd day no one is answering((. Wrote the following script (see attached file).

In 2 words about the script. The script is intended for making screenshots of the current chart of the client terminal window. In the external variable extern datetime Time_bar the time of bar from which and up to the zero bar will be created (taking into account the right indent on the chart) is specified. In the line

int bar_number=iBarShift(NULL,0,Time_bar,true)

the serial number of the bar we have specified in the external variable extern datetime time_bar is searched for. The function itself, in the line

bool f=WindowScreenShot(name+".gif",1024,768,bar_number,Scale,View_graph)

Now here's the question... For simplicity, let's assume that we need to create a screenshot of the last two bars. Then, if the line

int bar_number=iBarShift(NULL,0,Time_bar,true)

is left unchanged, the result will be the following screenshot


That is, there is no bar in the screenshot (although the string

int bar_number=iBarShift(NULL,0,bar_time,true)

the bar number by time should be calculated)

If this line is presented in the following way

int bar_number=iBarShift(NULL,0,Time_bar,true)+2

you'll get the screenshot we wanted:

Question: why in case this string has the following form

int bar_number=iBarShift(NULL,0,Time_bar,true)

the screenshot is taken with a 2-bar shift to the right of the one specified in the above line?

P.S. In order not to clutter up the forum, thank you in advance for your reply
Files:
 
Egori4:
pardon me...there's no way to set the time (I can't figure out the format). i tried setting the expiry time in 24 hours (OrderOpenTime()+86400), but if the order opened an hour or two later, it closes later too...


I would try it like this:

exp=iTime(Symbol(),PERIOD_D1,0)+86340;
Where iTime(Symbol(),PERIOD_D1,0) is the open time of the day bar, and 86340 is 23 hours 59 minutes in seconds.
Reason: