Questions from Beginners MQL5 MT5 MetaTrader 5 - page 823

 
User_mt5:

Can you please tell me how to understand this?

The price went many times on these orders, eventually went up, but none of the orders ever became a position. Why?

If it is written somewhere, please give me a link.


There were not enough lots to execute the order.

As far as I know, and I know a little about this subject, you have to put limiters well above the current price.

 
Vladislav Andruschenko:

There were not enough lots to execute the order.

I suppose so, too. But what's next? We cannot delete or modify the order. So, they will hang there for ever?
I do not understand what it means when there are not enough lots on the demo.

Vladislav Andruschenko:

as far as I know, and knowing me a little on the subject, you have to put limiters well above the current price.

No, this is not correct. You can place an order anywhere within the current limits. There is a StopLevel limit. That is, you can't place the order closer to the price than the value of StopLevel.

But if the server accepts it, it means that everything is OK.

 
User_mt5:

I think so too. But what should we do next? We cannot delete or modify the order. So, they will hang there for ever?
And we do not really understand what it means when there are not enough lots on the demo.

No, that is incorrect. An order can be placed anywhere within the current limits. There is a StopLevel limit. That is, you can't place the order closer to the price than the StopLevel value.

But if the server accepts it, it means that everything is OK.


It is a little different in the exchange.

 
Vladislav Andruschenko:

it's a little different on the stock exchange...

Vlad, what exchange? You can see which company's demo is open...

 
Alexey Viktorov:

Vlad, what exchange? You can see which company's demo is open...


I meant futures. No, I'm confused. Ignore me. I'm on the pill right now.

 
Alexey Viktorov:

Vlad, what exchange? You can see which company's demo is open...?

Could you please explain the content of that comment, because I'm new to this.
By the way, I've pressed the "Buy" button, the order was not executed, but it was shown as... sort of pending in the Toolbox window but not in the chart.
 
User_mt5:
Could you please explain the content of this comment, because I'm new to this business.
By the way, I poked the Buy button, the order did not execute, but it appears as... sort of pending in the Instruments window, but not in the chart.
What is there to explain? In the screenshot you can see the account number and the name of broker that has nothing to do with the exchange.
 
Alexey Viktorov:
What's there to explain? In the screenshot you can see the account number and the name of a broker who has nothing to do with the exchange.

I don't understand.

If this broker will not let me trade on this symbol, then why did he include it in the list of symbols on the demo?
And if so, how should we understand the current situation with the orders?

Well, what if the order was executed partially (it may happen on 5 symbols), then what should happen to the order left?
Does it have to be closed or live until it is manually closed, or until it is executed?
If it is written somewhere, I would be very grateful for a link.

 
User_mt5:

I don't get it...

If this broker won't let me trade on this symbol, then why did he include it in the list of symbols on the demo?
And if he does, how should we understand the current state of affairs with orders?

Well, what if the order was executed partially (it may happen on 5 symbols), then what should happen to the order left?
Does it have to be closed or live until it is manually closed or until it is executed?
If it is written somewhere, I would be very grateful for a link.

Don't try to drag me into a discussion about how the offices work. Especially as I severed all relations with this one many years ago and know nothing about it.

 
Vladimir Karputov:

A rough algorithm:

  1. We create two handles in OnInit() (for fast and slow Moving Average indicator )
  2. In OnTick() (recommended to work only on a new bar, not on every tick) declare two arrays - one of them will copy values from the fast MA, the second array will copy data from the slow MA.
  3. Copy for example 100 last values (i.e. we should copy data from index "0" and number "100") from slow MA and fast MA into these arrays.
  4. We invert the arrays so that index #0 in the arrays corresponds to the rightmost bar in the chart.
  5. Now we only need to loop from "0" to "100-1" through both arrays and look for the intersection. When we find the intersection, the value of the loop variable will be the bar number.
Note: this algorithm does not take into account any checks and error protections.

Thanks, how can I write the loop to find the number of the bar crossing the two MAs when the first two algorithm steps are completed and there are values of the two MAs on the first bar?

   MA1_1=iMAGet(handle_iMA_1, 1);      // значение 1-й МА

   MA2_1=iMAGet(handle_iMA_2, 1);      // значение 2-й МА

/

double iMAGet(const int handle,const int index)
  {
   double MA[];
   ArraySetAsSeries(MA,true);
//--- reset error code 
   ResetLastError();
//--- fill a part of the iMABuffer array with values from the indicator buffer that has 0 index 
   if(CopyBuffer(handle,0,0,index+1,MA)<0)
     {
      //--- if the copying fails, tell the error code 
      PrintFormat("Failed to copy data from the iMA indicator, error code %d",GetLastError());
      //--- quit with zero result - it means that the indicator is considered as not calculated 
      return(0.0);
     }
   return(MA[index]);
  }

.

Reason: