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

 
Good people )) Help find an EA that opens trades from one level (manually scored) in different directions at the same time. Stop should be adjustable, profit preferably too. The level is perfectly defined by a daily wristwatch. If there is such an indicator which opens trades from the wave in two directions, may I have its name. I thank you in advance.
I would like to complement my question with an example. Suppose we determine the level of 1.5700. We sell from 1.5700 and buy. Our stops are 1.5730 and 1.5670, respectively. For example, we set a stop at 1.5730, then we put a sell order from 1.5700 again with a stop at 1.5730.
 
iliaalyoshin >>:

Всем привет!!! Я недавно начал изучать MQL4, да и вообще это мой первый опыт в программировании. Читаю учебник, копаюсь на форумах - что-то понятно, а что-то нет. Вот даже уже начал писать своего первого советика и попал в тупик. В учебнике ответа не нашел, на форуме просидел часа 4 - все безрезультатно.
Ребята, подскажите, пожалуйста! Например, есть некая цена PRICE. Как программе проверить, есть ли в наличии в данный момент открытые рыночные или отложенные ордера с этой ценой открытия? И, соответственно, если по этой цене ничего нет, то тогда нужно или выставить отложенный ордер или сразу открыть позицию.

Надеюсь на помощь!

Заранее, Спасибо!!!


You need to cycle through the available warrants and compare each price.

//+-------------------Выбор ордера---------------------------+
int SelectOrder(string Sym,int Tip,int MAGIC,double minPrc,double maxPrc){
    int TotOrd=OrdersTotal();
    int OrdTick=-1;
    for(int OrdPos= TotOrd-1; OrdPos>=0; OrdPos--){
        if(OrderSelect( OrdPos, SELECT_BY_POS, MODE_TRADES)==true){
           if(OrderSymbol()== Sym){                                           //Есть ли ордера с нужным символом
              if(OrderType()== Tip){                                          //Если ли нужный тип ордера  
                 if( MAGIC==0){ MAGIC=OrderMagicNumber();}                     //Если магик = 0,неучитывать
                 if(OrderMagicNumber() == MAGIC){                            //Есть ли ордера с нужным Магик номером
                    if((OrderOpenPrice()> minPrc)&&OrderOpenPrice()< maxPrc)){ //Если ордер входит в заданный ценовой диапазон
                       OrdTick = OrderTicket(); break;                       //Запишем в переменную его тикет и прервем цикл 
    }}}}}}
    return( OrdTick);                                                         //Возвращает тикет найденного ордера или -1
}
something like this
 

Good afternoon, gentlemen. Could you please check the exp code. It doesn't give any errors during compilation, but it doesn't close positions or trlit. But everything is fine with the opening. I understand there is a lot of rubbish in the code, but it is leftovers from previous versions and may be saved for the future.

Thank you!

Files:
 
exolon >>:

Доброе время суток, господа. Не могли бы вы проверить код экспа. Ошибок при компиляции не выдает, но и позиции не закрывает и не тралит. А вот с открытием все в норме. Понимаю, что в коде много мусора, но это остатки от прошлых версий и задел на будущее..

Благодарю!


try to print out the exit conditions. Print Sell1, Buy1, Sellcl0,Buycl0 variables. If they are false at the right moment, then look for errors in the EA's logic. And by the way, do not check the value of the boolean variable as if(Sell==1). Better if(Sell==true) or just if(Sell).

 
I tried it both ways. I put alert instead of print - it seems that the output conditions just don't get there. Doesn't even see the output signals themselves. Everything was OK before installing KIMa functions.
 
means you have to establish where it reaches. Move the printers to the beginning of the function until you get a response, then it will be clear where the condition is bypassed. Well, if it's faster, put Print(n), n=1,2,3... after each line. You'll know how the program works.
 
Can you tell me how to make a period change on one graph change the periods on the other graphs by the same period?
 
Graff >>:
Подскажите как сделать чтоб при изменении периода на одном графике менялись периоды на остальных графиках на аналогичный период?

There's nothing easier. You just need to write a program (not in MQL4) which would catch all the windows belonging to MetaTrader in the system, keep track of which instruments are open on them and, after a tool changes on one of them, change the periods on the others and send them the appropriate system messages to update the data.

 
Please help. Apparently I just can't understand it. I wrote the Expert Advisor myself, it even traded in real life (profitability is at 0 but for me it's already a victory). I found it on the forum and installed a couple of indicators. After that, the expert trades only in the tester and displays "uninit reason 3, uninit reason 6" and does not open trades. The essence of expert that he takes data from two indicators (Stochastic and MAKD) on different periods (M15 and M60). I will be glad for any help....
 
oyshen >>:
Прошу помочь. Видно я просто не могу понять. Эксперта я написал сам, он даже торговал в реале( прибыльность на уровне 0 но для меня это уже победа). Я нашел на форуме и установил пару индикаторов. После этого эксперт торгует только в тестере, а в реале выбивает " uninit reason 3, uninit reason 6" и не открывает сделки . Суть эксперта что он берет данные с двух индикаторв (Стохастик и МАКД) на разных периодах(М15 и М60). Буду рад любой помощи....

A year ago I started with these questions myself. I wrote my own EAs and checked others'.

You have to understand that no expert adviser will give you money until you learn how to trade!

Sorry about the truth.

Reason: