[Qualsiasi domanda da principiante, per non ingombrare il forum. Professionisti, non passate oltre. Da nessuna parte senza di te - 4. - pagina 372

 
Buona sera. Vorrei sapere se qualcuno usa l 'indicatore per la distribuzione dei trade in base ai livelli di prezzo su un dato timeframe, che può essere scaricato da http://fxcoder.ru/indicators/tpo. Se è così, come può essere analizzato correttamente? Ha qualche informazione al riguardo?
 
artemka_1981:
Ora quando il test non apre un solo trade nel log scrive Open_BuyS_SellS EURUSD,Daily: OrderSend error 131

L'errore 131 è un volume errato. Provate il lotto 1 per esempio, potrebbe non esservi permesso di aprire con il lotto 0,01.

ERRARE_INVALIDO_SCAMBIO_VOLUME131Volume errato
 
ilunga:

L'errore 131 è un volume errato. Provate il lotto 1 per esempio, potrebbe non esservi permesso di aprire con il lotto 0,01.

ERRARE_INVALIDO_SCAMBIO_VOLUME131Volume errato
//+------------------------------------------------------------------+
//|                                                Open_Buy_Sell.mq4 |
//|                                                                  |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#define magic 999
extern bool Buy = true  ; //  true - разрешено покупать
extern bool Sell = true  ; // true - разрешено продавать
#property link      "http://www.metaquotes.net"
extern double  _lots         = 1;
extern int     _takeProfit   = 1200;
extern int      maxpos       = 1;     // количество поз
extern bool    _trailingStop = true;
//+------------------------------------------------------------------+

int start()
  {
   double _slBuy=0.0,_slSell=0.0, _tpBuy=0.0, _tpSell=0.0, _opBuy=0.0, _opSell=0.0;

//if (iVolume(Symbol(),PERIOD_D1,0)>1) return;
//     if (Volume[0]>1) return;
     if (_trailingStop){ 
     _TrailingStop();
      }
   _opBuy=NormalizeDouble(iHigh(Symbol(),0,1), Digits);
   _slBuy=NormalizeDouble(iLow(Symbol(),PERIOD_D1,1), Digits);
   _tpBuy=NormalizeDouble(Ask+_takeProfit*Point, Digits);
      if ( _opBuy<Ask && CountPos(1)<maxpos)
       if(barOpen(OP_BUYSTOP)==1 ||barOpen(OP_BUY)==1 )
        OrderSend(Symbol(),OP_BUYSTOP,_lots,_opBuy,15,_slBuy,_tpBuy,"Open_Buy_Sell",0,Green);

   _opSell=NormalizeDouble(iLow(Symbol(),0,1), Digits);
   _slSell=NormalizeDouble(iHigh(Symbol(),PERIOD_D1,1), Digits);
   _tpSell=NormalizeDouble(Bid-_takeProfit*Point, Digits);
     if (_opSell>Bid && CountPos(0)<maxpos)
      if(barOpen(OP_SELLSTOP)==1 ||barOpen(OP_SELL)==1 )
       OrderSend(Symbol(),OP_SELLSTOP,_lots, _opSell,15,_slSell,_tpSell,"Open_Buy_Sell",0,Red);
//----
   return(0);
  }
//+------------------------------------------------------------------+  
 //Проверяем количесвто позиций.
   int CountPos(int type) 
{//Описание http://fxnow.ru/blog.php?user=Yuriy&blogentry_id=66

    
int i;
int col;
int count=0 ;
for(i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS)==true)
{
if(OrderType()==OP_BUYSTOP && OrderSymbol()==Symbol() && type==1 && OrderMagicNumber()== magic){count++;}
if(OrderType()==OP_SELLSTOP && OrderSymbol()==Symbol() && type==0 && OrderMagicNumber()== magic){count++;}
         }
       }   
return(count);
}
//+------------------------------------------------------------------+
void _TrailingStop(){
   int i;
   double _stopLossSellF=NormalizeDouble(iHigh(Symbol(),0,1), Digits),
          _stopLossBuyF=NormalizeDouble(iLow(Symbol(),0,1), Digits);
   if (OrdersTotal()>0){
      for (i=OrdersTotal()-1; i>=0; i--){
         if (OrderSelect(i, SELECT_BY_POS)){
            if (OrderSymbol()==Symbol() && OrderMagicNumber()==magic){
             
               if (OrderType()==OP_BUY && OrderOpenPrice() < _stopLossBuyF){
                  while (IsTradeContextBusy()) Sleep(1000);
                  RefreshRates();
                  OrderModify(OrderTicket(),OrderOpenPrice(),_stopLossBuyF,OrderTakeProfit(),OrderExpiration(),CLR_NONE);
               }
           
               if (OrderType()==OP_SELL && OrderOpenPrice() > _stopLossSellF && _stopLossSellF!=0.0){
                  while (IsTradeContextBusy()) Sleep(1000);
                  RefreshRates();
                  OrderModify(OrderTicket(),OrderOpenPrice(),_stopLossSellF,OrderTakeProfit(),OrderExpiration(),CLR_NONE);
               }
            }
         }
      }
   }
return;
}
int barOpen(int ty)
{
datetime tim=0;
 for(int i=0; i<=OrdersTotal(); i++)
    {  
       if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))continue;
       if(OrderSymbol() !=Symbol()|| OrderMagicNumber()!= magic|| OrderType()!=ty) continue; 
       if(tim<OrderOpenTime())        
          tim=OrderOpenTime();
   }
 for(i=0; i<=OrdersHistoryTotal(); i++)
    {  
       if (!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))continue;
       if(OrderSymbol() !=Symbol()|| OrderMagicNumber()!= magic|| OrderType()!=ty) continue; 
       if(tim<OrderOpenTime())        
          tim=OrderOpenTime();
   }
 
if(tim<iTime(Symbol(),PERIOD_D1,0)) return(1);
 return(0);
}
Pomeriggio. Ora scrive Open_BuyS_SellS EURUSD,H4: errore OrderSend 3

 
artemka_1981:
Pomeriggio. Ora scrive Open_BuyS_SellS EURUSD,H4: errore OrderSend 3

Leggere i codici di errore
 
artemka_1981:
Buona giornata. Ora dice Open_BuyS_SellS EURUSD,H4: OrderSend error 3

Vedere l'aiuto per i parametri OrderSend e i codici di errore

3 - parametri sbagliati.

Ne hai saltato uno e invece di datetime expiration, hai scritto colour arrow_color

 
ilunga:

Vedere l'aiuto per i parametri OrderSend e i codici di errore

3 - parametri sbagliati.

Ne hai saltato uno e invece di datetime expiration, hai scritto colour arrow_color

Mi dispiace per le domande stupide, questo è il mio primo EA che sto cercando di scrivere da solo, tutti i bug sono iniziati quando ho aggiunto la funzione trail, ecco perché mi sono rivolto a voi per un aiuto nella risoluzione dei miei errori
 

aiuto che sa!!!!


