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

 
IgorM:

Not exactly a beginner's question, but I think it would be appropriate in this thread:

how do you tell the difference between a flat and a trend ?

Along the chain of higher highs for the upside and lower lows for the downside...

The end or start of a pullback is when a lower high or lower low is formed for an uptrend.
For a downward move, the signal of completion or start of a pullback would be the formation of a higher high or a higher low...

Although the question is of course rhetorical...
At present I manage to define the trend more or less successfully, though with a lag...
Again, the question is in what timeframe to determine the trend with what TF.
However, it is possible to determine from a higher to a lower TF and in each one find the trend in the same direction and open in its direction...

By the way... What is a small pullback for a monthly TF is a good clear trend for a daily one, but in the opposite direction to the monthly one.
It all depends on the individual needs... organisms... :)

 
artmedia70:
The chain of higher highs for ascending and lower lows for descending...

...
So far I've been more or less successful in determining the trend, albeit with a lag...
..


code plz, my system is set up to always want to open an order and I hold it back by prohibit signals, only signals give permission to trade = order

here's the small problem - no latency in trading, there are problems with random orders on night flat - for now i dream to teach the EA to distinguish the flat and not to limit it to the time of day to work. For the estimation of the trend I am using higher TFs in the EA logic, so far I have been able to put it at night on 1 hour TF and it seems to be less stubborn than on M15

 

I put pendants with stop loss and TP and left for a week. Will they work with the computer off?

 
VAM_:

I put pendants with stop loss and TP and left for a week. Will they work with the computer off?

Sure they will!
 

Can anyone tell me what the error is, why no orders are being placed? The full code is in the attachment.

   // Торговые критерии
   double MA_1[];
   ArrayResize(MA_1,Period_MA);

   for(int j=0;j<=Period_MA-1;j++)
   MA_1[j]=iMA(NULL,0,Period_MA,0,MODE_EMA,PRICE_CLOSE,j);
   
   if (MA_1[j+1] < MA_1[j])
     {                                          // ..МА 1 меньше 0 
      Opn_B=true;                               // Критерий откр. Buy
      Cls_S=true;                               // Критерий закр. Sell
     }
   if (MA_1[j+1] > MA_1[j])
     {                                          // ..МА 1 больше 0 
      Opn_S=true;                               // Критерий откр. Sell
      Cls_B=true;                               // Критерий закр. Buy
     }
//---------------------------------------------------------------
   // Открытие ордеров
   while(true)                                  // Цикл закрытия орд.
     {
      if (Total==0 && Opn_B==true)              // Открытых орд. нет +
        {                                       // критерий откр. Buy
         RefreshRates();                        // Обновление данных
         SL=Bid - New_Stop(StopLoss);     // Вычисление SL откр.
         TP=Bid + New_Stop(TakeProfit);   // Вычисление TP откр.
         Alert("Попытка открыть Buy. Ожидание ответа..");
         Ticket=OrderSend(Symb,OP_BUY,Lts,Ask,2,SL,TP);//Открытие Buy
         if (Ticket > 0)                        // Получилось :)
           {
            Alert ("Открыт ордер Buy ",Ticket);
            return;                             // Выход из start()
           }
         if (Fun_Error(GetLastError())==1)      // Обработка ошибок
            continue;                           // Повторная попытка
         return;                                // Выход из start()
        }
      if (Total==0 && Opn_S==true)              // Открытых орд. нет +
        {                                       // критерий откр. Sell
         RefreshRates();                        // Обновление данных
         SL=Ask + New_Stop(StopLoss);     // Вычисление SL откр.
         TP=Ask - New_Stop(TakeProfit);   // Вычисление TP откр.
         Alert("Попытка открыть Sell. Ожидание ответа..");
         Ticket=OrderSend(Symb,OP_SELL,Lts,Bid,2,SL,TP);//Открытие Sel
         if (Ticket > 0)                        // Получилось :)
           {
            Alert ("Открыт ордер Sell ",Ticket);
            return;                             // Выход из start()
           }
         if (Fun_Error(GetLastError())==1)      // Обработка ошибок
            continue;                           // Повторная попытка
         return;                                // Выход из start()
        }
      break;                                    // Выход из while
     }
Files:
15.mq4  13 kb
 
Craft:

Can anyone tell me what the error is, why no orders are being placed? The full code is in the attachment.


And what errors does the tester write?

Especially since there are errors in the code.

And try to write the logic of your EA on a piece of paper. And then compare it with the code

 
IgorM:


code plz, my system is configured in such a way that it always wants to open an order and I restrain it by forbidding signals, only signals give me permission to trade = order

I have a small problem now - there are no late trades, but there are problems with random orders in the night flat - so far I dream of teaching the EA to distinguish the flat, and not limiting it to the time of day to work. For the estimation of the trend I am using higher TF in the EA operating logic, so far I have been able to put it at night on 1 hour TF and it seems to be less stubborn than on M15

Aside from what I wrote in my personal message, I can offer you to think about it:


Everything is simple as hell: three MAs with periods of 150, 21 and 5. Each has +20 and -20 levels. When their levels are intertwined, it's a flat. When levels diverge, it is a trend. I use them for working in the channel. When leaving the channel I connect the trend strategy.

 
artmedia70:
It's simple as hell: three MAs with periods of 150, 21 and 5. Each has levels of +20 and -20. When their levels are intertwined, it's a flat. When the levels diverge, it is a trend. I use them for working in the channel. When leaving the channel I connect the trend strategy.
Nice, how does it look in the code (logic): If MA150+20 > MA5 > MA150-20 and MA150+20 > MA21 > MA150-20 then flat else Trend.
 
Vinin:


And what errors does the tester report?

Especially since there are errors in the code.

And try to write the logic of your EA on a piece of paper. And then compare it with the code.

The tester has no errors, it just does not place any order.

Please point out the error, the logic: if the value of MA [0] of the bar is higher than MA [1] you should buy, on the contrary - sell (this code is written as an example, to try to understand a simple condition and create a more complicated one).

 

Поставил отложенники со стоп лоссом и ТР и уехал на неделю. Сработают ли они при выключенном компе?

:

I bet you do!

I am interested in the question of practical execution. I make out an order and send it to the server - where is it stored? On the server of the brokerage company? I.e. what is the mechanics of execution?
Reason: