[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 491

 
rasvet >>:

вот скрипт. присоединяешь к любому графику-он закрывает все открытые ордера.

To close orders, I use the JimsCloseOrders Expert Advisor which can close any order at will - either profit or loss ones, or all of them, although I have to correct it a little - here are two lines of code

extern bool CloseOpenOrders = true;

extern bool CloseOrdersWithPlusProfit = false;

false and true should be interchanged, otherwise, if this setting is done when installing on a chart, it somehow starts to close all orders (probably due to sequence of commands executed by the program, but I'm not sure, I'm not qualified).

Ihave a question for a pro.

I want to run, for example, the Expert Advisor I mentioned above as soon as possible. However, all Expert Advisors and scripts start working as soon as the first tick has been received on the chart. If the currency pair selected for installation of the Expert Advisor turned out not to be very "active" at that moment, the losses can be significant.

Is there an opportunity to create a "common" chart for all currencies or to use the incoming ticks of any other pair? Ticks are received in the terminal almost continuously. Where can they be intercepted?

 
hedger писал(а) >>

I have a question for the pros.

I want to run, for example, the Expert Advisor I mentioned above as soon as possible, but all Expert Advisors and scripts start working as soon as the first tick is received on the chart. If the currency pair selected for installation of the Expert Advisor turned out not to be very "active" at that moment, the losses can be significant.

Is there an opportunity to create a "common" chart for all currencies, or to use the incoming ticks of any other pair? Ticks are received in the terminal almost continuously. Where can I intercept them?


It is sufficient to loop the Expert Advisor. Then it will not work by ticks, but with a certain time delay (set by the user). For multicurrency options (IMHO) the best solution.

 
Vinin >>:


Достаточно зациклить эксперта. Тогда он будет работать не по тикам, а с определенной временной задержкой (задаваемой пользователем). Для мультивалютных вариантов (ИМХО) лучшее решение.

Obviously, it's not that complicated, but unfortunately, "we haven't been through that" and I can't do it yet. But it would be nice to see how an EA would behave with such a refinement. Thank you.

 
There is an indicator using this formula (V - volume, high-low - max. and min. candles)
V
___________ =
high-low

If not, may someone sketch a histogram in a separate window?
 
There is an indicator using this formula (V - volume, high-low - max. and min. candles)
V
___________ =
high-low

If not, may someone sketch a histogram in a separate window?
 
hedger >>:

Требуется, как можно быстрее запустить, например, советника, о котором шла речь выше, но все советники и скрипты начинают действовать с момента поступления первого тика на график. Если же выбранная для установки советника валютная пара оказалась не очень "активной" в этот момент, то потери могут быть значительными.

Существует ли возможность создания "общего" графика для всех валют, или воспользоваться поступающим тикам любой другой пары? Тики же в терминал поступают почти непрерывно. Где их можно перехватить?

You can do a hot start in

init(){

while (true) {

//Eternal high.

}

 
//+------------------------------------------------------------------+
//|                                 BW Market Facilitation Index.mq4 |
//|                                           объединенный с Volumes |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//|                             Доработка AlexSilver http://viac.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"
//---- indicator settings
#property  indicator_separate_window
#property indicator_minimum 0
#property indicator_buffers 5
#property indicator_color1 Black
#property indicator_color2 Green // Зеленая свеча
#property indicator_color3 Blue // Угасающая
#property indicator_color4 Gold // Фальшивая
#property indicator_color5 Red // приседающая 
//---- indicator buffers
extern int Period_MFI =   14;
double dMFIBuffer[];
double dMFIUpVUpBuffer[]; // Зеленая 
double dMFIDownVDownBuffer[]; // Угасающая
double dMFIUpVDownBuffer[]; // Фальшивая
double dMFIDownVUpBuffer[]; // приседающая 

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  
//---- indicator buffers mapping
   SetIndexBuffer(0,dMFIBuffer);       
   SetIndexBuffer(1,dMFIUpVUpBuffer);
   SetIndexBuffer(2,dMFIDownVDownBuffer);
   SetIndexBuffer(3,dMFIUpVDownBuffer);
   SetIndexBuffer(4,dMFIDownVUpBuffer);
//---- drawing settings
   SetIndexStyle(0,DRAW_NONE);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexStyle(3,DRAW_HISTOGRAM);
   SetIndexStyle(4,DRAW_HISTOGRAM);   

//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("BW MFI + Volumes");
   SetIndexLabel(0,"BW MFI");      
   SetIndexLabel(1,"Зелёный");
   SetIndexLabel(2,"Угасающий");
   SetIndexLabel(3,"Фальшивый");
   SetIndexLabel(4,"Приседающий");

//---- sets drawing line empty value
   SetIndexEmptyValue(1, 0.0);
   SetIndexEmptyValue(2, 0.0);       
   SetIndexEmptyValue(3, 0.0);
   SetIndexEmptyValue(4, 0.0);      
   
   IndicatorDigits(0);   
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| BW Market Facilitation Index                                     |
//+------------------------------------------------------------------+
int start()
  {
   int    i,nLimit,nCountedBars;
//---- bars count that does not changed after last indicator launch.
   nCountedBars=IndicatorCounted();
//---- last counted bar will be recounted
   if(nCountedBars>0) nCountedBars--;
   nLimit=Bars-nCountedBars;
//---- Market Facilitation Index calculation
   for(i=0; i<nLimit; i++)
     if(i==0 && Volume[i]<Period()*1.5)
        dMFIBuffer[i]=0.0;
     else   
        dMFIBuffer[i]=(High[i]-Low[i])/(Volume[i]*Point);
//---- dispatch values between 4 buffers   
   for(i=nLimit-1; i>=0; i--)
    {
     if((i!=nLimit-1&&bCompareDouble(dMFIBuffer[i],dMFIBuffer[i+1])&&dMFIBuffer[i]>dMFIBuffer[i+2]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)>Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1))||
        (i!=nLimit-1&&dMFIBuffer[i]>dMFIBuffer[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1)&&Volume[i]/iMFI(NULL,0,Period_MFI,i)>Volume[i+2])/iMFI(NULL,0,Period_MFI,i+2)||
        (i<nLimit-2&&dMFIBuffer[i]>dMFIBuffer[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1)&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+2]/iMFI(NULL,0,Period_MFI,i+2)&&Volume[i]/iMFI(NULL,0,Period_MFI,i)>Volume[i+3]/iMFI(NULL,0,Period_MFI,i+3))||        
        (i!=nLimit-1&&bCompareDouble(dMFIBuffer[i],dMFIBuffer[i+1])&&dMFIBuffer[i]>dMFIBuffer[i+2]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1)&&Volume[i]/iMFI(NULL,0,Period_MFI,i)>Volume[i+2]/iMFI(NULL,0,Period_MFI,i+2))||
        (dMFIBuffer[i]>dMFIBuffer[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)>Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1))) 
       {
        dMFIUpVUpBuffer[i]=Volume[i]/iMFI(NULL,0,Period_MFI,i);
        dMFIDownVDownBuffer[i]=0.0;
        dMFIUpVDownBuffer[i]=0.0;
        dMFIDownVUpBuffer[i]=0.0;
        continue;
       }
     if((i!=nLimit-1&&bCompareDouble(dMFIBuffer[i],dMFIBuffer[i+1])&&dMFIBuffer[i]<dMFIBuffer[i+2]&&Volume[i]<Volume[i+1])||
        (i!=nLimit-1&&dMFIBuffer[i]<dMFIBuffer[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1)&&Volume[i]/iMFI(NULL,0,Period_MFI,i)<Volume[i+2]/iMFI(NULL,0,Period_MFI,i+2))||
        (i<nLimit-2&&dMFIBuffer[i]<dMFIBuffer[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+2]/iMFI(NULL,0,Period_MFI,i+2)&&Volume[i]<Volume[i+3]/iMFI(NULL,0,Period_MFI,i+3))||        
        (i!=nLimit-1&&bCompareDouble(dMFIBuffer[i],dMFIBuffer[i+1])&&dMFIBuffer[i]<dMFIBuffer[i+2]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1)&&Volume[i]/iMFI(NULL,0,Period_MFI,i)<Volume[i+2]/iMFI(NULL,0,Period_MFI,i+2))||        
        (dMFIBuffer[i]<dMFIBuffer[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)<Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1))) 
       {
        dMFIUpVUpBuffer[i]=0.0;
        dMFIDownVDownBuffer[i]=Volume[i]/iMFI(NULL,0,Period_MFI,i);
        dMFIUpVDownBuffer[i]=0.0;
        dMFIDownVUpBuffer[i]=0.0;
        continue;         
       }
     if((i!=nLimit-1&&bCompareDouble(dMFIBuffer[i],dMFIBuffer[i+1])&&dMFIBuffer[i]>dMFIBuffer[i+2]&&Volume[i]/iMFI(NULL,0,Period_MFI,i+1)<Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1))||
        (i!=nLimit-1&&dMFIBuffer[i]>dMFIBuffer[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1)&&Volume[i]/iMFI(NULL,0,Period_MFI,i)<Volume[i+2]/iMFI(NULL,0,Period_MFI,i+2))||
        (i<nLimit-2&&dMFIBuffer[i]>dMFIBuffer[i+1]&&Volume[i]==Volume[i+1]&&Volume[i]==Volume[i+2]&&Volume[i]<Volume[i+3])||        
        (i!=nLimit-1&&bCompareDouble(dMFIBuffer[i],dMFIBuffer[i+1])&&dMFIBuffer[i]>dMFIBuffer[i+2]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1)&&Volume[i]/iMFI(NULL,0,Period_MFI,i)<Volume[i+2]/iMFI(NULL,0,Period_MFI,i+2))||        
        (dMFIBuffer[i]>dMFIBuffer[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)<Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1))) 
       {
        dMFIUpVUpBuffer[i]=0.0;
        dMFIDownVDownBuffer[i]=0.0;
        dMFIUpVDownBuffer[i]=Volume[i]/iMFI(NULL,0,Period_MFI,i);
        dMFIDownVUpBuffer[i]=0.0;
        continue;         
       }
     if((i!=nLimit-1&&bCompareDouble(dMFIBuffer[i],dMFIBuffer[i+1])&&dMFIBuffer[i]<dMFIBuffer[i+2]&&Volume[i]>Volume[i+1])||
        (i!=nLimit-1&&dMFIBuffer[i]<dMFIBuffer[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1)&&Volume[i]/iMFI(NULL,0,Period_MFI,i)>Volume[i+2]/iMFI(NULL,0,Period_MFI,i+2))||
        (i<nLimit-2&&dMFIBuffer[i]<dMFIBuffer[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i+1)==Volume[i+2]/iMFI(NULL,0,Period_MFI,i+2)/iMFI(NULL,0,Period_MFI,i+2)&&Volume[i]/iMFI(NULL,0,Period_MFI,i)>Volume[i+3]/iMFI(NULL,0,Period_MFI,i+3))||        
        (i!=nLimit-1&&bCompareDouble(dMFIBuffer[i],dMFIBuffer[i+1])&&dMFIBuffer[i]<dMFIBuffer[i+2]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)==Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1)&&Volume[i]/iMFI(NULL,0,Period_MFI,i)>Volume[i+2]/iMFI(NULL,0,Period_MFI,i+2))||        
        (dMFIBuffer[i]<dMFIBuffer[i+1]&&Volume[i]/iMFI(NULL,0,Period_MFI,i)>Volume[i+1]/iMFI(NULL,0,Period_MFI,i+1))) 
       {
        dMFIUpVUpBuffer[i]=0.0;
        dMFIDownVDownBuffer[i]=0.0;
        dMFIUpVDownBuffer[i]=0.0;
        dMFIDownVUpBuffer[i]=Volume[i]/iMFI(NULL,0,Period_MFI,i);
        continue;         
       }        
    }                     
//---- done
   return(0);
  }
//+------------------------------------------------------------------+
 bool bCompareDouble (double dNumber1, double dNumber2)
    {
     bool bCompare=NormalizeDouble(dNumber1 - dNumber2,8) == 0;
     return(bCompare);
    }
 

 
Somehow I made a tutorial script to open a position -

int start()
{
int ticket;
if(iRSI(NULL,0,5,PRICE_CLOSE,0)<10)
{
ticket=OrderSend(Symbol(),OP_BUY,1,Ask,0,Bid-10*Point,Ask+10*Point);
if(ticket<0)
{
Print("OrderSend failed with error #",GetLastError());
return(0);
}
}
return(0);

I attach it to a currency pair - no effect. Will there be one or is there something wrong here? Please explain.
 

So what error does it say?

 
OrderSend(Symbol(),OP_BUY,1,Ask,0/*instead of zero, put any allowable slippage*/,Bid-10*Point,Ask+10*Point);
Reason: