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

 
penzacity:

Ho trovato sul forum che questo è possibile: https://www.mql5.com/ru/forum/141467

E dove posso trovare un emulatore di tick?

Quindi non è possibile implementare l'emulazione di tick nei fine settimana con MQL4??

È sulla pagina che hai linkato nel tuo post. Leggete attentamente.
 
artmedia70:
Proprio su quella pagina, il cui link hai inserito nel tuo post. Leggete lì con più attenzione.

Sì, sono stato stupido. Ho solo bisogno di avviare(); avviare inoltre tramite init(){}...

int init(){start();}

...

void start(){...}

Grazie, l'ho capito.

 
Yikes... Sono così stupido)))) Non capite, non toccate invano le funzioni init(), deinit() e start(). Solo nel modo in cui le grandi meta-citazioni ti dicono di))))
 
Come posso riscattare i miei bonus in denaro?
 
Alexs65:
Come posso riscattare i miei bonus in denaro?

I bonus di chi?
 

Ho il seguente codice:

extern datetime start = D'2013.10.17 23:59';

int start()

{

int b1=iBarShift(Symbol(),0,start,0);

double hb=iHigh(Symbol(),0,b1); //barra

double hb2=iHigh(Symbol(),0,b1-1); //barra di domani dalla data specificata

Potreste dirmi come mettere il giorno di ieri dalla data specificata, perché double hb3=iHigh(Symbol(),0,b1+1); non funziona...

 

Ciao a tutti!!! Ho un EA che apre ordini contro il movimento, come cambiare o consigliare dove cambiare?

stringa GLOB_START;

int init()
{
GLOB_START = "@" + DoubleToStr(ID,0) + "@" + "_start";
if !GlobalVariableCheck( GLOB_START )GlobalVariableSet(GLOB_START,TimeCurrent());
ritorno(0);
}

int deinit()
{
switch( UninitializeReason() )
{
caso REASON_REMOVE: delete_glob ("@" + DoubleToStr(ID,0) + "@" );
}
if ( IsTesting() )delete_glob ("@" + DoubleToStr(ID,0) + "@" );
ritorno(0);
}

void delete_glob ( stringa c )
{
int i;
for ( i = GlobalVariablesTotal()-1; i>= 0 ; i-- )if ( StringFind(GlobalVariableName(i),c) >= 0 )GlobalVariableDel(GlobalVariableName(i))
}

int start()
{
Commento(Info());
int KOL_BUY = order_total(0);
int KOL_SELL = order_total(1);
doppia l;

se ( order_total() == 0 )
{
aperto(0,Lot,0,TP);
aperto(1,Lotto,0,TP);
}

if ( KOL_BUY == 0 && KOL_SELL != 0 )
{
aperto(0,Lot,0,TP);
l = last_trade(1);
aperto(1,l,0,0);
modifica_ordini(1);
}

if ( KOL_BUY != 0 && KOL_SELL == 0 )
{
aperto(1,Lot,0,TP);
l = last_trade(0);
aperto(0,l,0,0);
modifica_ordini(0);
}

ritorno(0);
}

stringa Info()
{
int i;
doppio buff_1 = 0, buff_2 = 0, buff_3 = 0;
stringa res = "\n";

for( i = OrdersHistoryTotal() - 1; i >= 0; i-- )
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if( OrderMagicNumber() == ID )
{
se ( OrderOpenTime() >= iTime(NULL,PERIOD_D1,0) )buff_1 += OrderProfit();
if ( OrderOpenTime() >= iTime(NULL,PERIOD_D1,1) && OrderOpenTime() < iTime(NULL,PERIOD_D1,0) )buff_2 += OrderProfit();
if ( OrderOpenTime() >= GlobalVariableGet(GLOB_START) )buff_3 += OrderProfit();
}
}

res = res + "Profitto nella valuta di deposito per " + TimeToStr(iTime(NULL,PERIOD_D1,0)) + ": " + DoubleToStr(buff_1,0) + "\n" + "\n";
res = res + "Profitto nella valuta di deposito per " + TimeToStr(iTime(NULL,PERIOD_D1,1)) + ": " + DoubleToStr(buff_2,0) + "\n" + "\n";
res = res + "Profitto nella valuta di deposito totale:" + DoubleToStr(buff_3,0) + "\n";
return(res);
}

void modify_orders( int type )
{
int i;
datetime time_last = 0, time_first = TimeCurrent();
double SPREAD = MarketInfo(Symbol(),MODE_SPREAD)*MarketInfo(Symbol(),MODE_POINT), op_pr_last, op_pr_first, level;

for( i = OrdiniTotali() - 1; i >= 0; i-- )
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if( OrderMagicNumber() == ID && OrderType() == tipo )
{
se ( OrderOpenTime() > time_last )
{
op_pr_last = OrderOpenPrice();
time_last = OrderOpenTime();
}
se ( OrderOpenTime() < time_first )
{
op_pr_first = OrderOpenPrice();
time_first = OrderOpenTime();
}
}
}


se ( tipo == 0 )livello = op_pr_last + MathAbs(op_pr_last-op_pr_first) * (SL/100);
se ( tipo == 1 )livello = op_pr_last - MathAbs(op_pr_last-op_pr_first) * (SL/100);

for( i = OrdiniTotali() - 1; i >= 0; i -- )
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if( OrderMagicNumber() == ID && OrderType() == tipo && NormalizeDouble(OrderTakeProfit(),Digits) != NormalizeDouble(level,Digits) )OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),level,0)
}
}

double last_trade( int t )
{
int i;
doppio res = -1;
datetime time=0;

for(i=OrdiniTotali()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderOpenTime()>time && OrderMagicNumber()==ID && OrderType() == t)
{
res = OrderLots();
time = OrderOpenTime();
}
}
se ( moltiplicatore )ritorna(res * Lot_koeff);
se ( !moltiplicatore )ritorno(res + Lot_koeff);
}
int open(int type, double l, double sl=0, double tp=0, string comm = "")
{
int isOpened = 0, try = 0;
doppio s,t;
while ( IsTradeContextBusy() ){Sleep(500);}
RefreshRates();
if ( sl != 0 && sl < MarketInfo(Symbol(),MODE_STOPLEVEL) )sl = MarketInfo(Symbol(),MODE_STOPLEVEL);
if ( tp != 0 && tp < MarketInfo(Symbol(),MODE_STOPLEVEL) )tp = MarketInfo(Symbol(),MODE_STOPLEVEL);
se ( tipo == 0 )
{
se ( tp == 0 )t = 0;
if ( tp != 0 )t = Ask + tp * Point;
se ( sl == 0 )s = 0;
se ( sl != 0 )s = Bid - sl * Point;
}
se ( tipo == 1 )
{
se ( tp == 0 )t = 0;
if ( tp != 0 )t = Bid - tp * Point;
se ( sl == 0 )s = 0;
se ( sl != 0 )s = Ask + sl * Point;
}
s = NormalizeDouble(s,Digits);
t = NormalizeDouble(t,Digits);
if(type==0)isOpened = OrderSend(Symbol(),type,check_lot(l),NormalizeDouble(Ask,Digits),10,s,t,comm,ID);
if(type==1)isOpened = OrderSend(Symbol(),type,check_lot(l),NormalizeDouble(Bid,Digits),10,s,t,comm,ID);
Dormire(500);
mentre(isOpened<0)
{
while ( IsTradeContextBusy() ){Sleep(500);}
RefreshRates();
se ( tipo == 0 )
{
se ( tp == 0 )t = 0;
if ( tp != 0 )t = Bid + tp * Point;
se ( sl == 0 )s = 0;
se ( sl != 0 )s = Bid - sl * Point;
}
se ( tipo == 1 )
{
se ( tp == 0 )t = 0;
if ( tp != 0 )t = Ask - tp * Point;
se ( sl == 0 )s = 0;
se ( sl != 0 )s = Ask + sl * Point;
}
s = NormalizeDouble(s,Digits);
t = NormalizeDouble(t,Digits);
prova++;
if(type==0)isOpened = OrderSend(Symbol(),type,check_lot(l),NormalizeDouble(Ask,Digits),10,s,t,comm,ID);
if(type==1)isOpened = OrderSend(Symbol(),type,check_lot(l),NormalizeDouble(Bid,Digits),10,s,t,comm,ID);
if(try > 5) break;
if(isOpened>=0)break;
Dormire(500);
}
if(isOpened<0) Alert("Ordine non aperto, errore :", GetLastError());
return(isOpened);
}

int order_total( int type_1 = -1, int type_2 = -1 )
{
int i;
int kol=0;
for(i=OrdiniTotali()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderMagicNumber()==ID && (OrderType() == type_1 || OrderType() == type_2) )kol++;
if(OrderMagicNumber()==ID && type_1 == -1 && type_2 == -1 )kol++;
}
ritorno(kol);
}

doppio check_lot(doppio &lo)
{
double l = MarketInfo(Symbol(),MODE_LOTSTEP);
int ok = 0;
while ( l < 1 ){l*=10;ok++;}
if( lo < MarketInfo(Symbol(),MODE_MINLOT) )lo = MarketInfo(Symbol(),MODE_MINLOT);
if( lo > MarketInfo(Symbol(),MODE_MAXLOT) )lo = MarketInfo(Symbol(),MODE_MAXLOT);
return(NormalizeDouble(lo,ok));

 
Buona giornata a tutti. Signori, ho una domanda, per favore illuminatemi, se lavoro con Alpari e Master_Forex provo un Expert Advisor sulle storie che scarico dal mio terminale di lavoro, niente da fuori, niente storie lasciate, come da Dukas, niente programmi ausiliari come Tick Data Suite, solo 90% modellazione dal terminale del mio DS specificamente Alpari o Master_Forex, metodo ........ provo mezzo anno su diverse condizioni e parametri, scelgo il migliore, poi back test e il prossimo mezzo anno, quindi 2-5 anni poi tutto nel mucchio e il gufo è pronto. Può essere un prepper affidabile o ha ancora bisogno del 99% e di tutto ciò che vi è attaccato.
Grazie!!! ........
 

Come posso fare una ricerca per "Fondi:" (AccountEquity())?

Parametri

extern double TrailingStart = 10000; // livello di trailing
extern double TrailingStop = 100; // Trailing size
extern double TrailingStep = 10; // passo di trascinamento

 

Come faccio a trovare due frattali in alto/basso in una fila? L'immagine qui sotto.

Ho cercato di scrivere un indicatore, ma non ci ho pensato bene.

//+------------------------------------------------------------------+
//|                                           Dvigubas fraktalas.mq4 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_color1 Red
#property indicator_width1 2
#property indicator_buffers 1

double FRACTAL[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,119);
   SetIndexBuffer(0,FRACTAL);
   SetIndexLabel(0,"Fractal");
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   int limit;
   
   
   
//---- последний посчитанный бар будет пересчитан
   if(counted_bars > 0) 
       counted_bars--;
   limit = Bars - counted_bars;
//---- основной цикл
   for(int i = limit; i > 0; i--)
     {           
         int f1 = GetFractal("", 0, 0);
         int f2 = GetFractal("", 0, 1);
         
        if( f1 == 1 && f2 == 1) FRACTAL[i] = High[i]+100*Point;
        else 
         if( f1 == 0 && f2 == 0) FRACTAL[i] = Low[i]- 100*Point;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+
        |
//+----------------------------------------------------------------------------+
int GetFractal(string sy="0", int tf=0, int nf=0) 
{
  if (sy=="" || sy=="0") sy=Symbol();
  int f=-1;
  int    i, k=iBars(sy, tf), kf;
  for (i=3; i<k; i++) 
  {
    if(iFractals(sy, tf, MODE_UPPER, i)>0)f=1;
    else
      if(iFractals(sy, tf, MODE_LOWER, i)>0)f=0;
    kf++;
    if (kf>nf) return(f);    
  }
  
}

Forse qualcuno ha visto un tale indicatore pronto?

Motivazione: