[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 250

 
AndBar >> :
Zdravstvyjte, vopros k znatokam. Est lu fynktsuya v mql4 kotoraya proveryala bu ne zanyat lu torgovuj potok ( ochered na otsulky ordersov ) v termunale, a to ya proveryayu cherz globalnue peremennue v kotorue zanoshy danue ne zanyat lu potok. Zaranee spasubo.

IsTradeContextBusy()

Here are the status check functions. https://docs.mql4.com/ru/check

PS I am not an expert. :(

 

To goldtrader : spasubo.


U eshche vopros :


Pru testurovanuu, razresheno tester zaburat sovetnuky dannue uz kakovo nubyd fajla?, (hochy proverut na profutnost odny multuvalyutnyu strateguyu)


Zaranee spasubo.

 
AndBar писал(а) >>

To goldtrader : spasubo.

U eshche vopros :

Pru testurovanuu, razresheno tester zaburat sovetnuky dannue uz kakovo nubyd fajla?, (hochy proverut na profutnost odny multuvalyutnyu strateguyu)

Zaranee spasubo.

Expert Advisor can refer directly to other instruments and timeframes. You do not have to use a file. But it may be done with the help of this file.

 
Vinin >> :

The EA can refer directly to other instruments and timeframes. You do not have to use a file. Although, we may do everything through it (the file).

Bolshoe spasubo, poprobyem chto uz etogo polychutsya.

 

Help ind. doesn't draw SMA!!!

//+------------------------------------------------------------------+
//|                                                maalert  sma.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Red

extern int PeriodMA= 55;
extern int METHOD_MA=MODE_SMA;
extern int X= 1;
extern int Limit=5440;
extern string    SoundFileName="alert.wav";
extern bool      ActiveSignal=true;
extern bool      ActiveAlert=true;

double maH;
double maL;
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0, maH);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1, maL);
   SetIndexLabel(0,"MA");
//----
   return(0);
  }
//+------------------------------------------------------------------+
int start()
  {
//--------------------------------------------------------------
   maL         = iMA(Symbol(), Period( ) , PeriodMA* X, 0, METHOD_MA, PRICE_LOW,  0);
   maH         = iMA(Symbol(), Period( ) , PeriodMA* X, 0, METHOD_MA, PRICE_HIGH, 0);
 //--------------------------------------------------------------
  if(Bid> maH)
   {
   Alert("eu Buy" );
   if( SoundFileName!="" )
         PlaySound( SoundFileName );} // Звуковой сигнал}
   //----
   
   
   if(Bid< maL)
   {
   Alert("eu Buy" );
   if( SoundFileName!="" )
         PlaySound( SoundFileName );} // Звуковой сигнал}
   //----
   return(0);
  }
//+------------------------------------------------------------------+
what's missing? Thanks.
 
costy_ писал(а) >>

Help ind. doesn't draw SMA!!!

what did you miss? >> thank you.

And you haven't done anything to make it draw.

 
Roger >> :

And you haven't done anything to make it draw.

So what exactly...

SetIndexDrawBegin(0,0);
,,,
 
costy_ >> :

Help ind. does not draw SMA!!!

what did you miss? >>Thank you.

Posmotru kak zanosyatsya danue v byfer dlya rusovanuya lunuu v bydj kakom prostom unduke, u vse voprosu otpadyt


Dlya prumera:


double ExtMapBuffer1[];
double ExtMapBuffer2[];
-------------------- 


ExtMapBuffer1[i]
  = iMA(Symbol(), Period( ) , PeriodMA* X, 0, METHOD_MA, PRICE_LOW,  0);
ExtMapBuffer2[i]
 = iMA(Symbol(), Period( ) , PeriodMA* X, 0, METHOD_MA, PRICE_HIGH, 0);

ny u eto vse delo oformu v tsukl

 
AndBar >> :

Posmotru kak zanosyatsya danue v byfer dlya rusovanuya lunuu v bydj kakom prostom unduke, u vse voprosu otpadyt


Dlya prumera:


>> thank you!

//+------------------------------------------------------------------+
//|                                                maalert  sma.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Red

extern int PeriodMA= 55;
extern int METHOD_MA=MODE_SMA;
extern int X= 1;
extern int Limit=5440;
extern string    SoundFileName="alert.wav";
extern bool      ActiveSignal=true;
extern bool      ActiveAlert=true;

double maH[];
double maL[];
int i;
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0, maH[ i]);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1, maL[ i ]);
   SetIndexLabel(0,"MA");
//----
   return(0);
  }
//+------------------------------------------------------------------+
int start()
  {
//--------------------------------------------------------------
   maL[ i]         = iMA(Symbol(), Period( ) , PeriodMA* X, 0, METHOD_MA, PRICE_LOW,  0);
   maH[ i]         = iMA(Symbol(), Period( ) , PeriodMA* X, 0, METHOD_MA, PRICE_HIGH, 0);
 //--------------------------------------------------------------
  if(Bid> maH[ i])
   {
   Alert("eu Buy" );
   if( SoundFileName!="" )
         PlaySound( SoundFileName );} // Звуковой сигнал}
   //----
   
   
   if(Bid< maL[ i])
   {
   Alert("eu Buy" );
   if( SoundFileName!="" )
         PlaySound( SoundFileName );} // Звуковой сигнал}
   //----
   return(0);
  }
//+------------------------------------------------------------------+

I think it should be, but it isn't :(
 

How to correctly program an exit at a reverse crossing of the main and signal lines? because signals come in short intervals of time... and orders are not closed where they should in the condition...

this question has been bugging me for a long time! PLEASE!

Here is the exit condition:

main_1=iCustom(NULL, 0, "i_Trend", 0, 0); // главная линия на 0м баре
main_2=iCustom(NULL, 0, "i_Trend", 0, 1); // главная линия на 1м баре
signal_1=iCustom(NULL, 0, "i_Trend", 1, 0); // сигнальная линия на 0м баре
signal_2=iCustom(NULL, 0, "i_Trend", 1, 1); // сигнальная линия на 1м баре
//----
   for(int i=0; i<OrdersTotal(); i++)
     {
      if(OrderSelect( i, SELECT_BY_POS, MODE_TRADES)==false)        break;
      if(OrderMagicNumber()!= MAGICMA || OrderSymbol()!=Symbol()) continue;
      //---- check order type 
      if(OrderType()==OP_BUY)
        {
         if( main_1< signal_1 && !( main_2< signal_2)) OrderClose(OrderTicket(),OrderLots(),Bid,3,White);
         break;
        }
      if(OrderType()==OP_SELL)
        {
         if( main_1> signal_1 && !( main_2> signal_2)) OrderClose(OrderTicket(),OrderLots(),Ask,3,White);
         break;
        }
Reason: