Ti stai perdendo delle opportunità di trading:
- App di trading gratuite
- Oltre 8.000 segnali per il copy trading
- Notizie economiche per esplorare i mercati finanziari
Registrazione
Accedi
Accetti la politica del sito e le condizioni d’uso
Se non hai un account, registrati
Caro Mladen,
Scusa per la domanda di base - sono sempre in difficoltà quando un codice ha bisogno di operazioni con data e ora. C'è una costante 120 nella linea 97 di AverageJoe EA che hai postato in questo forum un paio di giorni fa:
if (OrderType() == OP_SELL && CurTime()-LastSellTime >=120) result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
Qual è l'unità di misura di quel 120?
Saluti,
Chrisstoff
Chrisstoff Quelli sono secondi (metatrader salva il tempo come un numero di secondi passati dalla 1.1.1970 se non mi sbaglio, ma il punto è che funziona sempre con i secondi quando viene dichiarata una variabile datetime o viene chiamata una funzione come CurrentTime())
Mladen,
Grazie per la risposta veloce.
Caro Mladen,
Scusa per la domanda di base - sono sempre in difficoltà quando un codice ha bisogno di operazioni con data e ora. C'è una costante 120 nella linea 97 di AverageJoe EA che hai postato in questo forum un paio di giorni fa:
if (OrderType() == OP_SELL && CurTime()-LastSellTime >=120) result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
Qual è l'unità di misura di quel 120?
Saluti,
ChrisstoffChrisstoff
Quelli sono secondi (metatrader salva il tempo come numero di secondi passati dalla 1.1.1970 se non sbaglio, ma il punto è che lavora sempre con i secondi quando viene dichiarata una variabile datetime o viene chiamata una funzione come CurrentTime())
Modificare gli indicatori Grazie a!
#proprietà indicator_chart_window
#proprietà indicator_buffers 5
//---- parametri di ingresso
extern int TimeFramePeriod;
extern int N=100;
//
extern double CustoMA1;
extern double CustoMA2; // extern double CustoMA2
extern double CustoMA3; // extern double CustoMA3
extern double CustoMA4;
extern double high20;
extern double low20;
//
#proprietà indicatore_colore1 Rosso
#proprietà indicator_color2 Lime
#proprietà indicatore_colore3 Arancione
#proprietà indicatore_colore4 Rosso
//--- buffer
doppio CustoMA1[]
doppio CustoMA2[]
doppio CustoMA3[]
double CustoMA4[]
double tr[];
//
int init() {
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, CustoMA1);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, CustoMA2);
SetIndexStyle(2, DRAW_LINE);
SetIndexBuffer(2, CustoMA3);
SetIndexStyle(3, DRAW_LINE);
SetIndexBuffer(3, CustoMA4);
SetIndexStyle(4, DRAW_LINE);
SetIndexBuffer(4, tr);
ritorno (0);
}
//---- buffer
doppio buff[];
//+------------------------------------------------------------------+
//|funzione di inizializzazione dell'indicatore personalizzata |
//+------------------------------------------------------------------+
//int init()
//{
//if (Bars < MIN_BARS_REQUIRED) return(-1);
//IndicatorDigits(Digits);
//SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
//SetIndexBuffer(0, buff);
//stringa paramDesc = "("+getPeriodDesc(TimeFramePeriod) + ", "")";
//IndicatorShortName("" + paramDesc);
// Imposta le etichette dell'indice
//SetIndexLabel(0, "" + paramDesc);
//----
//return(0);
}
//+------------------------------------------------------------------+
//|Funzione personalizzata di deinizializzazione dell'indicatore |
//+------------------------------------------------------------------+
int start()
{
int Limite;
int counted_bars=IndicatorCounted();
//----
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
int i=0;
for (i=Mathmin(Bars-5,Limit);i>=0;i--);
tr[]=MathMax(MathMax(High-Low,MathAbs(Close-High)),MathAbs(Close-Low));
higt20=H=HHV(H,N);
low20=L=LLV(L,N);
//
MA1=H-tr[]*0.1;
MA2=H-tr[]*0.2;
MA3=L+tr[]*0.1;
MA4=L+tr[]*0.2;
//
CustoMA1=REF(MA1,BarsSince(higt20));
CustoMA2=REF(MA2,BarsSince(higt20));
CustoMA3=REF(MA3,BarsSince(low20));
CustoMA4=REF(MA4,BarsSince(low20));
//
Plot(CustoMA1, "TREND",colorRed);
Plot(CustoMA2, "TREND",colorLime);
Plot(CustoMA3, "TREND",colorOrange);
Plot(CustoMA4, "TREND",colorRed);
//----
return(0);
//+------------------------------------------------------------------+
stringa getPeriodDesc(int aNumMinutes)
{
switch(aNumMinutes)
{
caso PERIODO_M1 : return("M1");
caso PERIODO_M15: return("M15");
caso PERIODO_M30 : return("M30");;
caso PERIOD_H1 : return("H1");
caso PERIOD_H4 : return("H4");
caso PERIOD_D1 : return("D1");
caso PERIOD_W1 : return("W1");;
caso PERIOD_MN1 : return("MN1");
caso 0: return("Grafico");
default: return("M" + aNumMinutes);
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double getDeMarker(int aShift)
{
return(iDeMarker(NULL, TimeFramePeriod, 13, iBarShift(NULL, TimeFramePeriod, Time[aShift]));
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
for(int shift=Bars-1;shift>=0;shift--)
{
buff[shift]=getDeMarker(shift);
}
return(0);
}
//+------------------------------------------------------------------+
Scusa! Incolla il codice qui
Kreangast
2013/5/21
Modificare gli indicatori Grazie a!
#proprietà indicator_chart_window
#proprietà indicator_buffers 5
//---- parametri di ingresso
extern int TimeFramePeriod;
extern int N=100;
//
extern double CustoMA1;
extern double CustoMA2; // extern double CustoMA2
extern double CustoMA3; // extern double CustoMA3
extern double CustoMA4;
extern double high20;
extern double low20;
//
#proprietà indicatore_colore1 Rosso
#proprietà indicator_color2 Lime
#proprietà indicatore_colore3 Arancione
#proprietà indicatore_colore4 Rosso
//--- buffer
doppio CustoMA1[]
doppio CustoMA2[]
doppio CustoMA3[]
double CustoMA4[]
double tr[];
//
int init() {
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, CustoMA1);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, CustoMA2);
SetIndexStyle(2, DRAW_LINE);
SetIndexBuffer(2, CustoMA3);
SetIndexStyle(3, DRAW_LINE);
SetIndexBuffer(3, CustoMA4);
SetIndexStyle(4, DRAW_LINE);
SetIndexBuffer(4, tr);
ritorno (0);
}
//---- buffer
doppio buff[];
//+------------------------------------------------------------------+
//|funzione di inizializzazione dell'indicatore personalizzata |
//+------------------------------------------------------------------+
//int init()
//{
//if (Bars < MIN_BARS_REQUIRED) return(-1);
//IndicatorDigits(Digits);
//SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
//SetIndexBuffer(0, buff);
//stringa paramDesc = "("+getPeriodDesc(TimeFramePeriod) + ", "")";
//IndicatorShortName("" + paramDesc);
// Imposta le etichette dell'indice
//SetIndexLabel(0, "" + paramDesc);
//----
//return(0);
}
//+------------------------------------------------------------------+
//|Funzione personalizzata di deinizializzazione dell'indicatore |
//+------------------------------------------------------------------+
int start()
{
int Limite;
int counted_bars=IndicatorCounted();
//----
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
int i=0;
for (i=Mathmin(Bars-5,Limit);i>=0;i--);
tr[]=MathMax(MathMax(High-Low,MathAbs(Close-High)),MathAbs(Close-Low));
higt20=H=HHV(H,N);
low20=L=LLV(L,N);
//
MA1=H-tr[]*0.1;
MA2=H-tr[]*0.2;
MA3=L+tr[]*0.1;
MA4=L+tr[]*0.2;
//
CustoMA1=REF(MA1,BarsSince(higt20));
CustoMA2=REF(MA2,BarsSince(higt20));
CustoMA3=REF(MA3,BarsSince(low20));
CustoMA4=REF(MA4,BarsSince(low20));
//
Plot(CustoMA1, "TREND",colorRed);
Plot(CustoMA2, "TREND",colorLime);
Plot(CustoMA3, "TREND",colorOrange);
Plot(CustoMA4, "TREND",colorRed);
//----
return(0);
//+------------------------------------------------------------------+
stringa getPeriodDesc(int aNumMinutes)
{
switch(aNumMinutes)
{
caso PERIODO_M1 : return("M1");
caso PERIODO_M15: return("M15");
caso PERIODO_M30 : return("M30");;
caso PERIOD_H1 : return("H1");
caso PERIOD_H4 : return("H4");
caso PERIOD_D1 : return("D1");
caso PERIOD_W1 : return("W1");;
caso PERIOD_MN1 : return("MN1");
caso 0: return("Grafico");
default: return("M" + aNumMinutes);
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double getDeMarker(int aShift)
{
return(iDeMarker(NULL, TimeFramePeriod, 13, iBarShift(NULL, TimeFramePeriod, Time[aShift]));
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
for(int shift=Bars-1;shift>=0;shift--)
{
buff[shift]=getDeMarker(shift);
}
return(0);
}
//+------------------------------------------------------------------+
Scusa! Incolla il codice qui
Kreangast
2013/5/21Questo è qualcuno che sta cercando di combinare il codice di tadestation con un codice di metatrader. Non funzionerà in quel modo e non può essere combinato in quel modo
A :mladen
Potresti entrare in MT4 va bene? Una sezione di codice TS, non scriverò MT4 . Grazie.
Kreangast
2013-5-21
A :mladen
Potrebbe entrare in MT4 senza problemi? Una sezione di codice TS, non scriverò MT4 . Grazie.
Kreangast
2013-5-21Da quello che hai postato non è possibile vedere cosa dovrebbe fare
A :mladen
Vorrei chiedere come si fa?
Grazie a voi
Kreangast
A :mladen
Vorrei chiedere come fare?
Grazie, grazie.
KreangastPer iniziare, dovrai prima leggere questi: https: //www.mql5.com/en/forum/172969/page2 e poi qualcosa di simile per tradestation e poi potrai convertire il codice da un linguaggio di codifica ad un altro linguaggio di codifica
Per iniziare, si dovrà prima leggere questi: https: //www.mql5.com/en/forum/172969/page2 e poi qualcosa di simile per tradestation e poi si può convertire il codice da un linguaggio di codifica ad un altro linguaggio di codifica
Ma questo codice non scrive, guai a voi in MT4 ok? Estremamente grato
Kreangast
2013/5/21