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

 
doon:

Have you used this function? Can you show me the code or how you would do it, because I think I'm getting stupid in the easiest place

No, I don't. In any case, the error is not in the function, but before it.
 
DhP:
Above your post is edit/delete
All my posts have / above, but this one doesn't! And there's no reply button at the bottom
 
DhP:
No, I don't. In any case, the error is not in the function but before it.


There was also an error:

't' - variable not defined, so it's a variable. I can't figure out what to do with it.

 
globad:
All my posts have one, but this one doesn't! And there's no reply button at the bottom.
Then it's not your post....))))
 
DhP:
Then it's not your post....))))
))))))))))))))))))))))))))))))
 

Hi all! Please help me combine the following things. The result should be: two lines following the price, one lower than Ask by 20 pips..,

the other one is higher. Besides, I get a beep if price changes by 20 points per 1 tick.

All works fine separately. Thanks in advance!

1) The line below the Ask by 20 pips.

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int start()
{
ObjectCreate("MyPriceLine", OBJ_HLINE, 0, 0, Ask-20*Point) ;
ObjectSet("MyPriceLine", OBJPROP_PRICE1, Ask-20*Point);
return(0);
}

//+------------------------------------------------------------------+

2) The line is 20 pips above the Ask.

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int start()
{
ObjectCreate("MyPriceLine", OBJ_HLINE, 0, 0, Ask+20*Point) ;
ObjectSet("MyPriceLine", OBJPROP_PRICE1, Ask+20*Point);
return(0);
}

//+------------------------------------------------------------------+

3) Rate of price change over time.

#property show_inputs

extern int pips=2; //изменение аск
extern double Time_=0.1; //c. ~ tick
extern bool все_из_обзора_рынка=true; // только текущий символ - false

int i, l, p, количество_символов;
string val[], на_экран;
int Ask_save[];

//+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
void start(){
количество_символов=SymbolsList(val, true);//запись в массив val инструменты и их количество вызов функции SymbolsList
ArrayResize(Ask_save,количество_символов);
if(количество_символов == -1){ Alert("Ошибка открытия файла в SymbolsList(string &Symbols[], bool Selected)"); return;}
if(!все_из_обзора_рынка){
количество_символов=1;
ArrayResize(Ask_save,количество_символов);
ArrayResize(val,количество_символов);
val[0]=Symbol();
}

while(true&&!IsStopped()){ //если разрешить и не отанавливать скрипт продолжим

Alert("пересчитаем через "+Time_+" сек.");

for(i=0;i<количество_символов;i++){//посчитаем стоимость спреда для инструментов из обзора рынка
if((Ask_save[i]-MarketInfo(val[i],MODE_ASK)/MarketInfo(val[i],MODE_POINT))>=pips){
Alert(val[i]+","+Period()+" изменился вниз на "+DoubleToStr((Ask_save[i]-MarketInfo(val[i],MODE_ASK)/MarketInfo(val[i],MODE_POINT)),0)+" pips");
PlaySound("timeout.wav");
}
if((MarketInfo(val[i],MODE_ASK)/MarketInfo(val[i],MODE_POINT)-Ask_save[i])>=pips){
Alert(val[i]+","+Period()+" изменился вверх на "+DoubleToStr((MarketInfo(val[i],MODE_ASK)/MarketInfo(val[i],MODE_POINT)-Ask_save[i]),0)+" pips");
PlaySound("email.wav");
}
Ask_save[i]=MarketInfo(val[i],MODE_ASK)/MarketInfo(val[i],MODE_POINT);
}
Sleep(Time_*1000);//пауза сек.
}

/*
количество_символов=SymbolsList(val, true);//запись в массив val инструменты и их количество вызов функции SymbolsList
if(количество_символов == -1){ Alert("Ошибка открытия файла в SymbolsList(string &Symbols[], bool Selected)"); return;}

while(true&&!IsStopped()){ //если разрешить и не отанавливать скрипт продолжим
на_экран="\r\n"; //отступ
for(i=0;i<количество_символов;i++)//посчитаем стоимость спреда для инструментов из обзора рынка
на_экран=на_экран+val[i]+" стоимость спреда = " + DoubleToStr(MarketInfo(val[i],MODE_SPREAD)*MarketInfo(val[i],MODE_TICKVALUE),0)+"\r\n";
Comment(на_экран);//выведем на экран
Alert("Пересчитаем");//сигнал
Sleep(3000);//пауза 3 сек.
}
*/
}
void deinit(){Comment("");}
//+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=


//+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
// функция читает из обзора рынка все фин.инстр.
//+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
int SymbolsList(string &Symbols[], bool Selected){
int Offset, SymbolsNumber; string SymbolsFileName;
if(Selected) SymbolsFileName = "symbols.sel"; else SymbolsFileName = "symbols.raw";
int hFile = FileOpenHistory(SymbolsFileName, FILE_BIN|FILE_READ);
if(hFile < 0) return(-1); if(Selected) { SymbolsNumber = (FileSize(hFile) - 4) / 128; Offset = 116; }
else { SymbolsNumber = FileSize(hFile) / 1936; Offset = 1924; }
ArrayResize(Symbols, SymbolsNumber);
if(Selected) FileSeek(hFile, 4, SEEK_SET);
for(int i = 0; i < SymbolsNumber; i++){Symbols[i] = FileReadString(hFile, 12); FileSeek(hFile, Offset, SEEK_CUR);}
FileClose(hFile);
return(SymbolsNumber);
}
 
doon:


There was also an error:

't' - variable not defined, so it's a variable. I don't know what to do with it.

This is an afterthought...

If it wasn't for the first error `(`), we would have thought about what was wrong. But with this first one, everything is clear.

 
I think it's the same, just highlighted in colour and that's it
 
DhP:

This is already as a consequence...

If it wasn't for the first error `(`, you might have wondered what was wrong. And with this first one, everything is clear.


Thanks, I'll keep looking.
 
globad:
I think it's the same, just highlighted and all

It's the same, but it's easier (more familiar) to read the code.

I'm too lazy to figure it out, but someone will easily find a mistake in your code without straining. Just wait.

Reason: