Erreurs, bugs, questions - page 809

 

Pour revenir à la question de la détermination des stoploss et des takeprofits dans l'événement OnTradeTransaction. J'ai le journal suivant qui affiche tous les champs des structures (tiré de l'exemple de MetaQuotes), et ce n'est plus un testeur mais un concours en ligne. Ici, nous avons un achat :

ON 0 transactions (EURUSD,H1) 11:14:23 OrderSendWrapper:0.10 EURUSD BUY JK 0 transactions (EURUSD,H1) 11:14:23 _OrderSend price=1.23575 vol=0.10 GM 0 transactions (EURUSD,H1) 11:14:24 TRADE_TRANSACTION_REQUEST OH 0 transactions (EURUSD,H1) 11:14:24 ------------RequestDescription PK 0 transactions (EURUSD,H1) 11:14:24 TRADE_ACTION_DEAL DJ 0 transactions (EURUSD,H1) 11:14:24 Symbole : EURUSD FN 0 transactions (EURUSD,H1) 11:14:24 Numéro magique : 0 PD 0 transactions (EURUSD,H1) 11:14:24 Order ticket : 11670896 PL 0 transactions (EURUSD,H1) 11:14:24 Order type : ORDER_TYPE_BUY JF 0 transactions (EURUSD,H1) 11:14:24 Order filling : ORDER_FILLING_FOK FM 0 transactions (EURUSD,H1) 11:14:24 Order time type : ORDER_TIME_GTC NG 0 transactions (EURUSD,H1) 11:14:24 Order expiration : 1970.01.01 00:00:00 HI 0 transactions (EURUSD,H1) 11:14:24 Prix : 1.23579 EG 0 transactions (EURUSD,H1) 11:14:24 Points de déviation : 10 DR 0 transactions (EURUSD,H1) 11:14:24 Stop Loss : 1.2354 PJ 0 transactions (EURUSD,H1) 11:14:24 Take Profit : 1.2361 ON 0 transactions (EURUSD,H1) 11:14:24 Stop Limit : 0 MK 0 transactions (EURUSD,H1) 11:14:24 Volume : 0.1 IQ 0 transactions (EURUSD,H1) 11:14:24 Commentaire : FG 0 transactions (EURUSD,H1) 11:14:24 MF 0 transactions (EURUSD,H1) 11:14:24 ------------ResultDescription JL 0 transactions (EURUSD,H1) 11:14 :24 Retcode 10009 ME 0 transactions (EURUSD,H1) 11:14:24 Request ID : 1 RL 0 transactions (EURUSD,H1) 11:14:24 Order ticket : 11670896 NK 0 transactions (EURUSD,H1) 11:14:24 Deal ticket : 10809619 QS 0 transactions (EURUSD,H1) 11:14:24 Volume : 0.1 LJ 0 transactions (EURUSD,H1) 11:14:24 Prix : 1.23579 RR 0 transactions (EURUSD,H1) 11:14:24 Ask : 1.23579 PI 0 transactions (EURUSD,H1) 11:14:24 Bid : 1.23566 GE 0 transactions (EURUSD,H1) 11:14:24 Commentaire : DS 0 transactions (EURUSD,H1) 11:14:24 GE 0 transactions (EURUSD,H1) 11:14:24 Pending Order Ticket 11670896 LR 0 transactions (EURUSD,H1) 1114:24 LG 0 transactions (EURUSD,H1) 11:14:24 ------------TransactionDescription FQ 0 transactions (EURUSD,H1) 11:14:24 TRADE_TRANSACTION_ORDER_ADD HF 0 transactions (EURUSD,H1) 11:14:24 Symbole : EURUSD HM 0 transactions (EURUSD,H1) 11:14:24 Ticket de transaction : 0 DK 0 transactions (EURUSD,H1) 11:14:24 Type de transaction : DEAL_TYPE_BUY DQ 0 transactions (EURUSD,H1) 11:14:24 Ticket d'ordre : 11670896 DI 0 transactions (EURUSD,H1) 11:14:2424 Type d'ordre : ORDER_TYPE_BUY CR 0 transactions (EURUSD,H1) 11:14:24 Etat de l'ordre : ORDER_STATE_STARTED RI 0 transactions (EURUSD,H1) 11:14:24 Type de temps de l'ordre : ORDER_TIME_GTC JS 0 transactions (EURUSD,H1) 11:14:24 Expiration de l'ordre : 1970.01.01 00:00 DE 0 transactions (EURUSD,H1) 11:14:24 Prix : 1.23579 QN 0 transactions (EURUSD,H1) 11:14:24 Déclenchement de prix : 0 PG 0 transactions (EURUSD,H1) 11:14:24 Stop Loss : 1.2354 LM 0 transactions (EURUSD,H1) 11:14:24 Take Profit : 1.2361 EF 0 transactions (EURUSD,H1) 11:14:24 Volume : 0.1 JI 0 transactions (EURUSD,H1) 11:14:24 NS 0 transactions (EURUSD,H1) 11:14:24 ------------TransactionDescription HH 0 transactions (EURUSD,H1) 11:14:24 TRADE_TRANSACTION_ORDER_DELETE DR 0 transactions (EURUSD,H1) 11:14:24 Symbole : EURUSD LJ 0 transactions (EURUSD,H1) 11:14:24 Ticket de transaction : 0 PN 0 transactions (EURUSD,H1) 11:14:24 Type de transaction : DEAL_TYPE_BUY PD 0 transactions (EURUSD,H1) 11:14:24 Order ticket : 11670896 PL 0 transactions (EURUSD,H1) 11:14:24 Order type : ORDER_TYPE_BUY NJ 0 transactions (EURUSD,H1) 11 :11:14:24 Etat de l'ordre : ORDER_STATE_FILLED PM 0 transactions (EURUSD,H1) 11:14:24 Type de temps de l'ordre : ORDER_TIME_GTC HG 0 transactions (EURUSD,H1) 11:14:24 Expiration de l'ordre : 1970.01.01 00:00 JI 0 transactions (EURUSD,H1) 11:14:24 Prix : 1.23579 OJ 0 transactions (EURUSD,H1) 11:14:24 Déclenchement du prix : 0 NS 0 transactions (EURUSD,H1) 11:14:24 Stop Loss : 1.2354 JJ 0 transactions (EURUSD,H1) 11:14:24 Take Profit : 1.2361 FS 0 transactions (EURUSD,H1) 11:14:24 Volume : 0 HE 0 transactions (EURUSD,H1) 11:14:24 HN 0 transactions (EURUSD,H1) 11:14:24 ------------TransactionDescription FI 0 transactions (EURUSD,H1) 11 :14:24 TRADE_TRANSACTION_HISTORY_ADD HN 0 transactions (EURUSD,H1) 11:14:24 Symbole : EURUSD HE 0 transactions (EURUSD,H1) 11:14:24 Ticket de transaction : 0 DS 0 transactions (EURUSD,H1) 11 :11:14:24 Type de transaction : DEAL_TYPE_BUY DI 0 transactions (EURUSD,H1) 11:14:24 Billet d'ordre : 11670896 DQ 0 transactions (EURUSD,H1) 11:14:24 Type d'ordre : ORDER_TYPE_BUY RF 0 transactions (EURUSD,H1) 1114:24 Etat de l'ordre : ORDER_STATE_FILLED LQ 0 transactions (EURUSD,H1) 11:14:24 Type de temps de l'ordre : ORDER_TIME_GTC DK 0 transactions (EURUSD,H1) 11:14:24 Expiration de l'ordre : 1970.01.01 00:00 FM 0 transactions (EURUSD,H1) 11:14:24 Prix : 1.23579 CF 0 transactions (EURUSD,H1) 11:14:24 Déclenchement du prix : 0 RO 0 transactions (EURUSD,H1) 11:14:24 Stop Loss : 1.2354 NE 0 transactions (EURUSD,H1) 11:14:24 Take Profit : 1.2361 RO 0 transactions (EURUSD,H1) 11:14:24 Volume : 0 DQ 0 transactions (EURUSD,H1) 11:14:24 DJ 0 transactions (EURUSD,H1) 11:14:24 ------------TransactionDescription LQ 0 transactions (EURUSD,H1) 11 :14:24 TRADE_TRANSACTION_DEAL_ADD FK 0 transactions (EURUSD,H1) 11:14:24 Symbole : EURUSD DR 0 transactions (EURUSD,H1) 11:14:24 Ticket de transaction : 10809619 PF 0 transactions (EURUSD,H1) 11 :14:24 Type de transaction : DEAL_TYPE_BUY PL 0 transactions (EURUSD,H1) 11:14:24 Ticket d'ordre : 11670896 PD 0 transactions (EURUSD,H1) 11:14:24 Type d'ordre : ORDER_TYPE_BUY GN 0 transactions (EURUSD,H1) 11 :11:14:24 Etat de l'ordre : ORDER_STATE_STARTED FE 0 transactions (EURUSD,H1) 11:14:24 Type de temps de l'ordre : ORDER_TIME_GTC NO 0 transactions (EURUSD,H1) 11:14:24 Expiration de l'ordre : 1970.01.01 00:00:00 HQ 0 transactions (EURUSD,H1) 11:14:24 Prix : 1.23579 MR 0 transactions (EURUSD,H1) 11:14:24 Déclenchement de prix : 0 LK 0 transactions (EURUSD,H1) 11:14:24 Stop Loss : 1.2354 HR 0 transactions (EURUSD,H1) 11:14:24 Take Profit : 1.2361 QJ 0 transactions (EURUSD,H1) 11:14:24 Volume : 0.1 NR 0 transactions (EURUSD,H1) 11:14:24

Et ici il se ferme sur Take Profit :

DJ 0 transactions (EURUSD,H1) 11:20:38 ------------TransactionDescription JN 0 transactions (EURUSD,H1) 11:20:38 TRADE_TRANSACTION_ORDER_ADD DH 0 transactions (EURUSD,H1) 11:20:38 Symbole : EURUSD PP 0 transactions (EURUSD,H1) 11:20:38 Ticket de transaction : 0 PH 0 transactions (EURUSD,H1) 11:20:38 Type de transaction : DEAL_TYPE_BUY LR 0 transactions (EURUSD,H1)20:38 Billet d'ordre : 11670968 HG 0 transactions (EURUSD,H1) 11:20:38 Type d'ordre : ORDER_TYPE_SELL MO 0 transactions (EURUSD,H1) 11:20:38 Etat de l'ordre : ORDER_STATE_STARTED HF 0 transactions (EURUSD,H1) 11:20:38 Type de temps de l'ordre : ORDER_TIME_GTC PN 0 transactions (EURUSD,H1) 11:20:38 Expiration de l'ordre : 1970.01.01 00:00:00 JE 0 transactions (EURUSD,H1) 11:20:38 Prix : 1.2361 MS 0 transactions (EURUSD,H1) 11:20:38 Déclenchement de prix : 0 MJ 0 transactions (EURUSD,H1) 11:20:38 Stop Loss : 0 IR 0 transactions (EURUSD,H1) 11:20:38 Take Profit : 0 QD 0 transactions (EURUSD,H1) 11:20:38 Volume : 0.1 NO 0 transactions (EURUSD,H1) 11:20:38 NP 0 transactions (EURUSD,H1) 11:20:38 ------------TransactionDescription LN 0 transactions (EURUSD,H1) 11:20:38 TRADE_TRANSACTION_ORDER_DELETE DE 0 transactions (EURUSD,H1) 11:20:38 Symbole : EURUSD PK 0 transactions (EURUSD,H1) 11:20:38 Ticket de transaction : 0 PM 0 transactions (EURUSD,H1) 11:20:38 Type de transaction : DEAL_TYPE_BUY LG 0 transactions (EURUSD,H1) 11:20:38 Order ticket : 11670968 HR 0 transactions (EURUSD,H1) 11:20:38 Order type : ORDER_TYPE_SELL HH 0 transactions (EURUSD,H1) 11 :20:38 Etat de l'ordre : ORDER_STATE_FILLED FK 0 transactions (EURUSD,H1) 11:20:38 Type de temps de l'ordre : ORDER_TIME_GTC NQ 0 transactions (EURUSD,H1) 11:20:38 Expiration de l'ordre : 1970.01.01 00:00:00 HH 0 transactions (EURUSD,H1) 11:20:38 Prix : 1.2361 KL 0 transactions (EURUSD,H1) 11:20:38 Déclenchement de prix : 0 GG 0 transactions (EURUSD,H1) 11:20:38 Stop Loss : 0 GI 0 transactions (EURUSD,H1) 11:20:38 Take Profit : 0 RS 0 transactions (EURUSD,H1) 11:20:38 Volume : 0 DJ 0 transactions (EURUSD,H1) 11:20:38 HO 0 transactions (EURUSD,H1) 11:20:38 ------------TransactionDescription JI 0 transactions (EURUSD,H1) 11:20:38 TRADE_TRANSACTION_HISTORY_ADD LN 0 transactions (EURUSD,H1) 11:20:38 Symbole : EURUSD HF 0 transactions (EURUSD,H1) 11:20:38 Ticket de transaction : 0 HR 0 transactions (EURUSD,H1) 11:20:38 Type de transaction : DEAL_TYPE_BUY DH 0 transactions (EURUSD,H1) 11:20:38 Ticket d'ordre : 11670968 PM 0 transactions (EURUSD,H1) 11:20:3838 Type d'ordre : ORDER_TYPE_SELL PF 0 transactions (EURUSD,H1) 11:20:38 Etat de l'ordre : ORDER_STATE_FILLED NQ 0 transactions (EURUSD,H1) 11:20:38 Type de temps de l'ordre : ORDER_TIME_GTC FK 0 transactions (EURUSD,H1) 11:20:38 Expiration de l'ordre : 1970.01.01 00:00 PO 0 transactions (EURUSD,H1) 11:20:38 Prix : 1.2361 CF 0 transactions (EURUSD,H1) 11:20:38 Déclenchement de prix : 0 OM 0 transactions (EURUSD,H1) 11:20:38 Stop Loss : 0 OG 0 transactions (EURUSD,H1) 11:20:38 Take Profit : 0 JN 0 transactions (EURUSD,H1) 11:20:38 Volume : 0 LP 0 transactions (EURUSD,H1) 11:20:38 PE 0 transactions (EURUSD,H1) 11:20:38 ------------TransactionDescription MR 0 transactions (EURUSD,H1) 11:20:38 TRADE_TRANSACTION_POSITION JH 0 transactions (EURUSD,H1) 11:20:38 Symbole : EURUSD JP 0 transactions (EURUSD,H1) 11:20:38 Ticket de transaction : 0 FH 0 transactions (EURUSD,H1) 11:20:38 Type de transaction : DEAL_TYPE_BUY HQ 0 transactions (EURUSD,H1) 11:20:38 Ticket d'ordre : 0 DK 0 transactions (EURUSD,H1) 11:20:38 Type d'ordre : ORDER_TYPE_BUY GQ 0 transactions (EURUSD,H1) 11:20:38 Etat de l'ordre : ORDER_STATE_STARTED RH 0 transactions (EURUSD,H1) 11:20:38 Type de temps de l'ordre : ORDER_TIME_GTC JL 0 transactions (EURUSD,H1) 11:20:38 Expiration de l'ordre : 1970.01.01 00:00:00 HG 0 transactions (EURUSD,H1) 11:20:38 Prix : 1.23579 QP 0 transactions (EURUSD,H1) 11:20:38 Déclenchement du prix : 0 LI 0 transactions (EURUSD,H1) 11:20:38 Stop Loss : 1.2354 HO 0 transactions (EURUSD,H1) 11:20:38 Take Profit : 1.2361 QD 0 transactions (EURUSD,H1) 11:20:38 Volume : 0.1 NO 0 transactions (EURUSD,H1) 11:20:38 NP 0 transactions (EURUSD,H1) 11:20:38 ------------TransactionDescription FO 0 transactions (EURUSD,H1) 11:20:38 TRADE_TRANSACTION_DEAL_ADD LE 0 transactions (EURUSD,H1) 11:20:38 Symbole : EURUSD EH 0 transactions (EURUSD,H1) 11:20:38 Deal ticket : 10809689 RQ 0 transactions (EURUSD,H1) 11:20:38 Deal type : DEAL_TYPE_SELL DF 0 transactions (EURUSD,H1) 11:20:38 Order ticket : 11670968 HN 0 transactions (EURUSD,H1) 11:20:38 Order type : ORDER_TYPE_BUY CD 0 transactions (EURUSD,H1) 11 :20:38 Etat de l'ordre : ORDER_STATE_STARTED NK 0 transactions (EURUSD,H1) 11:20:38 Type de temps de l'ordre : ORDER_TIME_GTC FQ 0 transactions (EURUSD,H1) 11:20:38 Expiration de l'ordre : 1970.01.01 00:00:00 PI 0 transactions (EURUSD,H1) 11:20:38 Prix : 1.2361 CL 0 transactions (EURUSD,H1) 11:20:38 Déclenchement de prix : 0 OG 0 transactions (EURUSD,H1) 11:20:38 Stop Loss : 0 OI 0 transactions (EURUSD,H1) 11:20:38 Take Profit : 0 KQ 0 transactions (EURUSD,H1) 11:20:38 Volume : 0.1

La seule chose qui unit ces transactions est le prix(le prix de clôture est égal au prix du TP). Question - est-ce la façon de déterminer le fait de TP ? Imho, peu pratique et ambiguë (si je me souviens bien, le prix exact du TP peut ne pas se produire et le TP sera fermé à l'autre prix le plus proche).

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы - Документация по MQL5
 

Bonjour ! Je m'excuse d'avance, je suis peut-être obtus, ou je ne comprends pas certaines choses évidentes. J'essaie d'utiliser l'indicateur iMA, en essayant d'écrire selon les exemples que j'ai lus.

En général, j'essaie de procéder de cette façon. Je déclare au sommet, au-dessus de toutes les fonctions de l'EA.

double      MA[];                // массив для индикатора iMA
//---- handles for indicators
int         MA_handle;           // указатель на индикатор iMA

Ensuite, j'utilise une fonction qui fonctionnera dans la fonction OnTick(). Dans l'exemple, la fonction elle-même se trouve en bas. En fait, pour l'instant, je n'utiliserai que la dernière valeur nulle du tableau.

 if (EURNZD_d1 != 0.0) countq++;
      EURUSD_d1 = CalculateStrengthPairsTF("EURUSD"+dop_symb, PERIOD_D1);
      if (EURUSD_d1 != 0.0) countq++;
      EURCAD_d1 = CalculateStrengthPairsTF("EURCAD"+dop_symb, PERIOD_D1);
      if (EURCAD_d1 != 0.0) countq++;
      EURGBP_d1 = CalculateStrengthPairsTF("EURGBP"+dop_symb, PERIOD_D1);
      if (EURGBP_d1 != 0.0) countq++;
      EURAUD_d1 = CalculateStrengthPairsTF("EURAUD"+dop_symb, PERIOD_D1);
      if (EURAUD_d1 != 0.0) countq++;
      EURCHF_d1 = CalculateStrengthPairsTF("EURCHF"+dop_symb, PERIOD_D1);
      if (EURCHF_d1 != 0.0) countq++;
      if (countq != 0) D1_eur = NormalizeDouble((EURJPY_d1 + EURNZD_d1 + EURUSD_d1 + EURCAD_d1 + EURGBP_d1 + EURAUD_d1 + EURCHF_d1) / countq, 0);
   }
   int l_count_4 = 0;
   AVG_eur = 0;
   if (M1_eur != 0.0) l_count_4++;
   if (M5_eur != 0.0) l_count_4++;
   if (M15_eur != 0.0) l_count_4++;
   if (M30_eur != 0.0) l_count_4++;
   if (H1_eur != 0.0) l_count_4++;
   if (H4_eur != 0.0) l_count_4++;
   if (D1_eur != 0.0) l_count_4++;
   if (l_count_4 != 0) AVG_eur = (M1_eur + M5_eur + M15_eur + M30_eur + H1_eur + H4_eur + D1_eur) / l_count_4;
}

