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

 
KONDOR:


Next, I want to combine buying and selling. I have removed unnecessary constants, but there are three errors: "I can't attach an index to them, for example "CalculateOrders_1"?

i can't put an index on them, i can't use "CalculateOrders_1"? I am very grateful

 
frxmax:

Next, I want to combine buying and selling. I have removed unnecessary constants, but there are 3 errors: "I can't attach an index to them, for example "CalculateOrders_1"?

i can't put an index on them, i can't get it to "CalculateOrders_1"? I am very grateful

well if you have the body, then why write again... h ttps://book.mql4.com/ru/programm/structure

//ну так объединяйте!
if(....условие покупки....) {
     Ord_Close(Symbol(),OP_SELL);
     if(CalculateOrders(Symbol(),OP_BUY)==0)Ticket(OP_BUY);       
                            }


if(....условие продажи....) {
     Ord_Close(Symbol(),OP_BUY);
     if(CalculateOrders(Symbol(),OP_SELL)==0) Ticket(OP_SELL);
                            }
 
If it's not too much trouble, I'd like to give you the code for analysis.
Files:
beta.mq4  6 kb
 

Well, I think it should be that way too. and I think I do.

But it doesn't let me use the "CalculateOrders" function a second time, for example.

 
Grein:

It depends on what tasks you are going to solve and where your code is located in the EA's program body. No one is obliging us to keep the code in the start function!

The start() function is one of the three predefined in our code template. It should be present at least!, because the parent program - the terminal program (this is main(), the main), performing its main tasks, receiving a fresh quote from the server (roughly) just look into your function start and execute the code, which is in it, if it will just return(), then the start function will stop here.

It's a bit confusing how you put it... Show me the code that will work with ticks and open/close positions without the start function. The code of a full-fledged EA without the strat function?
 

I don't know how to program the graphical object to be displayed on several timeframes, for example on H1, H4 and days, while on other timeframes it was not visible at all. I can see it on only one timeframe, or on all of them at once. I don't know how to show it on several interesting timeframes.

ObjectSet(label, OBJPROP_TIMEFRAMES, OBJ_PERIOD_M1);

How do I add the required timeframes?

 

via a bit or " | "

OBJ_PERIOD_M1|OBJ_PERIOD_M5|OBJ_PERIOD_M15
 
Thank you very much for your prompt reply, I was already tortured)))
 
who has a proper converter for periods
 
everyone
Reason: