Friends, help please!!! I cannot write a code that would open a buy if the price goes from the bottom to the top of a certain level, sell the opposite. exactly where the price comes from. is it hard???
Friends, please help!!! I cannot write a code that would open a buy if the price goes from the bottom to the top of a certain level, and for sell - vice versa. I can't decide if the price comes from the bottom or the top.
Many variations are possible.
For example:
double price1 = iClose(NULL,0,1); // Цена закрытия последнего сформированного бараdouble price2 = iClose(NULL,0,2); // Цена закрытия второго (предпоследнего) бара double Level = 1.7658; // Какой-то уровеньif(price1>Level && price2<Level)OrderSend(Symbol(),OP_BUY,......); // Если цена на предпоследнем баре была ниже уровня, // а на последнем выше, то покупаем...if(price1<Level && price2>Level)OrderSend(Symbol(),OP_SELL,......);
double price1 = iClose(NULL,0,1); // Цена закрытия последнего сформированного бараdouble price2 = iClose(NULL,0,2); // Цена закрытия второго (предпоследнего) бара double Level = 1.7658; // Какой-то уровеньif(price1>Level && price2<Level)OrderSend(Symbol(),OP_BUY,......); // Если цена на предпоследнем баре была ниже уровня, // а на последнем выше, то покупаем...if(price1<Level && price2>Level)OrderSend(Symbol(),OP_SELL,......);
What if one of the prices is equal to Level ?
What about the zero bar? It is the very first one. But it has not been formed yet. You confuse the person. Then it is like this:
//----------------------------------------------------------------------------------------int dg=MarketInfo(Symbol(),MODE_DIGITS);
double price1 = iClose(NULL,0,1); // Цена закрытия первого бараdouble price2 = iClose(NULL,0,2); // Цена закрытия второго бара double Level = 1.7658; // Какой-то уровеньif (NormalizeDouble(price1-Level,dg)>0 && NormalizeDouble(Level-price2,dg)>=0) {
// ... код открытия позиции Бай ...
}
if (NormalizeDouble(Level-price1,dg)>0 && NormalizeDouble(price2-Level,dg)>=0) {
// ... код открытия позиции Селл ...
}
//----------------------------------------------------------------------------------------
goodnight! I suddenly found a bunch of folders on my C drive and some kind of C++, decided to install, and it's asking me something!!! I'm not good at English, no, I vaguely understood that either the original in the sense of some original version, or something there my computer and did not install for some reason ... In short, it is not clear.
Dimka-novitsek: Goodnight! I suddenly found a bunch of folders and some C++ on my C drive, decided to install it, and it's asking me for something!!! I'm not good at English, no, I vaguely understood that either the original in the sense of some original version, or something there my computer and do not install for some reason ... In short, I do not understand.
Select one of the options:
Repair - "repair"/restore Visual C++ 2008
Uninstall - remove Visual C++ 2008 from your computer
What about the zero bar? It is the very first one. Only it is not yet formed. You confuse the subject. Then put it this way:
It makes no sense to normalize the double values to compare them since the two values 1.778946 and 1.778949 will be equal after normalization and this is incorrect since the first value is smaller than the second one.
Normalize double is only needed to send a command to the Dealer, but not for "internal consumption" - comparison of the two values.
Friends, help please!!! I cannot write a code that would open a buy if the price goes from the bottom to the top of a certain level, sell the opposite. exactly where the price comes from. is it hard???
Friends, please help!!! I cannot write a code that would open a buy if the price goes from the bottom to the top of a certain level, and for sell - vice versa. I can't decide if the price comes from the bottom or the top.
Many variations are possible.
For example:
Many variations are possible.
For example:
What if one of the prices is equal to Level ?
What about the zero bar? It is the very first one. But it has not been formed yet. You confuse the person. Then it is like this:
What if one of the prices is equal to Level ?
What about the zero bar? It is the very first one. Only it is not yet formed. You confuse the subject. Then it is like this:
Again.
There are very(!) many variations.
By the way, the zero bar is not the first one. It is zero, i.e. it is not there yet.
Goodnight! I suddenly found a bunch of folders and some C++ on my C drive, decided to install it, and it's asking me for something!!! I'm not good at English, no, I vaguely understood that either the original in the sense of some original version, or something there my computer and do not install for some reason ... In short, I do not understand.
Select one of the options:
Repair - "repair"/restore Visual C++ 2008
Uninstall - remove Visual C++ 2008 from your computer
What if one of the prices is equal to Level ?
What about the zero bar? It is the very first one. Only it is not yet formed. You confuse the subject. Then put it this way:
It makes no sense to normalize the double values to compare them since the two values 1.778946 and 1.778949 will be equal after normalization and this is incorrect since the first value is smaller than the second one.
Normalize double is only needed to send a command to the Dealer, but not for "internal consumption" - comparison of the two values.
Got it!!! Thanks a lot!!!!Good thing you asked!!!