double CalculateStrengthPairsTF(string a_symbol, int a_timeframe) {
    int DIGITS_ = SymbolInfoInteger(a_symbol,SYMBOL_DIGITS);
   //---
    MqlTick last_tick;
   if(SymbolInfoTick(a_symbol,last_tick));
   double BID_ = last_tick.bid;
   BID_ = NormalizeDouble( BID_, DIGITS_);
    MA_handle=iMA(a_symbol,a_timeframe,Period_,0,method_ma,price_applied);
    //--- заполнение массива MA[] текущими значениями индикатора iMA
   //--- в массив будет записано 100 элементов
   CopyBuffer(MA_handle,0,0,100,MA);
   //--- задаём порядок индексации массива MA[] как в MQL4
   ArraySetAsSeries(MA,true);  
   double iMA_ = NormalizeDouble(MA[0], DIGITS_);

Je n'utiliserai que la dernière valeur de zéro.

Erreur 'a_timeframe' - Impossible de convertir l'enum Owl.mq5 2009 28

En ce qui concerne cette variable imino, elle est dans l'instruction de type string, vous voyez qu'elle brille elle-même en bleu...

Документация по MQL5: Основы языка / Функции / Функции обработки событий
Документация по MQL5: Основы языка / Функции / Функции обработки событий
  • www.mql5.com
Основы языка / Функции / Функции обработки событий - Документация по MQL5
 
Dimka-novitsek:

Erreur d'écriture 'a_timeframe' - Impossible de convertir l'enum Owl.mq5 2009 28

Obligez-le avec le type ENUM_TIMEFRAMES
 

Merci ! !! Est-ce la même chose que double, string ou int ? Je ne comprends pas, désolé, où dois-je mettre ce type ?

D'accord, merci !

 
Valmars:
C'est purement un bug de testeur. Le champ Trans.price_tp en cas de TRADE_TRANSACTION_DEAL_ADD peut contenir 0 ou n'importe quel déchet. Le trading en ligne produit tout correctement.
Merci. Fixe. Un correctif sera disponible dans la prochaine version.
 
//+------------------------------------------------------------------+
//| cs2011.mq5 |
//| Copyright © 2011, Xupypr |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Xupypr"
#propriété version "1.1"
//+-----------------------------------+
entrée double Risk=3 ; // lot de départ
entrée int TP=2200 ;
entrée int SL=0 ;
entrée int Fast=30 ;
entrée int Slow=500 ;
entrée int Sign=36 ;
//+-----------------------------------+
int Argent, Dépôt=5000 ;
int MACD ;
//+-----------------------------------+
void OnInit()
{
MACD=iMACD(NULL,0,Fast,Slow,Sign,PRICE_CLOSE) ;
}
//+-----------------------------------+
void OnTick()
{
statique bool UpSignal,DnSignal ;
if(TradeSignalCounter(UpSignal,DnSignal)) TradePerformer(UpSignal,DnSignal) ;
}
//+-----------------------------------+
bool TradeSignalCounter(bool &UpSignal,bool &DnSignal)
{
si(Bars(_Symbol,0)<100) return(false) ;
statique int Recount ;
if(IsNewBar() || Recount)
{
double Ind[2],Sig[3] ;
DnSignal=false ;
UpSignal=false ;
Recount=false ;
if(CopyBuffer(MACD,0,1,2,Ind)<0) Recount=true ;
si(CopyBuffer(MACD,1,1,3,Sig)<0) Recount=true ;
if(Recount==true) return(false) ;
si(Ind[0]>0 && Ind[1]<0) DnSignal=vrai ;
if(Ind[0]<0 && Ind[1]>0) UpSignal=true ;
if(Ind[1]<0 && Sig[0]<Sig[1] && Sig[1]>Sig[2]) DnSignal=true ;
if(Ind[1]>0 && Sig[0]>Sig[1] && Sig[1]<Sig[2]) UpSignal=true ;
retour (vrai) ;
}
retour (faux) ;
}
//+-----------------------------------+
bool TradePerformer(bool &UpSignal,bool &DnSignal)
{
if(UpSignal)
{
if(PositionOpen(POSITION_TYPE_BUY)) UpSignal=false ;
}
si(DnSignal)
{
if(PositionOpen(POSITION_TYPE_SELL)) DnSignal=false ;
}
retour (vrai) ;
}
//+-----------------------------------+
double Money_M()
{
HistorySelect(0,TimeCurrent()) ;
int total=HistoryDealsTotal() ;
double profit=0 ;
for(int i=0;i<total;i++)
{
ulong deal_ticket=HistoryDealGetTicket(i) ;
if(HistoryDealGetString(deal_ticket,DEAL_SYMBOL)!=_Symbol) continue ;
si(HistoryDealGetInteger(deal_ticket,DEAL_TYPE)>1) continuer ;
profit+=HistoryDealGetDouble(deal_ticket,DEAL_PROFIT) ;
profit+=HistoryDealGetDouble(deal_ticket,DEAL_SWAP) ;
}
Argent=Dépôt+profit ;
if(PositionSelect(_Symbol))
{
Argent+=PositionGetDouble(POSITION_PROFIT) ;
Argent+=PositionGetDouble(POSITION_SWAP) ;
}
double Min=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN) ;
double Limit=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_LIMIT) ;
double Lots=Risk*Money/Deposit ;
Lots=MathMin(Limit,MathMax(Min,Lots)) ;
retour(Lots) ;
}
//+-----------------------------------+
bool PositionOpen(ENUM_POSITION_TYPE Type)
{
Demande MqlTradeRequest ;
MqlTradeResult résultat ;
Vérification deMqlTradeCheckResult;
double volume=Money_M() ;
double takeprofit=0, stoploss=0 ;
if(PositionSelect(_Symbol))
{
double volumepos=PositionGetDouble(POSITION_VOLUME) ;
if(PositionGetInteger(POSITION_TYPE)==Type) volume-=volumepos ;
sinon volume+=volumepos ;
}
for(int i=0;i<10;i++)
{
volume=NormalizeDouble(volume,1) ;
si(volume<=0) pause ;
if(Type==POSITION_TYPE_SELL)
{
request.type=ORDER_TYPE_SELL ;
request.price=SymbolInfoDouble(_Symbol,SYMBOL_BID) ;
si(TP!=0) takeprofit = request.price-TP*_Point ;
si(SL!=0) stoploss = request.price+SL*_Point ;
}
if(Type==POSITION_TYPE_BUY)
{
request.type=ORDER_TYPE_BUY ;
request.price=SymbolInfoDouble(_Symbol,SYMBOL_ASK) ;
si(TP!=0) takeprofit = request.price+TP*_Point ;
si(SL!=0) stoploss = request.price-SL*_Point ;
}
request.action = TRADE_ACTION_DEAL ;
request.symbol = _Symbol ;
request.volume = MathMin(volume,SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX)) ;
request.sl = stoploss ;
request.tp = takeprofit ;
request.deviation=SymbolInfoInteger(_Symbol,SYMBOL_SPREAD) ;
request.type_filling=ORDER_FILLING_AON ;
request.comment=DoubleToString(Money,2)+"$" ;
if(!OrderCheck(request,check))
{
if(check.margin_level<100) volume=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP) ;
Print("OrderCheck Code : ",check.retcode) ;
continuer ;
}
if(!OrderSend(request,result) || result.deal==0)
{
Print("OrderSend Code : ",result.retcode) ;
if(result.retcode==TRADE_RETCODE_TRADE_DISABLED) break ;
if(result.retcode==TRADE_RETCODE_MARKET_CLOSED) break ;
if(result.retcode==TRADE_RETCODE_NO_MONEY) break ;
if(result.retcode==TRADE_RETCODE_TOO_MANY_REQUESTS) Sleep(5000) ;
if(result.retcode==TRADE_RETCODE_FROZEN) break ;
if(result.retcode==TRADE_RETCODE_CONNECTION) Sleep(15000) ;
if(result.retcode==TRADE_RETCODE_LIMIT_VOLUME) break ;
}
else volume-=result.volume ;
Sleep(1000) ;
}
if(!PositionSelect(_Symbol)) return(false) ;
retour (vrai) ;
}
//+-----------------------------------+
bool IsNewBar()
{
static datetime Told ;
datetime Tnew[1] ;
CopyTime(_Symbol,PERIOD_CURRENT,0,1,Tnew) ;
if(Tnew[0]!=Told)
{
Told=Tnew[0] ;
retour (vrai) ;
}
retour (faux) ;
}
//+-----------------------------------+

Veuillez expliquer pourquoi la ligne request.type_filling=ORDER_FILLING_AON ; dans l'EA contient l'erreur 'ORDER_FILLING_AON' - undeclared identifier cs2011.mq5 127 28 dans la version 697.



Документация по MQL5: Стандартные константы, перечисления и структуры / Структуры данных / Структура результатов проверки торгового запроса
Документация по MQL5: Стандартные константы, перечисления и структуры / Структуры данных / Структура результатов проверки торгового запроса
  • www.mql5.com
Стандартные константы, перечисления и структуры / Структуры данных / Структура результатов проверки торгового запроса - Документация по MQL5
 
FRX154:

Veuillez expliquer pourquoi la ligne request.type_filling=ORDER_FILLING_AON ; dans l'EA contient l'erreur 'ORDER_FILLING_AON' - undeclared identifier cs2011.mq5 127 28 dans la version 697.

Parce que le langage a changé depuis que l 'évaluation environnementale a été écrite.

mettez request.type_filling=ORDER_FILLING_AON dans cette ligne ;

request.type_filling=ORDER_FILLING_FOK ; et vous serez heureux.

Ou vous pouvez simplement mettre 0

request.type_filling=0 ;

fonctionnera également.

PS ou alternativement (pour éviter d'avoir à éditer l'ensemble de l'EA) vous pouvez mettre un patch tout en haut de l'ouvrage

#define ORDER_FILLING_AON ORDER_FILLING_FOK

C'est juste au cas où ORDER_FILLING_AON est mentionné plusieurs fois.

 
Pour une raison quelconque, je vois l'image suivante : lorsque je colle dans le terminal un indicateur du Navigateur vers un graphique, mais le graphique montre une zone vide pour l'indicateur, l'indicateur lui-même n'est pas affiché, mais si j'ouvre la liste des indices du graphique, il y apparaît avec la note "Debugging". Quel est cet insecte et comment puis-je le combattre ?
 
marketeer:
Pour une raison quelconque, je vois l'image suivante : lorsque je colle dans le terminal un indicateur du Navigateur vers un graphique, mais le graphique montre une zone vide pour l'indicateur, l'indicateur lui-même n'est pas affiché, mais si j'ouvre la liste des indices du graphique, il y apparaît avec la note "Debugging". Quel est ce microbe et comment y faire face ?
Recompiler
 

Braves gens, à l'aide !

Prenez le code le plus simple.

#property copyright "Copyright 2011,"
#property link      "http://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
double Vhod;
       Vhod=linfunc(15);

//---
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
     }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
     }
//+------------------------------------------------------------------+
double  linfunc(int b) // имя функции и список параметров
  {
  double a;
   while((a/b)<1 && !IsStopped())//---------
     {
      a=a+1;
     }
     double f=a+b;
// составной оператор
   return(a+b);           // возвращаемое значение

  }

Nous le compilons sur la version 687 et obtenons Vhod=0 dans le débogueur.

Comment le comprenez-vous ? En même temps, j'ai parfois obtenu Vhod=30. (étrange mais vrai).

return renvoie une absurdité...

Quels sont ces problèmes ou est-ce que je rate quelque chose ?

Raison: