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

 
rapid_minus:
I think I understood it - the error is that I set global buycloseprice and immediately give it value 0.0. And although after opening a position it takes a specific value, when you turn off the terminal, this value is lost and when you turn it on it takes the original value, i.e. 0.0, and therefore the condition if(Bid>buycloseprice) is respected and the command to close. But how to translate this variable into a global terminal, I do not understand.

Yes, that's what I wanted to tell you. We need to change the order of working with the variable, since it is global at the code level, we should first assign it the necessary value and then compare it with Bid.

Rapid_minus:
On the loop: we have to set the first value of i to =1, right?

No. You have an example of a correct loop below the code:

for (int i=OrdersTotal()-1; i>=0; i--)

 
On condition and timeBar: condition is for the chosen strategy and timeBar is for opening one trade in a bar, not on each tick. I copied this from somewhere, I can't remember. It works.
 
rapid_minus:
On condition and timeBar: condition is for the chosen strategy and timeBar is for opening one trade in a bar, not on each tick. I copied this from somewhere, can't remember. It works.
Then I still need to arrange correct initialization ofbuycloseprice and sellcloseprice when loading the EA. If you want, write it in a file, if you want, in GlobalVariable. When loading, you can also recalculate all of the open positions of the EA, if any, determine the open price of the last of them and calculate the values ofbuycloseprice or sellcloseprice. This should be done at the beginning.
 
Probably a code-level solution with a global variable would not work, because whatever initial value you set it to, Asc or Bid will either be higher or lower than that value and will therefore close either Bai or Sells.
 
I will try to do without GlobalVariable and calculate all open positions of this EA if there are any. I will try to do without GlobalVariable, but following your advice when loading all open positions of this EA, if there are any, determine the opening price of the last of them and calculate thebuycloseprice or sellcloseprice value.
 
Hello
Can you please tell me how to transfer the terminal settings from a computer running "Windows XP" to a computer running "Windows 7"?
 
serg7765:   how to transfer the terminal settings from a computer with OS "Windows XP" on a computer with OS "Windows 7"?

more information in the topic Data directory can't open(Windows 7)

To switch from vin-xp (Hryusha) to Win-7 (Seven), just move the terminal folder and always start the terminal in portable mode. To do this, create (on desktop?) a shortcut to Terminal.exe file. Right-click on the shortcut and select Properties. After the word Terminal.exe add a space and the /portable key

If you run the terminal in Win-7 and higher, it will create MQL4 folders with owls, scripts and indulators. The names and location of folders are very complex

The portable mode is designed to run the program on someone else's computer. In this case, the program does not create extra folders and files on your computer. Everything is done in the folder from which the program is launched. It is convenient when you start the program from a flash drive.

There are tools to convert any (?) program to a portable form. You can find a suite of portable programs - even Microsoft Office! The FireFox portable browser allows you to carry it on a USB stick, along with your favourite settings.
 
LRA:

1. Move the terminal folder. 2. Run in portable mode as otherwise win-7 will drive MQL4 folder with owls and scripts very far away.

More details in the topic Data directory cannot be opened(Windows 7)

Thank you! I will give it a try. What is the "portable" mode?
I figured it out. It's working. Thank you! So it turns out that I can run the terminal from a flash drive on different computers and not bother with a bunch of terminals?
 
serg7765:
... So you can run the terminal from a flash drive on different computers and not bother with a bunch of terminals?
Yes, it can. But you have to leave more space for it, folders of history and logs are growing, I have more than 5 Gb of history, and once the unsupervised EA has filled the logs with errors on 20 Gb, it's good that it is not on a flash drive ))))
 
Good day! The old indicator has a prescribed cycle, it strongly overloads the terminal, please help me to rewrite it in a new way, so that bars are not constantly recalculated ... I am very grateful in advance!
int i,limit;
limit = Bars-2;
for(i=limit; i>0; i--)