Download MetaTrader 5
To add comments, please log in or register
Interested in social trading? Read the article!
ttechnik
256
ttechnik 2014.03.05 08:13 

I see 2 lines, but not filling.


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

#include <stdlib.mqh>


#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   1

   
#property indicator_color1 clrYellow, clrOrange
#property indicator_width1 3
#property indicator_type1 DRAW_FILLING


//---- indicator buffers
double ExtMapBufferHigh[];
double ExtMapBufferLow[];

bool Flag;

double MinSp, MaxSp;
int PrevTime;
string FileName;
int error;

//----
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   
   //SetIndexLabel(0, "Sell SL"); 
   //SetIndexLabel(1, "Buy SL "); 
   
   Flag = RealSymbol(Symbol());
   FileName = Symbol() + Period() + "_Ask.dat";

   IndicatorShortName("AskRange");
   
//---- indicator buffers mapping
   
   SetIndexBuffer(0,ExtMapBufferLow,INDICATOR_DATA);
   SetIndexBuffer(1,ExtMapBufferHigh,INDICATOR_DATA);
   ChartSetInteger(0,CHART_FOREGROUND,0,1);

   PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_FILLING); // graphical construction type
   PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID); // drawing line style
   PlotIndexSetInteger(0,PLOT_LINE_WIDTH,1);           // drawing line width
     
   return(0);
  }
  
void deinit()
{
  if (Flag) WriteSpread();
  return;
}


void start()  
{       
  static bool FirstRun = TRUE;
  
  if (!Flag)
   {
    GetData();
    return;
   }
  
  if (FirstRun)
   {
    MaxSp=Ask;
    MinSp=Ask;
    GetData();
    FirstRun = FALSE;
    return;
   }

  if (PrevTime == Time[0])
   {
    if (Ask<MinSp) MinSp = Ask;
    if (Ask>MaxSp) MaxSp = Ask;
   }
  else
   {
    WriteSpread();
    MinSp = Ask;
    MaxSp = Ask;
    PrevTime = Time[0];
   }
    
  ExtMapBufferHigh[0] = MaxSp;
  ExtMapBufferLow[0] = MinSp;

  error=GetLastError();
  if (error!=0 && error!=4099) Alert(" IND GetData: Hiba:(",Symbol(),"  ",error,"): ",ErrorDescription(error));
  return;  
}


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void GetData()
{
  double Min, Max;
  int T, i;
  int handle = FileOpen(FileName, FILE_BIN|FILE_READ);
  
  if (handle < 0)
    return;

  while (!FileIsEnding(handle))
  {
    T = FileReadInteger(handle);     
    Max = FileReadDouble(handle);
    Min = FileReadDouble(handle);
      
    i = iBarShift(Symbol(), Period(), T, TRUE);
    
    if (i >= 0)
    {
      ExtMapBufferHigh[i] = Max;
      ExtMapBufferLow[i] = Min;
    }
  }
  FileClose(handle);
  return; 
}


bool RealSymbol( string Str )
{
  return(MarketInfo(Str, MODE_BID) != 0);
}


void WriteSpread()
{
  int handle = FileOpen(FileName, FILE_BIN|FILE_READ|FILE_WRITE);
  
  
  FileSeek(handle, 0, SEEK_END);
  FileWriteInteger(handle, PrevTime);
  FileWriteDouble(handle, MaxSp);
  FileWriteDouble(handle, MinSp);
  
  FileClose(handle);

  return;  
}



Alain Verleyen
Moderator
30639
Alain Verleyen 2014.03.05 11:32  
ttechnik:

I see 2 lines, but not filling.


I got this error while trying your code :

2014.03.05 12:30:38.141 DrawFilling EURUSD,H1 CExpertExecutor::PlotIndexSetInteger is not implemented

whroeder1
14457
whroeder1 2014.03.05 13:04  
PlotIndexSetInteger isn't in the mt4 docs.
ttechnik
256
ttechnik 2014.03.05 13:36  
WHRoeder:
PlotIndexSetInteger isn't in the mt4 docs.

Yes.


But, DRAW_FILLING is.


I dont find how to do this

Keith Watford
Moderator
9597
Keith Watford 2014.03.05 13:52  
ttechnik:

Yes.


But, DRAW_FILLING is.


I dont find how to do this



The documentation is total crap as always

All I can find is that it need 2 buffer labels separated with ";"

An example in the documentation could be so useful

graziani
1953
graziani 2014.03.05 14:11  

DRAW_FILLING is not working in <= b614.

Actually, i haven't found ANY NEW FEATURE to be working (from the ones i tried out).

So, there is really no sense in trying this things out before, lets say, build 700.

This behaviour is really totally non-professional from MQ.

So it would be really nice if someone finds a NEW FEATURE THAT IS WORKING, to report it in some thread, as MQ is obviously not going to do it.

qjol
3243
qjol 2014.03.05 23:57  
ttechnik:

But, DRAW_FILLING is.

apparently not
Simon Gniadkowski
Moderator
17998
Simon Gniadkowski 2014.03.06 09:15  
qjol:
apparently not
Actually it is, DRAW_FILLING
qjol
3243
qjol 2014.03.06 09:49  
RaptorUK:
Actually it is, DRAW_FILLING


have u tried ?
Simon Gniadkowski
Moderator
17998
Simon Gniadkowski 2014.03.06 09:57  
qjol:

have u tried ?

Tried to use it or tried to read the documentation ? I haven't tried to use it, but that wasn't the context of what you posted . . .

WHRoeder:
PlotIndexSetInteger isn't in the mt4 docs.
ttechnik:

Yes.

But, DRAW_FILLING is.

I dont find how to do this

qjol:
apparently not

As you can see, it is in the Documentation.
qjol
3243
qjol 2014.03.06 10:12  
RaptorUK:

As you can see, it is in the Documentation.

so what? we both know that the Documentation is just a copy from MT5

/ /12
To add comments, please log in or register