[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 504

 
DDFedor >>:


та переменная, которую вы создадите. к которой будете обращать и с которой будете работать. прочитайте про глобальные переменные - все сразу станет понятно. https://docs.mql4.com/ru/globals

Can you explain to me what you said in the link you cited? I mean, answer my question specifically in your own words.

 
To save time, put in your script or the part in question and we will correct it to GlobalVariable. This way you will understand more quickly.
 
zhuki >>:
Чтобы сэкономить время положите свой скрипт или ту часть о которой идёт речь,а мы её поправим на GlobalVariable. Так вы быстрее поймёте.

The script can be put down, but have I not explained it clearly? Tell me what you don't understand, please

 
Oper >>:

Скрипт то положить можно,но неужели я невнятно и тупо объяснил?Скажите,что непонятно вам,пожалуйста

You just don't understand the difference between an external variable and a global variable, and without that it's useless to explain anything to you.

By the way, there is also a difference between global variable and globally declared variable and it's also quite significant,

So, you better send us the script and someone will correct it for you.

 
You need to save the variable to GlobalVariable like this.
GlobalVariableSet("Variable",Value(double));
when you need it at next run you can check if it exists so
GlobalVariableCheck("Variable");
And take its contents so
...=GlobalVariableGet("Variable");
And use as needed. The save time in GlobalVariable is 14 days and then it will be overwritten.
Access to GlobalVariable is common for all scripts and Expert Advisors, so the name should be unique.
 
jokonda >>:
Всем привет! Только начинаю работать в Excel, научилась боль-мень обращаться с формулами. А сейчас нужно сделать ссылку на имя и не получается. Подскажите, пжлста -
напрм, в одной ячейке название, в соседней примечание, а в третьей ячейке нужно сделать ссылку или формулу, которая бы объединяла первые две ячейки.
И чтоб потом копировать текст в первую и вторую, а они объединеные отражались в третьей.

Only your own experience will help you, take your time and learn.

 
Urain >>:

Вы просто не поняли разницу между внешней переменной и глобальной, а без этого пояснять вам что либо бестолку.

Кстати там есть ещё разница между глобальной переменной и переменной обьявленной на глобальном уровне и она тоже довольно существенная,

так что лучше выкладывайте скрипт вам его поправят.

Thank you for the information.

 
zhuki >>:
Нужно сохранить переменную в GlobalVariable так.
GlobalVariableSet("Переменная",Значение(double));
когда она понадобиться при следующем запуске можно проверить существует ли она так
GlobalVariableCheck("Переменная");
И взять её содержимое так
... =GlobalVariableGet("Переменная");
И использовать по необходимости. Время сохранения в GlobalVariable 14 дней потом затрётся.
Доступ к GlobalVariable общий для всех скриптов и советников,поэтому имя должно быть уникальным.

Thank you, that's helpful.

 
Hello!

Here is the block to open a buy position. The position opens at the nearest tick up.

int start()
{
double bid =MarketInfo("GBPUSD",MODE_BID);
double ask =MarketInfo("GBPUSD",MODE_ASK);
double point =MarketInfo("GBPUSD",MODE_POINT);

int tick=OrderSend("GBPUSD",OP_BUY,0.01,ask,3,bid-30*Point,bid+30*Point);
if(tick==-1)
{
Alert ("Error #"+GetLastError();
}
else Alert ("Position opened");
return;
}

But the catch is that after opening a position, with the next tick upwards, another one opens and another one opens (without waiting for the first one to close)...
How do I write it so that a new trade (the same one) is opened only after the execution of the first one, and not on every subsequent tick upwards?
How to write that after the execution of the conditions (any - loss / profit) of the first deal, the deal will be opened with different conditions and / or the opposite?

Thanks in advance!
 
Lim1 писал(а) >>
Hello!

Here is the block to open a buy position. The position opens at the nearest tick upwards.


But the snag is that after opening a position, at the next tick up, another one opens and another one opens (without waiting for the first one to close)...
How do I write so that a new trade (the same one) is opened only after the first one is executed, and not on every subsequent tick upwards?
How to write that after the execution of the conditions (any - loss / profit) of the first deal, the deal would be opened with different conditions and / or the opposite?

Thanks in advance!
bool IsPosOpen=false;

int start()
{
double bid =MarketInfo("GBPUSD",MODE_BID);
double ask =MarketInfo("GBPUSD",MODE_ASK);
double point =MarketInfo("GBPUSD",MODE_POINT);

if(IsPosOpen==false)
{
   int tick=OrderSend("GBPUSD",OP_BUY,0.01,ask,3,bid-30*Point,bid+30*Point);
   if(tick==-1)
   {
      Alert ("Ошибка № "+GetLastError());
   }
   else 
   {
      Alert ("Позиция открыта");
      IsPosOpen = true;
   }// end else
}// end if
return;
}// end start
Reason: