[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 239

 
Vinin:

You need the full code of the indicator.

Above post corrected under. No (empty) criteria for passing one MA through another and vice versa.

The very fact that if one buffer - no questions, but the same through the 2nd, 3rd or 4th, it does not work.

 
w_ersoc:

Thanks. I've seen that. But there -

I do not need it near the market but near a specific price.

Example: The market is at 1.3262 and I need to know within 5 pips of 1.1111


What prevents you from changing MODE_ASK here to 1.1111 for a buy order, say? The function is ready - edit it.

if (ot==OP_BUY || ot==OP_BUYLIMIT || ot==OP_BUYSTOP) {
            if (MathAbs(MarketInfo(sy, MODE_ASK)-OrderOpenPrice())<ds*p) return(True);
          }
          if (ot==OP_SELL || ot==OP_SELLLIMIT || ot==OP_SELLSTOP) {
            if (MathAbs(OrderOpenPrice()-MarketInfo(sy, MODE_BID))<ds*p) return(True);
 
Roman.:

What prevents you from changing MODE_ASK here to 1.1111 for a buy order, say? The function is ready - edit it.


Thank you!
 
deyron:

Above a post under corrected. Nothing there (empty) criteria for passing one MA through another and vice versa.

The very fact that if one buffer - no questions, but the same through the 2nd, 3rd or 4th, it is not transmitted, or rather does not work.



If there is one buffer in the indicator, you should do it accordingly
 
costy_:
the indicators do not work with a slip, so as not to stop the trade flow!

That's the thing, the indicator only works with the slip and the "empty counter", it doesn't draw anything without them!!!!! It's amazing, amazing, incomprehensible, in the end it's just not normal, but I had to write the code!
//+------------------------------------------------------------------+
//|                                                   Синяячерта.mq4 |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 DarkBlue

double ВерхняячертаBuffer1[];
double НижняячертаBuffer2[];
double СинняячертаBuffer3[];
 double вершина; 
 double основание_первого_снижения;
 double начало;
 double вершина_волны_3;
 
 int timeframe, start ;
 int бар_вершина ;
 int бар_основание_первого_снижения;
 int бар_начало;
 
 double Pustostsetscyk;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
SetIndexStyle(0,DRAW_SECTION,STYLE_SOLID,2,CLR_NONE);//Alert ("SetIndexStyle ",GetLastError( ) );
  SetIndexBuffer(0,ВерхняячертаBuffer1);//Alert ("SetIndexBuffer ",GetLastError( ) );
   SetIndexEmptyValue(0,0.0);
   
   SetIndexStyle(1,DRAW_SECTION,STYLE_SOLID,2,CLR_NONE);//Alert ("SetIndexStyle ",GetLastError( ) );
  SetIndexBuffer(1,НижняячертаBuffer2);//Alert ("SetIndexBuffer ",GetLastError( ) ); 
   SetIndexEmptyValue(1,0.0);
   
   SetIndexStyle(2,DRAW_SECTION,STYLE_SOLID,2,CLR_NONE);//Alert ("SetIndexStyle ",GetLastError( ) );
  SetIndexBuffer(2,СинняячертаBuffer3);//Alert ("SetIndexBuffer ",GetLastError( ) ); 
   SetIndexEmptyValue(2,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   for (int i=0;i<100;i++){  СинняячертаBuffer3[i]= Open[i];}
          for (i=330;i<500;i++){  СинняячертаBuffer3[i]= Open[i];}
         for (i=0;i<500;i++){ Pustostsetscyk++;} Pustostsetscyk=0;
         Sleep(4000);
     i=Bars;
       бар_вершина=iHighest( NULL,  timeframe, MODE_HIGH, i, start ) ;
       вершина =High[ бар_вершина ];
       бар_основание_первого_снижения=iLowest( NULL,  timeframe, MODE_LOW, бар_вершина, start ) ;
       основание_первого_снижения=Low[ бар_основание_первого_снижения ];
       бар_начало=iLowest( NULL,  timeframe, MODE_LOW, бар_вершина*2, бар_вершина ) ;
       начало=Low[ бар_начало ];
       Sleep(4000);
      //   Alert ( " бар_вершина   ",бар_вершина  , " вершина  " , вершина ,
      //    " бар_основание_первого_снижения  " ,бар_основание_первого_снижения  , " основание_первого_снижения  " , основание_первого_снижения , 
      //    " бар_начало  " , бар_начало   , " начало  " , начало    );
  
    НижняячертаBuffer2[бар_начало]=начало;
    НижняячертаBuffer2[бар_основание_первого_снижения]=основание_первого_снижения;
    for ( i=0;i<10;i++){  НижняячертаBuffer2[i]= Open[i];}
     Sleep(4000);     
    for (i=0;i<500;i++){ Pustostsetscyk++;}   Pustostsetscyk=0;   
//----
   return(0);
  }
//+------------------------------------------------------------------+
 

And the timeframe cannot be changed, everything disappears forever.

I had to add a line for (i=0;i<300;i++){ Alert ( Bottom lineBuffer2[i]); }, it doesn't draw without it!

And it really draws every once in a while! So I set the line thickness to 4, compiled it, and no!!!

I just put the indicator on the chart, it's not there. I wait two minutes, it's gone. Without removing it from the chart, I compile the same code again in the Metatrader editor.

 
Dimka-novitsek:

That's the thing, the indicator only works with slip and "empty counter", it doesn't draw anything without them!!!!! It's amazing, amazing, incomprehensible, in the end it's just not normal, but I had to write the code!


Start with this one.

//+------------------------------------------------------------------+
//|                                                   Синяячерта.mq4 |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 DarkBlue

double BufferUP[];
double BufferDN[];
double BufferBlue[];

 
 double Pustostsetscyk;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
SetIndexStyle(0,DRAW_LINE);//Alert ("SetIndexStyle ",GetLastError( ) );
  SetIndexBuffer(0,BufferUP);//Alert ("SetIndexBuffer ",GetLastError( ) );
   SetIndexEmptyValue(0,0.0);
   
   SetIndexStyle(1,DRAW_LINE);//Alert ("SetIndexStyle ",GetLastError( ) );
  SetIndexBuffer(1,BufferDN);//Alert ("SetIndexBuffer ",GetLastError( ) ); 
   SetIndexEmptyValue(1,0.0);
   
   SetIndexStyle(2,DRAW_LINE);//Alert ("SetIndexStyle ",GetLastError( ) );
  SetIndexBuffer(2,BufferBlue);//Alert ("SetIndexBuffer ",GetLastError( ) ); 
   SetIndexEmptyValue(2,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   int limit=Bars-counted_bars-1;

   for (int i=limit;i>=0;i--) {
      BufferBlue[i]  = Open[i];
      BufferUP[i]    = High[i];
      BufferDN[i]    = Low[i];
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+
 

Thanks!!!!!!

Great!!!

 
Dimka-novitsek:
Thank you!!!!!!

Slightly corrected the previous post
 
You know, when you change timeframe it also disappears, and permanently, no longer shows on any timeframe. Well, I'll try to do something useful for a start. I guess my computer is wiping out or something.
Reason: