[Qualsiasi domanda da principiante, per non ingombrare il forum. Professionisti, non passate. Non posso andare da nessuna parte senza di te. - pagina 175

 
signori, potete dirmi... se voglio testare gli ingressi separatamente in un sistema... allora dovrei puntare al 51% di successi o superiore nel risultato per pensare che questi ingressi funzioneranno bene in combinazione con il resto del sistema? beh, ovviamente ci dovrebbe essere SL=TP nel funzionamento degli ingressi.
 

È possibile dichiarare un array con un insieme di tipi di dati diversi? A quanto pare no. Domanda "test"... per così dire...

 
DDFedor писал(а) >>

È possibile dichiarare un array con un insieme di tipi di dati diversi? A quanto pare no. Domanda "test"... per così dire...

Controllare la risposta. No.

 
Gente, aiutatemi a trovare un bug. Perché il cicalino non funziona nel tacchino? È lì, per quanto ne so. Ho attivato Alert nelle impostazioni ma nessun segnale acustico. La freccia appare su tutto l'indyuk funziona bene ma il beeper per qualche motivo che glitch((( Grazie in anticipo tutti!
roperty indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Yellow
#property indicator_color2 Green
#property indicator_color3 Red
#property indicator_color4 Yellow
#property indicator_color5 Aqua

extern bool Crash = FALSE;
extern int TimeFrame = 60;
extern int Length = 7;
extern int Method = 3;
extern int Smoothing = 2;
extern int Filter = 2;
extern bool RealTime = TRUE;
extern bool Steady = FALSE;
extern bool Color = TRUE;
extern bool Alerts = TRUE;
extern bool EmailON = FALSE;
extern bool SignalPrice = TRUE;
extern color SignalPriceBUY = Yellow;
extern color SignalPriceSELL = Aqua;
extern int CountBars = 1485;
double g_ibuf_136[];
double g_ibuf_140[];
double g_ibuf_144[];
double g_ibuf_148[];
double g_ibuf_152[];
double g_ibuf_156[];
double g_ibuf_160[];
double g_ibuf_164[];
bool gi_168 = TRUE;
bool gi_172 = TRUE;
int g_datetime_176 = 0;
int g_datetime_180 = 0;
int gi_184 = 0;

int init() {
   string ls_0;
   IndicatorBuffers(8);
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(0, g_ibuf_140);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(1, g_ibuf_152);
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(2, g_ibuf_156);
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(3, 233);
   SetIndexBuffer(3, g_ibuf_160);
   SetIndexStyle(4, DRAW_ARROW);
   SetIndexArrow(4, 234);
   SetIndexBuffer(4, g_ibuf_164);
   SetIndexBuffer(5, g_ibuf_136);
   SetIndexBuffer(6, g_ibuf_148);
   SetIndexBuffer(7, g_ibuf_144);
   if ( Length < 2) Length = 2;
   if ( Method < MODE_SMA) Method = 0;
   if ( Method > MODE_LWMA) Method = 3;
   if ( Smoothing < 0) Smoothing = 0;
   if ( Filter < 0) Filter = 0;
   if ( TimeFrame < Period() && TimeFrame != 0) TimeFrame = Period();
   switch ( TimeFrame) {
   case 1:
      ls_0 = "M1";
      break;
   case 5:
      ls_0 = "M5";
      break;
   case 15:
      ls_0 = "M15";
      break;
   case 30:
      ls_0 = "M30";
      break;
   case 60:
      ls_0 = "H1";
      break;
   case 240:
      ls_0 = "H4";
      break;
   case 1440:
      ls_0 = "D1";
      break;
   case 10080:
      ls_0 = "W1";
      break;
   case 43200:
      ls_0 = "MN1";
      break;
   default:
      ls_0 = "";
   }
   string ls_12 = "pfd_snake_trend" + ls_0 + " |  " + Length + " , " + Method + " , " + Smoothing + " , " + Filter + "  | ";
   IndicatorShortName( ls_12);
   return (0);
}

int start() {
   int lia_0[];
   int li_4;
   int l_index_8;
   string ls_12;
   if (Time[0] > StrToTime("01.02.2010 23:59")) return (0);
   if (Bars < 100) {
      IndicatorShortName("Bars less than 100");
      return (0);
   }
   if ( g_datetime_176 < iTime(NULL, TimeFrame, 0)) {
      gi_172 = FALSE;
      gi_168 = FALSE;
      g_datetime_176 = iTime(NULL, TimeFrame, 0);
   }
   if (! RealTime) {
      if ( g_datetime_180 == iTime(NULL, TimeFrame, 0)) return (0);
      g_datetime_180 = iTime(NULL, TimeFrame, 0);
      gi_184 = TimeFrame / Period() + 1;
      if ( gi_184 == 0) gi_184 = 1;
   }
   double ld_unused_20 = 0;
   double l_ima_28 = 0;
   double l_ima_36 = 0;
   double l_ima_44 = 0;
   double l_ima_52 = 0;
   double l_ima_60 = 0;
   if ( CountBars > iBars(NULL, TimeFrame) || CountBars > Bars - Length - 1) CountBars = MathMin(Bars - Length - 1, iBars(NULL, TimeFrame) - Length - 1);
   if ( Crash && CountBars > 0) {
      CountBars -= 10;
      IndicatorShortName("Crash: " + CountBars + "     ");
   }
   if ( Crash && CountBars < 0) IndicatorShortName("Crash");
   int li_68 = CountBars;
   g_ibuf_140[ li_68 + 1] = Close[ li_68 + 1];
   g_ibuf_144[ li_68 + 1] = Close[ li_68 + 1];
   while ( li_68 >= 0) {
      l_ima_28 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_HIGH, li_68);
      l_ima_36 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_LOW, li_68);
      l_ima_44 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_OPEN, li_68);
      l_ima_52 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_CLOSE, li_68);
      l_ima_60 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_CLOSE, li_68 + Smoothing);
      if ( Steady == TRUE) {
         l_ima_52 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_MEDIAN, li_68);
         l_ima_60 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_MEDIAN, li_68 + Smoothing);
      }
      g_ibuf_136[ li_68] = MathAbs((( l_ima_52 - l_ima_60) / MathMax( l_ima_28 - l_ima_36, MathMax( l_ima_28 - l_ima_60, l_ima_60 - l_ima_36)) + ( l_ima_52 - l_ima_44) / ( l_ima_28 - l_ima_36)) / 2.0) * (( l_ima_52 - l_ima_60 +
         ( l_ima_52 - l_ima_44)) / 2.0);
      g_ibuf_140[ li_68] = g_ibuf_140[ li_68 + 1] + g_ibuf_136[ li_68];
      if ( Filter > 0)
         if (MathAbs( g_ibuf_140[ li_68] - ( g_ibuf_140[ li_68 + 1])) < Filter * Point) g_ibuf_140[ li_68] = g_ibuf_140[ li_68 + 1];
      if ( TimeFrame > Period()) g_ibuf_144[ li_68] = g_ibuf_140[ li_68];
      li_68--;
   }
   if ( TimeFrame > Period()) {
      ArrayCopySeries( lia_0, 5, Symbol(), TimeFrame);
      li_4 = CountBars + TimeFrame / Period();
      li_68 = 0;
      l_index_8 = 0;
      while ( li_68 < li_4) {
         if (Time[ li_68] < lia_0[ l_index_8]) l_index_8++;
         g_ibuf_140[ li_68] = g_ibuf_144[ l_index_8];
         li_68++;
      }
   }
   for ( li_68 = CountBars; li_68 >= 0; li_68--) {
      g_ibuf_148[ li_68] = g_ibuf_148[ li_68 + 1];
      if ( g_ibuf_140[ li_68] - ( g_ibuf_140[ li_68 + 1]) > 0.0) g_ibuf_148[ li_68] = 1;
      if ( g_ibuf_140[ li_68 + 1] - g_ibuf_140[ li_68] > 0.0) g_ibuf_148[ li_68] = -1;
      if ( Color == TRUE) {
         if ( g_ibuf_148[ li_68] > 0.0) {
            g_ibuf_152[ li_68] = g_ibuf_140[ li_68];
            if ( g_ibuf_148[ li_68 + 1] < 0.0) g_ibuf_152[ li_68 + 1] = g_ibuf_140[ li_68 + 1];
            g_ibuf_156[ li_68] = EMPTY_VALUE;
         } else {
            if ( g_ibuf_148[ li_68] < 0.0) {
               g_ibuf_156[ li_68] = g_ibuf_140[ li_68];
               if ( g_ibuf_148[ li_68 + 1] > 0.0) g_ibuf_156[ li_68 + 1] = g_ibuf_140[ li_68 + 1];
               g_ibuf_152[ li_68] = EMPTY_VALUE;
            }
         }
      }
      
      
//--------------------------------------------------------      
      if ( Alerts == TRUE)
      {
         g_ibuf_160[ li_68] = EMPTY_VALUE;
         g_ibuf_164[ li_68] = EMPTY_VALUE;
         if ( g_ibuf_148[ li_68] == 1.0 && g_ibuf_148[ li_68 + 1] == -1.0) g_ibuf_160[ li_68] = g_ibuf_140[ li_68 + 1] - (Ask - Bid);
         if ( g_ibuf_148[ li_68] == -1.0 && g_ibuf_148[ li_68 + 1] == 1.0) g_ibuf_164[ li_68] = g_ibuf_140[ li_68 + 1] + (Ask - Bid);
      }
   }
   
//-------------------------------------
   if ( Alerts == TRUE)
   {
      if ( g_ibuf_160[ gi_184 + 0] != EMPTY_VALUE && gi_168 == FALSE)
      {
         if ( SignalPrice == TRUE)
         {
            ObjectCreate("BUY SIGNAL: " + DoubleToStr(Time[0], 0), OBJ_ARROW, 0, Time[0], Close[0]);
            ObjectSet("BUY SIGNAL: " + DoubleToStr(Time[0], 0), OBJPROP_ARROWCODE, SYMBOL_LEFTPRICE);
            ObjectSet("BUY SIGNAL: " + DoubleToStr(Time[0], 0), OBJPROP_COLOR, SignalPriceBUY);
         }
         gi_172 = FALSE;
         gi_168 = TRUE;
      }
      
      
      if ( g_ibuf_164[ gi_184 + 0] != EMPTY_VALUE && gi_172 == FALSE)
      {
         if ( SignalPrice == TRUE)
         {
            ObjectCreate("SELL SIGNAL: " + DoubleToStr(Time[0], 0), OBJ_ARROW, 0, Time[0], Close[0]);
            ObjectSet("SELL SIGNAL: " + DoubleToStr(Time[0], 0), OBJPROP_ARROWCODE, SYMBOL_LEFTPRICE);
            ObjectSet("SELL SIGNAL: " + DoubleToStr(Time[0], 0), OBJPROP_COLOR, SignalPriceSELL);
         }
         gi_168 = FALSE;
         gi_172 = TRUE;
      }
   }
   return (0);
 
Gente, aiutatemi a trovare un bug. Perché il cicalino non funziona nel tacchino? È lì, per quanto ne so. Ho attivato Alert nelle impostazioni ma nessun segnale acustico. La freccia appare su tutto l'indyuk funziona bene ma il beeper per qualche motivo che glitch((( Grazie in anticipo tutti!
roperty indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Yellow
#property indicator_color2 Green
#property indicator_color3 Red
#property indicator_color4 Yellow
#property indicator_color5 Aqua

extern bool Crash = FALSE;
extern int TimeFrame = 60;
extern int Length = 7;
extern int Method = 3;
extern int Smoothing = 2;
extern int Filter = 2;
extern bool RealTime = TRUE;
extern bool Steady = FALSE;
extern bool Color = TRUE;
extern bool Alerts = TRUE;
extern bool EmailON = FALSE;
extern bool SignalPrice = TRUE;
extern color SignalPriceBUY = Yellow;
extern color SignalPriceSELL = Aqua;
extern int CountBars = 1485;
double g_ibuf_136[];
double g_ibuf_140[];
double g_ibuf_144[];
double g_ibuf_148[];
double g_ibuf_152[];
double g_ibuf_156[];
double g_ibuf_160[];
double g_ibuf_164[];
bool gi_168 = TRUE;
bool gi_172 = TRUE;
int g_datetime_176 = 0;
int g_datetime_180 = 0;
int gi_184 = 0;

int init() {
   string ls_0;
   IndicatorBuffers(8);
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(0, g_ibuf_140);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(1, g_ibuf_152);
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(2, g_ibuf_156);
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(3, 233);
   SetIndexBuffer(3, g_ibuf_160);
   SetIndexStyle(4, DRAW_ARROW);
   SetIndexArrow(4, 234);
   SetIndexBuffer(4, g_ibuf_164);
   SetIndexBuffer(5, g_ibuf_136);
   SetIndexBuffer(6, g_ibuf_148);
   SetIndexBuffer(7, g_ibuf_144);
   if ( Length < 2) Length = 2;
   if ( Method < MODE_SMA) Method = 0;
   if ( Method > MODE_LWMA) Method = 3;
   if ( Smoothing < 0) Smoothing = 0;
   if ( Filter < 0) Filter = 0;
   if ( TimeFrame < Period() && TimeFrame != 0) TimeFrame = Period();
   switch ( TimeFrame) {
   case 1:
      ls_0 = "M1";
      break;
   case 5:
      ls_0 = "M5";
      break;
   case 15:
      ls_0 = "M15";
      break;
   case 30:
      ls_0 = "M30";
      break;
   case 60:
      ls_0 = "H1";
      break;
   case 240:
      ls_0 = "H4";
      break;
   case 1440:
      ls_0 = "D1";
      break;
   case 10080:
      ls_0 = "W1";
      break;
   case 43200:
      ls_0 = "MN1";
      break;
   default:
      ls_0 = "";
   }
   string ls_12 = "pfd_snake_trend" + ls_0 + " |  " + Length + " , " + Method + " , " + Smoothing + " , " + Filter + "  | ";
   IndicatorShortName( ls_12);
   return (0);
}

int start() {
   int lia_0[];
   int li_4;
   int l_index_8;
   string ls_12;
   if (Time[0] > StrToTime("01.02.2010 23:59")) return (0);
   if (Bars < 100) {
      IndicatorShortName("Bars less than 100");
      return (0);
   }
   if ( g_datetime_176 < iTime(NULL, TimeFrame, 0)) {
      gi_172 = FALSE;
      gi_168 = FALSE;
      g_datetime_176 = iTime(NULL, TimeFrame, 0);
   }
   if (! RealTime) {
      if ( g_datetime_180 == iTime(NULL, TimeFrame, 0)) return (0);
      g_datetime_180 = iTime(NULL, TimeFrame, 0);
      gi_184 = TimeFrame / Period() + 1;
      if ( gi_184 == 0) gi_184 = 1;
   }
   double ld_unused_20 = 0;
   double l_ima_28 = 0;
   double l_ima_36 = 0;
   double l_ima_44 = 0;
   double l_ima_52 = 0;
   double l_ima_60 = 0;
   if ( CountBars > iBars(NULL, TimeFrame) || CountBars > Bars - Length - 1) CountBars = MathMin(Bars - Length - 1, iBars(NULL, TimeFrame) - Length - 1);
   if ( Crash && CountBars > 0) {
      CountBars -= 10;
      IndicatorShortName("Crash: " + CountBars + "     ");
   }
   if ( Crash && CountBars < 0) IndicatorShortName("Crash");
   int li_68 = CountBars;
   g_ibuf_140[ li_68 + 1] = Close[ li_68 + 1];
   g_ibuf_144[ li_68 + 1] = Close[ li_68 + 1];
   while ( li_68 >= 0) {
      l_ima_28 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_HIGH, li_68);
      l_ima_36 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_LOW, li_68);
      l_ima_44 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_OPEN, li_68);
      l_ima_52 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_CLOSE, li_68);
      l_ima_60 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_CLOSE, li_68 + Smoothing);
      if ( Steady == TRUE) {
         l_ima_52 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_MEDIAN, li_68);
         l_ima_60 = iMA(NULL, TimeFrame, Length, 0, Method, PRICE_MEDIAN, li_68 + Smoothing);
      }
      g_ibuf_136[ li_68] = MathAbs((( l_ima_52 - l_ima_60) / MathMax( l_ima_28 - l_ima_36, MathMax( l_ima_28 - l_ima_60, l_ima_60 - l_ima_36)) + ( l_ima_52 - l_ima_44) / ( l_ima_28 - l_ima_36)) / 2.0) * (( l_ima_52 - l_ima_60 +
         ( l_ima_52 - l_ima_44)) / 2.0);
      g_ibuf_140[ li_68] = g_ibuf_140[ li_68 + 1] + g_ibuf_136[ li_68];
      if ( Filter > 0)
         if (MathAbs( g_ibuf_140[ li_68] - ( g_ibuf_140[ li_68 + 1])) < Filter * Point) g_ibuf_140[ li_68] = g_ibuf_140[ li_68 + 1];
      if ( TimeFrame > Period()) g_ibuf_144[ li_68] = g_ibuf_140[ li_68];
      li_68--;
   }
   if ( TimeFrame > Period()) {
      ArrayCopySeries( lia_0, 5, Symbol(), TimeFrame);
      li_4 = CountBars + TimeFrame / Period();
      li_68 = 0;
      l_index_8 = 0;
      while ( li_68 < li_4) {
         if (Time[ li_68] < lia_0[ l_index_8]) l_index_8++;
         g_ibuf_140[ li_68] = g_ibuf_144[ l_index_8];
         li_68++;
      }
   }
   for ( li_68 = CountBars; li_68 >= 0; li_68--) {
      g_ibuf_148[ li_68] = g_ibuf_148[ li_68 + 1];
      if ( g_ibuf_140[ li_68] - ( g_ibuf_140[ li_68 + 1]) > 0.0) g_ibuf_148[ li_68] = 1;
      if ( g_ibuf_140[ li_68 + 1] - g_ibuf_140[ li_68] > 0.0) g_ibuf_148[ li_68] = -1;
      if ( Color == TRUE) {
         if ( g_ibuf_148[ li_68] > 0.0) {
            g_ibuf_152[ li_68] = g_ibuf_140[ li_68];
            if ( g_ibuf_148[ li_68 + 1] < 0.0) g_ibuf_152[ li_68 + 1] = g_ibuf_140[ li_68 + 1];
            g_ibuf_156[ li_68] = EMPTY_VALUE;
         } else {
            if ( g_ibuf_148[ li_68] < 0.0) {
               g_ibuf_156[ li_68] = g_ibuf_140[ li_68];
               if ( g_ibuf_148[ li_68 + 1] > 0.0) g_ibuf_156[ li_68 + 1] = g_ibuf_140[ li_68 + 1];
               g_ibuf_152[ li_68] = EMPTY_VALUE;
            }
         }
      }
      
      
//--------------------------------------------------------      
      if ( Alerts == TRUE)
      {
         g_ibuf_160[ li_68] = EMPTY_VALUE;
         g_ibuf_164[ li_68] = EMPTY_VALUE;
         if ( g_ibuf_148[ li_68] == 1.0 && g_ibuf_148[ li_68 + 1] == -1.0) g_ibuf_160[ li_68] = g_ibuf_140[ li_68 + 1] - (Ask - Bid);
         if ( g_ibuf_148[ li_68] == -1.0 && g_ibuf_148[ li_68 + 1] == 1.0) g_ibuf_164[ li_68] = g_ibuf_140[ li_68 + 1] + (Ask - Bid);
      }
   }
   
//-------------------------------------
   if ( Alerts == TRUE)
   {
      if ( g_ibuf_160[ gi_184 + 0] != EMPTY_VALUE && gi_168 == FALSE)
      {
         if ( SignalPrice == TRUE)
         {
            ObjectCreate("BUY SIGNAL: " + DoubleToStr(Time[0], 0), OBJ_ARROW, 0, Time[0], Close[0]);
            ObjectSet("BUY SIGNAL: " + DoubleToStr(Time[0], 0), OBJPROP_ARROWCODE, SYMBOL_LEFTPRICE);
            ObjectSet("BUY SIGNAL: " + DoubleToStr(Time[0], 0), OBJPROP_COLOR, SignalPriceBUY);
         }
         gi_172 = FALSE;
         gi_168 = TRUE;
      }
      
      
      if ( g_ibuf_164[ gi_184 + 0] != EMPTY_VALUE && gi_172 == FALSE)
      {
         if ( SignalPrice == TRUE)
         {
            ObjectCreate("SELL SIGNAL: " + DoubleToStr(Time[0], 0), OBJ_ARROW, 0, Time[0], Close[0]);
            ObjectSet("SELL SIGNAL: " + DoubleToStr(Time[0], 0), OBJPROP_ARROWCODE, SYMBOL_LEFTPRICE);
            ObjectSet("SELL SIGNAL: " + DoubleToStr(Time[0], 0), OBJPROP_COLOR, SignalPriceSELL);
         }
         gi_168 = FALSE;
         gi_172 = TRUE;
      }
   }
   return (0);
 
Porca miseria...è tutto glitchato)))) Ho postato due volte... È appena apparso un messaggio che - non puoi aggiungere un commento perché c'è troppo testo))) Ma ha aggiunto))
 

Come posso fare in modo che il gufo funzioni solo negli orari specificati, cioè da T1 a T2?

 
Sta2066 писал(а) >>

Come posso fare in modo che il gufo funzioni solo nei momenti specificati, cioè da T1 a T2?

extern int     StartHour      =       -1;
extern int     StopHour       =       -1;
extern int     StartWeek      =       -1;
extern int     StopWeek       =       -1;

int start(){
   if (! CheckWeek()) return(0);
   if (! CheckHour()) return(0);
}

bool CheckHour(){
   if ( StartHour==-1 || StopHour==-1) return(true);
   if ( StartHour== StopHour && TimeHour(Time[0])== StartHour) return(true);
   if ( StartHour< StopHour){
      if ( StartHour<=TimeHour(Time[0]) && TimeHour(Time[0])<= StopHour) return(true);
      return(false);
   }
   if ( StartHour> StopHour){
      if ( StartHour>=TimeHour(Time[0]) || TimeHour(Time[0])>= StopHour) return(true);
      return(false);
   }
   return(false);
}

bool CheckWeek(){
   if ( StartWeek==-1 || StopWeek==-1) return(true);
   if (TimeDayOfWeek(Time[0]) == 1 && TimeHour(Time[0])< StartWeek ) return(false);
   if (TimeDayOfWeek(Time[0]) == 5 && TimeHour(Time[0])> StopWeek ) return(false);
   return(true);
}
CheckHour() per monitorare le ore di lavoro
 
Sta2066 писал(а) >>

Come posso fare in modo che il gufo funzioni solo negli orari specificati, cioè da T1 a T2?

Anche qui... >> 'MetaEditor: affidarsi alla potenza dei modelli'.

 

Qual è il problema?

//+------------------------------------------------------------------+
//| ad+muv.mq4 |
//| Evgenio |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Evgenio"
#property link "http://www.metaquotes.net"

//---- input parameters
extern int period_ma=21;
extern int period_adx=10;
extern int filt=5;
double muv;
int t;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if (OrdersTotal()==0)
{
muv=(iMA(Symbol(),PERIOD_M15,period_ma,0,MODE_LWMA,PRICE_CLOSE,1)-(High[1]-((High[1]-Low[1])/2)))*(-1)*100;
double adx_main=iADX(Symbol(),PERIOD_M15,period_adx,PRICE_CLOSE,MODE_MAIN,0);
double adx_min=iADX(Symbol(),PERIOD_M15,period_adx,PRICE_CLOSE,MODE_MINUSDI,0);
double adx_plus=iADX(Symbol(),PERIOD_M15,period_adx,PRICE_CLOSE,MODE_PLUSDI,0);
if (muv<0 && MathAbs(muv)>0.1 && adx_main>adx_min && adx_min>adx_plus)
{
t=OrderSend(Symbol(),OP_SELL,0.1,Bid,3,NULL,NULL,"My order #",16384,0,Green);
Print (GetLastError());
}
}

if (OrdersTotal()>0)
{
if (muv>0)
{
OrderSelect(t,SELECT_BY_TICKET,MODE_TRADES);
OrderClose(t,0.1,Ask,3,Red);
Print (GetLastError());
}
}
return(0);
}
//+------------------------------------------------------------------+


dovrebbe chiudere qui


Motivazione: