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

 
Mm-hmm, thank you,
 

Hello.

Here are my labours from the weekend. I'm submitting it for condemnation.

int start()
{
//----
double CCI = NormalizeDouble(iCCI(NULL, 0,Period,PRICE_CLOSE,1), Digits);

if(CCI[1] > -100)
if(CheckOrders(OP_SELL))
{
if(!OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, NULL, MagicNumber))
Print("Buy order not opened. Error #", GetLastError());
}

if(CCI[1] < 100)
if(CheckOrders(OP_BUY)
{
if(!OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, 0, 0, NULL, MagicNumber))
Print("Sell order not opened. Error #", GetLastError());
}

//----
return(0);
}

This is part of the code for CCI. The essence is simple, cci at the bottom >-100 buy, cci at the top < 100 sell


int start()
{
//----
double RSI = NormalizeDouble(iRSI(NULL, 0,Period,PRICE_CLOSE,1), Digits);

if(RSI[1] > 70)
if(CheckOrders(OP_SELL))
{
if(!OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, NULL, MagicNumber))
Print("Buy order not opened. Error #", GetLastError());
}

if(RSI[1] < 30)
if(CheckOrders(OP_BUY)
{
if(!OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, 0, 0, NULL, MagicNumber))
Print("Sell order not opened. Error #", GetLastError());

//----
return(0);
}

the part of the code for RSI is the same, buy at 70 sell at 30


int start()
{
//----
double WPR = NormalizeDouble(iWPR(NULL, 0,Period,1), Digits);

if(WPR[1] > -80)
if(CheckOrders(OP_SELL))
{
if(!OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, NULL, MagicNumber))
Print("Buy order not opened. Error #", GetLastError());
}

if(WPR[1] < -20)
if(CheckOrders(OP_BUY))
{
if(!OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, 0, 0, NULL, MagicNumber))
Print("Sell order not opened. Error #", GetLastError());
}

//----
return(0);
}

this part of the code for WPR (williams indicator) buy -80, sell -20.

I have a question if i am not confused with the trading conditions in all this............Thank you very much........

 

Hello, esteemed professionals and not only.

In my opinion, your website is the most suitable for helping newbies in learning MQL4.

When I asked questions, I got comprehensive answers from experts. Precisely the experts. But a beginner is a beginner. He will ask the question again and again until he understands its essence. So behave schoolchildren who have the desire to learn something..... Maybe they (students) are not so smart as geeks, and not as smart as nerds, but if there is a desire, I think it should be welcomed...... I want to learn.....

I really liked the responses and comments from korey, grani77, vinin, YuraZ, figarO, BARS. Intelligent and intelligent. If you allow me, the communication can be transferred to ............ Thanks in advance

 
igrok2008 писал(а) >> and not as smart as nerds.

Oh, boy. I thought, "No matter how much you teach a chicken, it doesn't get smarter, it just knows more."

 
Mathemat >> :

Oh, boy. I thought, "No matter how much you teach a chicken, it doesn't get smarter, it just learns more."

Why teach a chicken? It's not even a bird (according to the proverb) ..... Well, that's the difference between a man and a chicken - he thinks. Or we could say, "You live a long time and learn a long time."

And still I repeat, above I gave my creation over the weekend, please, your comments what is wrong ..........

 

to igrok2008

I would say that the current state of automated trading looks like the Battle of the Harvest,
We are fighting with combines, quotes, MQL, tester, glitchy TS from books and homemade ones,
that's why the training is simply not settled, it doesn't exist yet because of the many unresolved problems
ranging from the technical to the gnostic.
- There is the art of creating MTS, but the rest of the meta trade is a mess
so there is only one way for the training to work
=You have to pick the right problem, work on it and learn from it.
...
P.S. it's a shame to study, because instead of (having experience and skills) solving problems in MT4, you have to learn and learn from these problems.
IMHO = face on the piano
but there are no other ways in autotrading yet and will not be yet

 
Korey >> :

to igrok2008

the current state of the auto trade is like the Battle of the Harvest,
we are fighting with combine, quotes, MQL, tester, glitchy TS from books and homemade ones,
that's why the training is just not settled, it doesn't exist yet because of the many unresolved problems
ranging from the technical to the gnostic.
- There is the art of creating MTS, but the rest of the meta trade is a mess
so there is only one way training can be sustained
=You have to pick the right problem, work on it and learn from it.
...
P.S. it's a shame to study, because instead of (having experience and skills) solving problems in MT4, you have to learn and learn from these problems.
IMHO = face on the piano
but there are no other ways in autotrading yet and will never be.

Why does it hurt to learn? A person learns and develops. If he does not learn, it is a process of transformation into an amoeba, into a unicellular, amorphous state. So these are philosophical questions. They are complicated, not simple, and it is BETTER to discuss them over a cup of tea (40 degrees), with pastries (a piece of good meat) and on a magic couch. ......-:)))))))

I repeat, from16.02 (above) my creations. What's wrong with them.............

 

to igrok2008

1. the question is not asked, i.e. where is the question posed?
2. To answer the general question "what's wrong with them", you need to run this EA at all, it is a technique, but it is not suitable for testing.
But if it is, there is nothing to answer.
3. You don't need a test, if the question is about CCI, for example, the question about something else + CCI is appropriate, but you haven't asked it))
3. Code posted on the SRC button is much easier to read, save your eyes and time

 

Questions about the indicator:

1. My comment to the code is correct (red)

2. Where in the code is it written to change the colour of the histogram when haOpen < haClose and when haOpen > haClose

If you don't mind, please correct the wrong comments on this code! I really want to understand it):

//+------------------------------------------------------------------+
//| Heiken Ashi.mq4 |
//| Copyright c 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
//| For Heiken Ashi we recommend next chart settings ( press F8 or |
//| select on menu 'Charts'->'Properties...'): |
//| - On 'Color' Tab select 'Black' for 'Line Graph' |
//| - On 'Common' Tab disable 'Chart on Foreground' checkbox and |
//| select 'Line Chart' radiobutton |
//+------------------------------------------------------------------+

// Все, что было написано выше - стандартная лабуда
// а все, что идет ниже под грифом #property - это объявление глобальных констант.

#property copyright "Copyright © 2004, MetaQuotes Software Corp." // это могли бы и не писать
#property link "http://www.metaquotes.net" // это тоже лабудаа

#property indicator_chart_window // отображать индикатор в основном окне
#property indicator_buffers 4 // будет 4 буфера
#property indicator_color1 Red // цвет для гистограммы
#property indicator_color2 White // цвет для гистограммы
#property indicator_color3 Red // цвет для гистограммы
#property indicator_color4 White // цвет для гистограммы
#property indicator_width1 1 // толщина для гистограмм
#property indicator_width2 1
#property indicator_width3 3
#property indicator_width4 3

//---- четыре строчки ниже - это внешние переменные цветов гистограмм
extern color color1 = Red;
extern color color2 = White;
extern color color3 = Red;
extern color color4 = White;
//---- buffers вводятся переменные, которые в дальнейшем будут связаны с буферами гистограмм индикатора
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//----
int ExtCountedBars=0; // вводится переменная, которой присваивается 0 - хаха , я не знаю почему не 1((
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init() // а здесь запускается специальная функция init (здесь она запускается после присоединения индикатора к окну графика, после изменения настроек эксперта)
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, color1); // здесь устанавливается тип гистограмм с порядковыми номерами линий, типом, стилем, шириной, цветом
SetIndexBuffer(0, ExtMapBuffer1); // связывает переменную-массив, объявленную на глобальном уровне с предопределенным (по порядковому номеру линии = 0)
// буфером польз.-го индикатора
. Ниже по аналогии.
SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, color2);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexStyle(2,DRAW_HISTOGRAM, 0, 3, color3);
SetIndexBuffer(2, ExtMapBuffer3);
SetIndexStyle(3,DRAW_HISTOGRAM, 0, 3, color4);
SetIndexBuffer(3, ExtMapBuffer4);
//---- // установка порядкового номера бара от начала данных для отрисовки указанной линии
SetIndexDrawBegin(0,10); // порядковый номер линии = 0. хаха не понятно, эта линия будет рисоваться на основании 11 быров с учетом нулевого?(( индикатор отрисован
// по гораздо большему количеству баров((. ниже по аналогии
SetIndexDrawBegin(1,10);
SetIndexDrawBegin(2,10);
SetIndexDrawBegin(3,10);
//---- indicator buffers mapping
SetIndexBuffer(0,ExtMapBuffer1); // а зачем повторять ведь это же уже было написано выше, наверное автор этого индикатора захотел меня запутать!))
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexBuffer(3,ExtMapBuffer4);
//---- initialization done
return(0); // на этом специальная функция init завершается. Только почему в скобках у return ноль?? - непонятно((
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit() // а тут специальная функция deinit, которая не используется
{
//---- TODO: add your code here

//----
return(0); // гуд бай deinit
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() //это основная функция индикатора запускается на каждом новом тике
{
double haOpen, haHigh, haLow, haClose; //вводятся локальные дробные переменные
if(Bars<=10) return(0); //оператор if с условием если баров yна рафике меньше или равно10 - закрывать функцию start
ExtCountedBars=IndicatorCounted(); //переменной ExtCountedBars присваивается значение количества баров в окне терминала.
//а чем отличается
функция IndicatorCounted () от Bars?
//---- check for possible errors
if (ExtCountedBars<0) return(-1); //ну вот, еще один if - если переменная ExtCountedBars < нуля ?завершение функции start? почему return с (-1)? - Непонятно((
//---- last counted bar will be recounted
if (ExtCountedBars>0) ExtCountedBars--; // а если ExtCountedBars больше нуля, от этого количества баров отнимается единица.
//Осуществляется переход на один бар ближе к нулевому - если я правильно понимаю
int pos=Bars-ExtCountedBars-1; //Вводиться и рассчитывается переменная pos - указатель на бар, с которого будет вестись расчет
while(pos>=0) //Запуск цикла while с условием, что pos должна быть больше или равна нулю. Цикл будет повторяться при каждом новом тике
//(при соблюдении условия).
{
haOpen=(ExtMapBuffer3[pos+1]+ExtMapBuffer4[pos+1])/2; //вводится и рассчитывается переменная haOpen на основании(суммы 2-х буферов 3-го и 4-го со смещением на один
//бар вперед)потом это на 2 делится
//когда цикл while снова повториться к pos будет изменена, чтобы не считать уже вычесленное значение индикаторов?

haClose=(Open[pos]+High[pos]+Low[pos]+Close[pos])/4; //вводится и рассчитывается переменная haClose на основании суммы цен открытия, максимума, минимума и закрытия
//бара начала рассчета
haHigh=MathMax(High[pos], MathMax(haOpen, haClose)); //вводиться и рассчитывается переменная haHigh на основании функции возврата максимального из двух числовых
//максимума текущего бара pos и максимального из 2-х числовых значений (haOpen и haClose)
haLow=MathMin(Low[pos], MathMin(haOpen, haClose)); //значений, то же что и строкой выше - только рассчитывается минимальное значение
if (haOpen<haClose) //если haOpen меньше haClose
{
ExtMapBuffer1[pos]=haLow; //тогда значение Буфер 1 по pos равено haLow
ExtMapBuffer2[pos]=haHigh; //и значение буфера 2 по pos равно haHight
}
else //а если условие ложно и haOpen больше или равно haClose
{
ExtMapBuffer1[pos]=haHigh; //тогда наоборот значение Буфер 1 по pos равно haHigh t
ExtMapBuffer2[pos]=haLow; //а значение Буфера 2 по pos равно haLow
}
ExtMapBuffer3[pos]=haOpen; //в любом случае значение Буфера3 по pos равно haOpen
ExtMapBuffer4[pos]=haClose; //а значение буфера 4 по pos равно haClose
pos--; //уменьшаем pos на единицу (ближе к нулевому бару) и повторяем цикл while сначала при соблюдении его условия
}
//----
return(0); //а если условие не соблюлось, выход из цикла while и конец функции start
}
//+------------------------------------------------------------------+
similar |
Files:
 
The above examples describe the buy and sell code for CCI, RSI and WPR. Why exactly these indicators are used? In my opinion, they are the easiest to learn how to build an Expert Advisor. The buy and sell principle is the same for them. less than -100 (for CCI), -70 (for RSI) and 20 (for WPR), respectively sell will be: +100, -30 and 80. It seems to me (crossed more than once) that the errors are in the trading conditions, but where I don't understand..... It's about the principle of WRITING the trading conditions correctly (I think so).............. That's what I wanted to ask you........