L'essenza della strategia: entrata tramite segnale stocastico (5,14,3) uscita anche tramite stocastico, ma con un altro periodo (5,3,3). Non capisco come fare un'uscita dallo stocastico e non dal segnale inverso.
Ho un problema e non ho idea di come possa essere risolto, cercherò di spiegarlo.
Quindi, nel codice che ho postato, ci sono 2 funzioni
//+------------------------------------------------------------------+
//| подготовить массив тикетов для закрытия |
//+------------------------------------------------------------------+
void PrepareTicketsToClose(int signal, bool Revers, int & ticketsClose[][2], double & lots[],double arrayTickets[][9])
{
int size=ArrayRange(arrayTickets,0);
//----
if (size==0) return;

int i,type,ticket,closeSize;
for (i=0;i<size;i++)
{
type=arrayTickets[i][1];
// если тип ордера не рыночный, то пропускаем
if (type>OP_SELL) continue;

if (Revers) // перевернем тип рыночного ордера
{
if (type==OP_BUY) type=OP_SELL; else type=OP_BUY;
}

// тут решаем для каждого открытого ордера его судьбу
// оставить в рынке или добавить в массив на закрытие
if (type==OP_BUY)
{
//
// код разрешающий оставить покупку

// как пример
if (signal==OP_BUY) continue;
}

if (type==OP_SELL)
{
//
// код разрешающий оставить продажу

// как пример
if (signal==OP_SELL) continue;
}

closeSize=ArrayRange(ticketsClose,0);
ArrayResize(ticketsClose,closeSize+1);
ArrayResize(lots,closeSize+1);
ticketsClose[closeSize][0] = arrayTickets[i][0]; // # тикета
ticketsClose[closeSize][1] = arrayTickets[i][1]; // тип ордера

// здесь укажем сколько лотов нужно закрыть
lots[closeSize] = arrayTickets[i][2]; // закрываемый объем
// можно закрывать частично, тогда нужно переписать строку сверху
}
//----
return;
}

//+------------------------------------------------------------------+
//| Закрывает ордера с указанными тикетами |
//+------------------------------------------------------------------+
void CloseMarketOrders(int ticketsArray[][2], double lotsArray[])
{
//----
int i,size=ArrayRange(ticketsArray,0);
if (size==0) return;

int ticket,type;
double lots;
bool res;

int total=OrdersTotal();

for (i=0;i<size;i++)
{
ticket = ticketsArray[i][0];
type = ticketsArray[i][1];
lots = lotsArray[i];
RefreshRates(); // на всякий случай обновим сведения о рыночном окружении

// блок закрытия покупок
if (type==OP_BUY)
{
res = OrderClose(ticket,lots,Bid,Slippage,Orange);
if (!res)
{
Print("Не удалось закрыть ордер в покупку #",ticket,"! Ошибка №",GetLastError());
// дальнейшая обработка ошибки, написать самостоятельно
}
}

// блок закрытия продаж
if (type==OP_SELL)
{
res = OrderClose(ticket,lots,Ask,Slippage,Orange);
if (!res)
{
Print("Не удалось закрыть ордер в продажу #",ticket,"! Ошибка №",GetLastError());
// дальнейшая обработка ошибки, написать самостоятельно
}
}

}
//----
return;
}
Nel void PrepareTicketsToClose(int signal, bool Revers, int & ticketsClose[][2], double & lots[],double arrayTickets[][9]) dobbiamo mettere una condizione che decida se dobbiamo lasciare o chiudere l'ordine...
Ho provato a mettere delle condizioni ma non funziona niente....
Qualcuno può guardare e mostrare se c'è un errore in queste funzioni o se ho fatto casino....
File:
osc_test_1.mq4  37 kb
 
Salve. Dopo aver eseguito l'Expert Advisor nel tester, ho bisogno di ottenere informazioni sul volume totale dei trade fatti in lotti (per esempio, nei log). L'Expert Advisor ha il blocco MM abilitato, i trade sono eseguiti in % dei fondi liberi, quindi la semplice moltiplicazione per il numero di trade non funziona. C'è una funzione standard che fornisce queste informazioni (come OrderLots, ma con l'importo totale)? Se non esiste una tale funzione, qualcuno può suggerire un codice semplice per realizzare questo compito? Grazie.
 

come aprire le porte per mt4 su modem ADSL via WIFI? vado a internet su 6 DTs. modello tp-link W8901G letto che è possibile aprire le porte per torents qualcuno può affrontare?

 
ruslanchik:

come aprire le porte per mt4 su modem ADSL via WIFI? vado a internet su 6 DTs. modello tp-link W8901G letto che è possibile aprire le porte per torents qualcuno può affrontare?

Vedere http://megatorrents.org/forum/viewtopic.php?t=262709
Motivazione: