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

 
Sepulca:

Trolling you)))) You have a charismatic personality))))
Thanks for the compliment, would love to know where the legs are coming from.
 
bistreevseh:
I think this is the part of the code that may cause the problem, thank you so much in advance.


Just off the top of my head

if Work=FALSE, the EA will not work.

The EA will not work if there is at least one pending order, there is no check on MAGIC.

Are you getting any replies?

 
MisterD:

It doesn't work, because the variables, which you want to fix to a global level, i.e. before the Start function... For example these and so on.... " FiksiruemUp = True; // fix " and "iksiruemUp = False; // reset"
If you don't switch between timeframes, it should work...


I did so with the variables, I put them on the global level.

if you take into account the following point:

when the price is above the top line, it assigns True to FiksiruemUp, after the price becomes below the top line and still above the middle line, what will be assigned to FiksiruemUp: True or False?

It seems to me that in this situation it automatically assigns False, because False has been assigned to it in the global variables, while True is assigned only when the price is above the upper line.

 
Global variables are of type double and only double. You should keep this in mind when you put a bool in global variables.
 
Sepulca:


Right off the bat

if Work=FALSE the EA will not work.

The EA will not work if there is at least one pending order, there is no check for MAGIC.

Does it give you any signals?


The advisor works, i.e. opens orders, gives alerts about opening and triggering tp or sl, it does not put pendants either
 
Sepulca:
Global variables are of type double and only double. You should keep this in mind when you put a bool in global variables.

and yet, how should it be?
 
Sepulca:
Global variables are of type double and only double. You should keep this in mind when you put a bool in global variables.

we're not talking about GlobalVariables here, we're talking about variables at the global level.... reread this point, there is a difference....
 
belck:


I did so with the variables, I put them on the global level.

if you take into account the following point:

when the price is above the top line, it assigns True to FiksiruemUp, after the price becomes below the top line and still above the middle line, what will be assigned to FiksiruemUp: True or False?

It seems to me that in this situation it automatically assigns False, because it has been assigned False in the global variables, while True is only assigned when the price is above the top line.


Initially, if nothing is specified at global level, the value will be False.... After the variable is set to True, it will have this value until the following condition if (Ask < LineS) FiksiruemUp = False; // reset.... If the condition is met, the variable will be assigned the new value False and will remain so till the moment - "when the price is above the upper line, it assigns True to FiksiruemUp" and so on... I hope I explained it clearly... :)
 
MisterD:

Initially, if nothing is specified at global level, the value will be False.... After the variable is set to True, it will have this value until the following condition if (Ask < LineS) FiksiruemUp = False; // reset.... If the condition is met, the variable will be assigned the new value False and will remain so till the moment - "when the price is above the upper line, it assigns True to FiksiruemUp" and so on... I hope I explained it clearly... :)

I understand now. thank you very much.
 

Friends, help me out. I need to close all orders on a selected currency pair. Here's what I wrote (part of EA's code):

int Zakrit_vse()

{

Total=OrdersTotal();

int Vsego;

for(int i=1; i<=OrdersTotal(); i++) // Loop through orders, close all

{

if (OrderSelect(i-1,SELECT_BY_POS)==true)

{

if (OrderSymbol()!=Symb)continue;

Ticket=OrderTicket();

Lot=OrderLots();

Price=OrderOpenPrice();

Vsego++;

Tip=OrderType();

Alert(Tip);

if(Tip>1)

{

OrderDelete(Ticket);

Prov_oshibok();

continue;

}

if(Tip==0)

{

OrderClose( Ticket,Lot, Bid,100);

Prov_oshibok();

continue;

}

if(Tip==1)

{

OrderClose( Ticket,Lot, Ask,100);

Prov_oshibok();

continue;

} //

}

}

Alert(Total," ",Vsego);

int ret=MessageBox("Operation complete successfully",

",MB_OK|MB_ICONQUESTION|MB_TOPMOST);

if(ret==IDOK) // if the answer is "yes"

{

Print("All orders in the amount of ",Vsego," successfully closed;)

}

}

But for some reason only every second order is closed. If there are 6 orders, 3 are closed, if there are 8-4, etc.

What may it be? What is the error, please advise?

Reason: