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

 
Trolls:

1. DC is a dealing centre. in principle. it is everyone who uses MT . (be sure to find in wikipedia what is a DC and a broker) read and compare how they differ.

2. Maybe (some brokerage companies) do not allow you to place a stop at once. you have to do it in two steps. first you enter the trade, then you place the stop.

in order to find out the exact cause of the problem, you may print the server's answer to the log. if you don't see the cause of the problem, the server will give you a code as the answer.

https://book.mql4.com/ru/build/errors

and be sure to read this https://www.mql5.com/ru/forum/131859/page9#473847

Thanks a lot. You may (some brokerage companies) forbid immediate stop. you have to do it in two steps. first you enter the trade, then the stop . You should have guessed it, manually I also had to open order first and then modify it setting stoploss and takeprofit.

Thanks to you for replying to my question. Thanks to you I now use the Print(GetLastError) function and know better the meaning of Point.

 
Question about the ZZ indicator. help with the code, how to find the current and previous upper extremum of ZigZag - thanks
 
T-G:
question about the ZZ indicator. help with the code, how to find the current and previous upper extremum of ZigZag - thanks

https://docs.mql4.com/ru/indicators/icustom

go through all the bars from 0 to the required one using

  double val=iCustom(NULL, 0, "ZigZag",12, 5, 3, 1, i);

12, 5, 3 - ZZ parameters

0 - for tops, 1 - for High, 2 - for Low (if its text is to be believed)

i - bar number

 

Good afternoon, I can not build a logical condition for opening orders, they open either by 150 units or do not open at all, or even in the visualization all stops, the ribbon does not run. I have read-read-read the help, my head is all overheated, I have no clue. Here is an example, what I am writing.

//+------------------------------------------------------------------+
//| for avalanche.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
extern double stoploss=0; extern double takeprofit=20; extern int otstup=20; extern datetime expiration=0;

//+------------------------------------------------------------------+
//| expert initialisation function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int tiket,tikett;double volume=0.1;int i=0,R1=0,R2=0,A=1 ;double price=PRICE_OPEN;
// R1=((PRICE_OPEN- stoploss*Point)*stoploss)/stoploss;R2=((PRICE_OPEN+ stoploss*Point)*stoploss)/stoploss;


int start()
{
//----
for(int Uy=OrdersTotal();Uy<=-1;Uy--){
OrderSelect( Uy,SELECT_BY_POS );
if(OrderSymbol()==Symbol()&&OrderMagicNumber( )==1000||OrderMagicNumber( )==2000 &&OrderSymbol()==Symbol())
{i=OrdersTotal() ;
if (i>=2){break;} else
tiket= OrderSend( Symbol(), OP_BUYSTOP, volume*A, price+otstup*Point, Point* 3, R1, PRICE_OPEN+takeprofit*Point+otstup, "OP_BUYSTOP", 1000, expiration, Red);
Alert ("OP_BUYSTOP", GetLastError( );
tikett= OrderSend( Symbol(), OP_SELLSTOP, volume*A, price -otstup*Point, Point* 3,R2, PRICE_OPEN-takeprofit*Point-otstup, "OP_SELLSTOP", 2000, expiration,C'0,128,255' );
Alert ("OP_SELLSTOP", GetLastError( );
} }

//----
return(0);
}
//+------------------------------------------------------------------+

 
I think I've got it figured out.
 
Dimka-novitsek:
I think I've got it figured out.

Use the SRC to insert programme text, it is impossible to read


from what you can see at a glance:

in the first loop for(int Uy=OrdersTotal();Uy<=-1;Uy--)

for now less than -1 orders? how is that?

 
Well, that's just to make sure it's not too little. He'll run another lap, he won't get a break. The car, let it count for itself.
 
ilunga:

https://docs.mql4.com/ru/indicators/icustom

go through all bars from 0 to the required one using

12, 5, 3 - ZZ parameters

0 for tops, 1 for High, 2 for Low (if his text is to be believed)

i - bar number

I understand that, I even know how to find the last one, but I can't find the last and penultimate one.
 
????????????????????????????
 

Use SRC to insert programme text, impossible to read

How do you use it? I don't know what it is at all.

Reason: