[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 283

 
artmedia70:
When you output buffer values to the screen, what do you do? You are outputting numerical data anyway. If you want to output an empty string, or "Empty Value" or "EMPTY_VALUE", output them as string variables.
I.e. :
string val;
if(buffer value==EMPTY_VALUE) {val="EMPTY_VALUE";}
But if(buffer value!=EMPTY_VALUE) {val=DoubleToString(buffer value, 8);}
and display the value of the variable val instead of the buffer value.
S[16]="SBUY="+ DoubleToStr(adxbuy,Digits)+", SSELL="+ DoubleToStr(adxsell,Digits)+", buydiv="+ DoubleToStr(lastbuydiv,Digits)+", selldiv="+ DoubleToStr(lastselldiv,Digits);
      
Here's how I output them
 

This tail is responsible for the output of this data:

", buydiv="+ DoubleToStr(lastbuydiv,Digits)+", selldiv="+ DoubleToStr(lastselldiv,Digits);

First like this:

string ValBuyDiv, ValSellDiv;
if (lastbuydiv=EMPTY_VALUE) ValBuyDiv="Пустое значение";
else ValBuyDiv=DoubleToStr(lastbuydiv,Digits);
if (lastselldiv=EMPTY_VALUE) ValSellDiv="Пустое значение";
else ValSellDiv=DoubleToStr(lastselldiv,Digits);

and then replace the tail:

S[16]="SBUY="+ DoubleToStr(adxbuy,Digits)+", SSELL="+ DoubleToStr(adxsell,Digits)+", buydiv="+ ValBuyDiv+", selldiv="+ ValSellDiv;
 
bliznec1986:
Does anyone have a tick collector that saves tick history as follows: tick arrival time, asc, bid? the codebase only has a tick collector without asc.
There is such. I won't post it. Used secret technology against tick skipping :-)) Including without DDE.
 

To artmedia70 and granit77.

You gentlemen are to be severely reprimanded. Couldn't you have explained it to me? ))))

It took me two days to solve a simple problem ....

This is what I got:

int SignalDiver(int tf)
 {
   for (int i=0; i<5; i++) {
      double UPdiver = iCustom(NULL,tf,"FX5_Divergence",2,i);
      double DNdiver = iCustom(NULL,tf,"FX5_Divergence",3,i);
      if (UPdiver!=EMPTY_VALUE)return(1);
      if (DNdiver!=EMPTY_VALUE)return(-1);
    }
  return(0);
 }

It works now.

Thank you.

Now I can go to the island with the girls....)))

 
Sergey_Rogozin:

To artmedia70 and granit77.

You gentlemen are to be severely reprimanded. Couldn't you have explained it to me? ))))

It took me two days to solve a simple problem ....

This is what I got:

Now it works.

Thank you.

Now I can go to the island with the girls....)))

Only this time it 's for three! :)))))))))
 
artmedia70:
Only this time for three! :)))))))))
Departure from Sheremetyevo tomorrow 09:10.
A cabin full of consenting girls for you.
Beer and sauna already in place, cognac and whisky in the cabin.
The plane and crew are all yours until Sunday midnight.
Have a nice rest. )))
 
Sergey_Rogozin:
Departure from Sheremetyevo tomorrow 09:10.
A cabin full of consenting girls for you.
Beer and sauna already in place, cognac and whisky in the cabin.
The plane and crew are all yours until Sunday midnight.
Have a nice rest. )))
О! Those aren't the words of a child, but of a husband!!! Off we go... :))))))))))))))
[Deleted]  
Hello, please help to implement virtual stop-losses in specified points. To be more precise: instead of sending data about a new SL, the EA should just store it in variables (or somewhere else), and waste, waste, waste, and when the price reaches a certain level (price) to send a signal to DC to close the order, (a kind of virtual trailing stop with a virtual stop-loss) is it real?
 
Sergey_Rogozin:
Departure from Sheremetyevo tomorrow 09:10.
A cabin full of consenting girls for you.
Beer and sauna already in place, cognac and whisky in the cabin.
The plane and crew are all yours until Sunday midnight.
Have a nice rest. )))

You live beautifully!

[Deleted]  

Good afternoon everyone!

I can't quite figure out how to close orders...

The order is successfully opened, but is not closed. The program only opens one order. Who has a minute and desire, look at the code please...

int send_orders(bool signal, int position_limit, string file_name){


int ticket_count = OrdersTotal();


if (ticket_count < position_limit){

Print("send_orders ticket_count = ", ticket_count);

if (signal == true){

Print("send_orders, signal BUY");

   order_id = OrderSend(Symbol(),OP_BUY,1.0,Ask,3,0,0,"expert comment",255,0,Green);
   if(order_id < 0)
     {
      error=GetLastError();
      Print("send_orders, error = ",ErrorDescription(error));
      return;
     }
}if (signal == false){

Print("send_orders, signal SELL");

   order_id = OrderSend(Symbol(),OP_SELL,1.0,Bid,3,0,0,"expert comment",255,0,Red);
   if(order_id < 0)
     {
      error=GetLastError();
      Print("send_orders, error = ",ErrorDescription(error));
      return;
     }
     }

}if (ticket_count == position_limit){

OrderSelect(0,SELECT_BY_POS);

order_type = OrderType();

order_id = OrderTicket();

//----

Print("send_orders,  order already open");

if ((signal == false) && order_type == OP_BUY){

Print("send_orders,  is closing position");

if(OrderSelect(0, SELECT_BY_POS)==true){

OrderClose(OrderTicket(),1,Ask,3,Red);

}

}if ((signal == true ) && order_type == OP_SELL){

Print("send_orders,  is closing position");

if(OrderSelect(order_id, SELECT_BY_POS)==true){

OrderClose(OrderTicket(),1,Bid,3,Red);

}
}
}
}

Thanks in advance!