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

 
Alexey Viktorov:

The code is great, but there's still one thing we don't understand

We've created an object, assigned it a price level (let's say the price of the last open +500 pips up for the buy grid)

and I manually dragged it down

How then will look the condition "if a bid is above the line to cover all" It should be somewhere to save its current position according to the given moves, i.e. the opportunity to obtain the price level at which it is located.

according to the scheme

-request of price in the tick

--If it does not meet the closing conditions

-- leave everything as it is

and as I understand it is necessary to bind a separate text for the marking

 
igrok333:
How to make a bid line in a custom indicator?

I write it like this

      ObjectCreate("line",OBJ_HLINE,windowIndex,0,Bid);
              
      ObjectSet("line",OBJPROP_COLOR,Red);
      ObjectSet("line",OBJPROP_WIDTH,1);

      WindowRedraw();  

But it's built once and it's already there. it's static.
I need it to change with every tick, like a bid line on a price chart.
Read about ObjectMove().
 

Good afternoon!

Can you tell me a simple thing?

Can I draw the indicator only through the indicator array or are there other ways to bind to the chart?

The question is as follows - I am collecting an array of dates for which I then want to draw the marks. It turns out that for this I will need to search through the time[] array. Are there any other ways to draw the corresponding marks on the chart?

 
Anttonnio:

Good afternoon!

Can you tell me a simple thing?

Can I draw the indicator only through the indicator array or are there other ways to bind to the chart?

The question is as follows - I am collecting an array of dates for which I then want to draw the marks. It turns out that for this I will need to search through the time[] array. Are there any other ways to draw the corresponding marks on the chart?

You can draw the arrows yourself as OBJ_ARROW

there is no need to create indicator buffers for every sneeze :-)
 

Help with code snippet for an EA!

How can I delete previously placed pending orders which are more than 200 pips away from the current price?


The OrderDelete function is bound to the order number! And the order number can be unknown at the moment of deletion!

 
Anton Sokolov:

Help with code snippet for an EA!

How can I delete previously placed pending orders which are more than 200 pips away from the current price?


The OrderDelete function is bound to the order number! And the order number can be unknown at the moment of deletion!

In the loop, go through all of the orders, apply OrderSelect, apply OrderTicket to the orders, and then delete by ticket. How the number of the ticket can be unknown in such a case, I somehow can't even imagine.

The codebase is just stuffed with code examples, search and you will find even more than you were looking for.

 

1. Is there any handy tool for synchronizing Expert Advisors, indicators and scripts between terminals? (for example, I program on one terminal, then I need to send the Expert Advisor to the terminals I trade on)

2. Is there an example ofautomatic updating(loading a new version) of an EA on a working chart?

 
Anton Sokolov:

How does the OrdersTotal function calculate orders?

Suppose I have 10 open orders (variously buy and sell) and 10 pending orders (variously buy limit and sell limit, buy stop and sell stop).

The opening and placing of pending orders is done randomly.

Which of them will be the first to be placed? What starts the countdown from?

Run this code and read the log

bool flag=true;

void OnTick()
{
//--
if(flag)
  {
  for(int i=0; i<OrdersTotal(); i++)
   {
   if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
    {
     Print(i," = ",OrderOpenTime());
    }
   }
  flag=false;
}

//-
}
 
Anton Sokolov:

How does the OrdersTotal function calculate orders?

Suppose I have 10 open orders (variously buy and sell) and 10 pending orders (variously buy limit and sell limit, buy stop and sell stop).

The opening and placing of pending orders is done randomly.

Which of them will be the first to be placed? What is the starting point of the count?

Somewhere in the help the developers said that no ordering is guaranteed.
 
Vladimir:
Somewhere in the help, the developers said that no sorting is guaranteed.

There is always an ordering on the ticket. The ticket of a later order will never be smaller than that of an earlier order (by time of opening).

And if we search amongst the pending orders, then just in order - the order with number 0 - is the oldest order, and the order with number OrdersTotal()-1 will be the most recent order (again, by open time), without taking into account the type.

In the history of closed orders, it still depends on the sorting in the history tab of the terminal window.

Reason: