[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 59

 
tpg_k156:
Please help me. I don't understand why part of the code doesn't work correctly.

2013.01.08 15:24:21 2012 08.17 21:30 trololo EURUSD,M30: loaded successfully

2013.01.08 15:24:21 2012.08.17 21:30 renkotrend_mart_fixtime_v1 EURUSD,M30: GPG=0 GSR=1.2347 spg=1.2327 ssr=1.2307
2013.01.08 15:24:21 2012.08.17 21:30 renkotrend_mart_fixtime_v1 EURUSD,M30: No open orders1.23470
2013.01.08 15:24:21 2012.08.17 21:30 renkotrend_mart_fixtime_v1 EURUSD,M30: Alert: AHTUNG! UNKNOWN SHIT!!! TREND IS NOT DEFINED

How is this even possible? What's my mistake?

This is from the logs. It eventually triggers else and alert Alert: AHTUNG!!! UNKNOWN FUCKING THING!!! TREND IS NOT DEFINED
 
TheXpert:
Period Converter
Thank you. Will the chart update automatically or do I have to do it myself?
 
tpg_k156:
This is from the logs. It eventually triggers else and alert Alert: AHTUNG!!! UNKNOWN FUCKING THING!!! TREND IS NOT DEFINED


If you want to determine

else
      {
      //открытых ордеров нет
      Print("Открытых ордеров нет",GSR,GPG);
      if(GSR>0)//тренд медвежий
         {
         
         price=GSR;
         tprofit=GSR+takeprofit*Point;
         sloss=GSR-stoploss*Point;
         OrdSend(symbol,4,volume,price,slippage,sloss,tprofit,comment,magic,expiration,arrow_color);//устанавливаем OP_BUYSTOP
         }
      else if(GPG>0)//тренд бычий
         {
         
         price=GPG;
         sloss=GPG+stoploss*Point;
         tprofit=GPG-takeprofit*Point;
         OrdSend(symbol,5,volume,price,slippage,sloss,tprofit,comment,magic,expiration,arrow_color);//устанавливаем OP_SELLSTOP
         }
      else
         {
         Alert("AHTUNG!!! НЕВЕДОМАЯ ХУЙНЯ!!! ТРЕНД НЕ ОПРЕДЕЛЕН");
         }
   
      }
 
Vinin:


If you want to determine


Thank you, this part of the code has started to work.
 

Another uncertainty has arisen

if(OrdersTotal()>0)//есть ли открытые ордера
      {
      i=OrdersTotal();
      while(i>0)//перебор открытых и отложенных ордеров
         {
         Print("Обработка ордера №",i);
         if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)//выбираем ордер
            {
            Print("Обработка существующих ордеров");
            
            i--;
            }
         else
            {
            //ордер выбрать не удалось
            
            Print("OrderSelect() вернул ошибку - ",GetLastError());
            }   
         
          }
      
      }
2013.01.08 17:06:48 2012.08.16 14:17 renkotrend_mart_fixtime_v1 EURUSD,M30: Waiting for new bar...

2013.01.08 17:06:48 2012.08.16 14:17 renkotrend_mart_fixtime_v1 EURUSD,M30: GPG=0 GSR=1.2288 spg=1.2279 ssr=1.227
2013.01.08 17:07:00 2012.08.16 14:30 renkotrend_mart_fixtime_v1 EURUSD,M30: Processing order #1
01.08 17:07:00 2012.08.16 14:30 renkotrend_mart_fixtime_v1 EURUSD,M30: OrderSelect() returned error - 0
From Reference:

ERR_NO_ERROR 0 No error
What is my error now ? I guess I cannot create an EA :(

 
tpg_k156:

Another uncertainty has arisen

2013.01.08 17:06:48 2012.08.16 14:17 renkotrend_mart_fixtime_v1 EURUSD,M30: waiting for new bar...

2013.01.08 17:06:48 2012.08.16 14:17 renkotrend_mart_fixtime_v1 EURUSD,M30: GPG=0 GSR=1.2288 spg=1.2279 ssr=1.227
2013.01.08 17:07:00 2012.08.16 14:30 renkotrend_mart_fixtime_v1 EURUSD,M30: Processing Order #1
2013.01.08 17:07:00 2012.08.16 14:30 renkotrend_mart_fixtime_v1 EURUSD,M30: OrderSelect() returned error - 0
From reference:

ERR_NO_ERROR 0 No error
What is my mistake now? Apparently, I cannot create an EA :(


if(OrdersTotal()>0)//есть ли открытые ордера
      {
      i=OrdersTotal()-1;
      while(i>=0)//перебор открытых и отложенных ордеров
         {
         Print("Обработка ордера №",i);
         if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)//выбираем ордер
            {
            Print("Обработка существующих ордеров");
            
            i--;
            }
         else
            {
            //ордер выбрать не удалось
            
            Print("OrderSelect() вернул ошибку - ",GetLastError());
            }   
         
          }
      
      }
Take your time
 
Vinin:

Take your time.

counting down from 0? Man, I really am a Sloypok or whatever they call a slowpoke. Thanks again!
 
I have noticed an interesting thing - if there are a lot of Prints, then the EA works differently, if there are none at all. And the indicator readings obtained through icustom are different from the visual display of the same indicator in the visualizer window.
 

Good day!!! Happy holidays to all!!! Happy New Year and Merry Christmas!

A hint!!!I haven't used arrays before.I would like to set the array in its null element- remember ticket one, price one. In the first element of the array- remember ticket two, price two. Etc.

How to write it? In two words... No, I generally remember the topic, I've read about arrays. Just write in one line how to set it.

Here is a part of my code, though it's unnecessary. extern int Raz=5;

int start()
  {
//----
    if (!PozyProstavleny){ 
   
           Price= (Ask+Dist*Point) ; TP_BUY=(Price+TP*Point);  SL_BUY= (Price- SL*Point);
           Price_SELL= (Bid-Dist*Point) ;  TP_SELL=Price_SELL-TP*Point;  SL_SELL=Price_SELL+SL*Point; 
           
   for(int Raz1=Raz;Raz1>0;Raz1--){
   
           Sleep(2000); RefreshRates();  for(int A=25;A>=0;A--){if(IsTradeAllowed())break;
if(A==0) Comment(" эксперту не разрешено торговать или поток для выполнения торговых операций занят "); }           
           OrderSend (Symbol( ), OP_BUYSTOP,  Lot ,NormalizeDouble(Price, Digits), 5, NormalizeDouble( SL_BUY,Digits), 
  NormalizeDouble( TP_BUY,Digits), NULL, 450, 0, CLR_NONE);
           Price= (Price+Dist*Point) ; TP_BUY= (Price+TP*Point); SL_BUY= (Price- SL*Point);
           Error=GetLastError();
     if (Error!=0){ string errorcomment = "Ошибка открытия ордера байстоп  "  + " " + Symbol() +  " " + ErrorDescript(Error); 
           Print (errorcomment);}
           
           Sleep(2000); RefreshRates();  for( A=25;A>=0;A--){if(IsTradeAllowed())break;
if(A==0) Comment(" эксперту не разрешено торговать или поток для выполнения торговых операций занят "); }        
           OrderSend (Symbol( ), OP_SELLSTOP,  Lot ,NormalizeDouble(Price_SELL, Digits), 5, NormalizeDouble( SL_SELL,Digits), 
  NormalizeDouble( TP_SELL,Digits), NULL, 450, 0, CLR_NONE);
     Price_SELL= (Price_SELL -Dist*Point) ;TP_SELL=Price_SELL-TP*Point;   SL_SELL=Price_SELL+SL*Point;
            Error=GetLastError();if (Error==0)
            
            {errorcomment = "Ошибка открытия ордера селлстоп  "  + " " + Symbol() +  " " + ErrorDescript(Error); 
        Print (errorcomment);} Print ("for1");PozyProstavleny=1; 
                       }
                       }   
                        
 

2013.01.08 20:31:58 2012.12.03 10:00 renkotrend_mart_fixtime_v1 EURUSD,M30: OrderModify error 1

How can this line be understood?