Download MetaTrader 5

Indicators Optimized for Offline Charts - page 7

To add comments, please log in or register
Mladen Rakic
72037
Mladen Rakic  
thefxpros:
Hi,

please, i beg some good hearted programmer...it is possible to have these two indicators optimized for offline charts? I can't work anymore with metatrader in this way...it freezes all the time, the price moves and metatrader not...

bbands_stop_v3_mtf.mq4

custom_candles.mq4

thanks in advance to pious soul that will help me...:)

thfxpros

did you check this version of bb stops : https://www.mql5.com/en/forum/173574/page538

Fausto Nunziante Del Gaudio
6156
Fausto Nunziante Del Gaudio  
mladen:
thfxpros did you check this version of bb stops : https://www.mql5.com/en/forum/173574/page538

Yes, but is it different from the mine, my bbands stop has one more option. However, i guess and hope that i don't need the offline chart optimization anymore for this indicator since i saw that with restoring the default indicators position, now the platform with indicators attached is much much more speedy...

thank you anyway for the advice

Fausto Nunziante Del Gaudio
6156
Fausto Nunziante Del Gaudio  

This was the old heiken ashi code

//+------------------------------------------------------------------+

//| Heiken Ashi.mq4 |

//| Copyright c 2004, MetaQuotes Software Corp. |

//| http://www.metaquotes.net |

//+------------------------------------------------------------------+

//| For Heiken Ashi we recommend next chart settings ( press F8 or |

//| select on menu 'Charts'->'Properties...'): |

//| - On 'Color' Tab select 'Black' for 'Line Graph' |

//| - On 'Common' Tab disable 'Chart on Foreground' checkbox and |

//| select 'Line Chart' radiobutton |

//+------------------------------------------------------------------+

#property copyright "Copyright © 2004, MetaQuotes Software Corp."

#property link "http://www.metaquotes.net"

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1 Brown

#property indicator_color2 DarkBlue

#property indicator_color3 OrangeRed

#property indicator_color4 SteelBlue

#property indicator_width1 1

#property indicator_width2 1

#property indicator_width3 2

#property indicator_width4 2

//----

extern color SellWickColor = Brown;

extern color BuyWickColor = DarkBlue;

extern color SellBodyColor = OrangeRed;

extern color BuyBodyColor = SteelBlue;

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

double ExtMapBuffer3[];

double ExtMapBuffer4[];

//----

int ExtCountedBars=0;

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//|------------------------------------------------------------------|

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, SellWickColor);

SetIndexBuffer(0, ExtMapBuffer1);

SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, BuyWickColor);

SetIndexBuffer(1, ExtMapBuffer2);

SetIndexStyle(2,DRAW_HISTOGRAM, 0, 2, SellBodyColor);

SetIndexBuffer(2, ExtMapBuffer3);

SetIndexStyle(3,DRAW_HISTOGRAM, 0, 2, BuyBodyColor);

SetIndexBuffer(3, ExtMapBuffer4);

//----

SetIndexDrawBegin(0,10);

SetIndexDrawBegin(1,10);

SetIndexDrawBegin(2,10);

SetIndexDrawBegin(3,10);

//---- indicator buffers mapping

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexBuffer(2,ExtMapBuffer3);

SetIndexBuffer(3,ExtMapBuffer4);

//---- initialization done

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//---- TODO: add your code here

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

double haOpen, haHigh, haLow, haClose;

if(Bars<=10) return(0);

ExtCountedBars=IndicatorCounted();

//---- check for possible errors

if (ExtCountedBars<0) return(-1);

//---- last counted bar will be recounted

if (ExtCountedBars>0) ExtCountedBars--;

int pos=Bars-ExtCountedBars-1;

while(pos>=0)

{

haOpen=(ExtMapBuffer3[pos+1]+ExtMapBuffer4[pos+1])/2;

haClose=(Open[pos]+High[pos]+Low[pos]+Close[pos])/4;

haHigh=MathMax(High[pos], MathMax(haOpen, haClose));

haLow=MathMin(Low[pos], MathMin(haOpen, haClose));

if (haOpen<haClose)

{

ExtMapBuffer1[pos]=haLow;

ExtMapBuffer2[pos]=haHigh;

}

else

{

ExtMapBuffer1[pos]=haHigh;

ExtMapBuffer2[pos]=haLow;

}

ExtMapBuffer3[pos]=haOpen;

ExtMapBuffer4[pos]=haClose;

pos--;

}

//----

return(0);

}

//+------------------------------------------------------------------+[/CODE]

and this is the new heiken ashi code

[CODE]//+------------------------------------------------------------------+

//| Heiken Ashi.mq4 |

//| Copyright 2006-2014, MetaQuotes Software Corp. |

//| http://www.mql4.com |

//+------------------------------------------------------------------+

#property copyright "2006-2014, MetaQuotes Software Corp."

#property link "http://www.mql4.com"

#property description "We recommend next chart settings (press F8 or select menu 'Charts'->'Properties...'):"

#property description " - on 'Color' Tab select 'Black' for 'Line Graph'"

#property description " - on 'Common' Tab disable 'Chart on Foreground' checkbox and select 'Line Chart' radiobutton"

#property strict

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1 Brown

#property indicator_color2 DarkBlue

#property indicator_color3 OrangeRed

#property indicator_color4 SteelBlue

#property indicator_width1 1

#property indicator_width2 1

#property indicator_width3 2

#property indicator_width4 2

//---

input color ExtColor1 = Brown; // Shadow of bear candlestick

input color ExtColor2 = DarkBlue; // Shadow of bull candlestick

input color ExtColor3 = OrangeRed; // Bear candlestick body

input color ExtColor4 = SteelBlue; // Bull candlestick body

//--- buffers

double ExtLowHighBuffer[];

double ExtHighLowBuffer[];

double ExtOpenBuffer[];

double ExtCloseBuffer[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//|------------------------------------------------------------------|

void OnInit(void)

{

IndicatorShortName("Heiken ashi");

IndicatorDigits(Digits);

//--- indicator lines

SetIndexStyle(0,DRAW_HISTOGRAM,0,1,ExtColor1);

SetIndexBuffer(0,ExtLowHighBuffer);

SetIndexStyle(1,DRAW_HISTOGRAM,0,1,ExtColor2);

SetIndexBuffer(1,ExtHighLowBuffer);

SetIndexStyle(2,DRAW_HISTOGRAM,0,3,ExtColor3);

SetIndexBuffer(2,ExtOpenBuffer);

SetIndexStyle(3,DRAW_HISTOGRAM,0,3,ExtColor4);

SetIndexBuffer(3,ExtCloseBuffer);

//---

SetIndexLabel(0,"Low/High");

SetIndexLabel(1,"High/Low");

SetIndexLabel(2,"Open");

SetIndexLabel(3,"Close");

SetIndexDrawBegin(0,10);

SetIndexDrawBegin(1,10);

SetIndexDrawBegin(2,10);

SetIndexDrawBegin(3,10);

//--- indicator buffers mapping

SetIndexBuffer(0,ExtLowHighBuffer);

SetIndexBuffer(1,ExtHighLowBuffer);

SetIndexBuffer(2,ExtOpenBuffer);

SetIndexBuffer(3,ExtCloseBuffer);

//--- initialization done

}

//+------------------------------------------------------------------+

//| Heiken Ashi |

//+------------------------------------------------------------------+

int OnCalculate(const int rates_total,

const int prev_calculated,

const datetime &time[],

const double &open[],

const double &high[],

const double &low[],

const double &close[],

const long &tick_volume[],

const long &volume[],

const int &spread[])

{

int i,pos;

double haOpen,haHigh,haLow,haClose;

//---

if(rates_total<=10)

return(0);

//--- counting from 0 to rates_total

ArraySetAsSeries(ExtLowHighBuffer,false);

ArraySetAsSeries(ExtHighLowBuffer,false);

ArraySetAsSeries(ExtOpenBuffer,false);

ArraySetAsSeries(ExtCloseBuffer,false);

ArraySetAsSeries(open,false);

ArraySetAsSeries(high,false);

ArraySetAsSeries(low,false);

ArraySetAsSeries(close,false);

//--- preliminary calculation

if(prev_calculated>1)

pos=prev_calculated-1;

else

{

//--- set first candle

if(open[0]<close[0])

{

ExtLowHighBuffer[0]=low[0];

ExtHighLowBuffer[0]=high[0];

}

else

{

ExtLowHighBuffer[0]=high[0];

ExtHighLowBuffer[0]=low[0];

}

ExtOpenBuffer[0]=open[0];

ExtCloseBuffer[0]=close[0];

//---

pos=1;

}

//--- main loop of calculations

for(i=pos; i<rates_total; i++)

{

haOpen=(ExtOpenBuffer+ExtCloseBuffer)/2;

haClose=(open+high+low+close)/4;

haHigh=MathMax(high,MathMax(haOpen,haClose));

haLow=MathMin(low,MathMin(haOpen,haClose));

if(haOpen<haClose)

{

ExtLowHighBuffer=haLow;

ExtHighLowBuffer=haHigh;

}

else

{

ExtLowHighBuffer=haHigh;

ExtHighLowBuffer=haLow;

}

ExtOpenBuffer=haOpen;

ExtCloseBuffer=haClose;

}

//--- done

return(rates_total);

}

//+------------------------------------------------------------------+

Mladen Rakic
72037
Mladen Rakic  
thefxpros:
This was the old heiken ashi code
//+------------------------------------------------------------------+

//| Heiken Ashi.mq4 |

//| Copyright c 2004, MetaQuotes Software Corp. |

//| http://www.metaquotes.net |

//+------------------------------------------------------------------+

//| For Heiken Ashi we recommend next chart settings ( press F8 or |

//| select on menu 'Charts'->'Properties...'): |

//| - On 'Color' Tab select 'Black' for 'Line Graph' |

//| - On 'Common' Tab disable 'Chart on Foreground' checkbox and |

//| select 'Line Chart' radiobutton |

//+------------------------------------------------------------------+

#property copyright "Copyright © 2004, MetaQuotes Software Corp."

#property link "http://www.metaquotes.net"

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1 Brown

#property indicator_color2 DarkBlue

#property indicator_color3 OrangeRed

#property indicator_color4 SteelBlue

#property indicator_width1 1

#property indicator_width2 1

#property indicator_width3 2

#property indicator_width4 2

//----

extern color SellWickColor = Brown;

extern color BuyWickColor = DarkBlue;

extern color SellBodyColor = OrangeRed;

extern color BuyBodyColor = SteelBlue;

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

double ExtMapBuffer3[];

double ExtMapBuffer4[];

//----

int ExtCountedBars=0;

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//|------------------------------------------------------------------|

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, SellWickColor);

SetIndexBuffer(0, ExtMapBuffer1);

SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, BuyWickColor);

SetIndexBuffer(1, ExtMapBuffer2);

SetIndexStyle(2,DRAW_HISTOGRAM, 0, 2, SellBodyColor);

SetIndexBuffer(2, ExtMapBuffer3);

SetIndexStyle(3,DRAW_HISTOGRAM, 0, 2, BuyBodyColor);

SetIndexBuffer(3, ExtMapBuffer4);

//----

SetIndexDrawBegin(0,10);

SetIndexDrawBegin(1,10);

SetIndexDrawBegin(2,10);

SetIndexDrawBegin(3,10);

//---- indicator buffers mapping

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexBuffer(2,ExtMapBuffer3);

SetIndexBuffer(3,ExtMapBuffer4);

//---- initialization done

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//---- TODO: add your code here

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

double haOpen, haHigh, haLow, haClose;

if(Bars<=10) return(0);

ExtCountedBars=IndicatorCounted();

//---- check for possible errors

if (ExtCountedBars<0) return(-1);

//---- last counted bar will be recounted

if (ExtCountedBars>0) ExtCountedBars--;

int pos=Bars-ExtCountedBars-1;

while(pos>=0)

{

haOpen=(ExtMapBuffer3[pos+1]+ExtMapBuffer4[pos+1])/2;

haClose=(Open[pos]+High[pos]+Low[pos]+Close[pos])/4;

haHigh=MathMax(High[pos], MathMax(haOpen, haClose));

haLow=MathMin(Low[pos], MathMin(haOpen, haClose));

if (haOpen<haClose)

{

ExtMapBuffer1[pos]=haLow;

ExtMapBuffer2[pos]=haHigh;

}

else

{

ExtMapBuffer1[pos]=haHigh;

ExtMapBuffer2[pos]=haLow;

}

ExtMapBuffer3[pos]=haOpen;

ExtMapBuffer4[pos]=haClose;

pos--;

}

//----

return(0);

}

//+------------------------------------------------------------------+[/CODE]

and this is the new heiken ashi code

[CODE]//+------------------------------------------------------------------+

//| Heiken Ashi.mq4 |

//| Copyright 2006-2014, MetaQuotes Software Corp. |

//| http://www.mql4.com |

//+------------------------------------------------------------------+

#property copyright "2006-2014, MetaQuotes Software Corp."

#property link "http://www.mql4.com"

#property description "We recommend next chart settings (press F8 or select menu 'Charts'->'Properties...'):"

#property description " - on 'Color' Tab select 'Black' for 'Line Graph'"

#property description " - on 'Common' Tab disable 'Chart on Foreground' checkbox and select 'Line Chart' radiobutton"

#property strict

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1 Brown

#property indicator_color2 DarkBlue

#property indicator_color3 OrangeRed

#property indicator_color4 SteelBlue

#property indicator_width1 1

#property indicator_width2 1

#property indicator_width3 2

#property indicator_width4 2

//---

input color ExtColor1 = Brown; // Shadow of bear candlestick

input color ExtColor2 = DarkBlue; // Shadow of bull candlestick

input color ExtColor3 = OrangeRed; // Bear candlestick body

input color ExtColor4 = SteelBlue; // Bull candlestick body

//--- buffers

double ExtLowHighBuffer[];

double ExtHighLowBuffer[];

double ExtOpenBuffer[];

double ExtCloseBuffer[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//|------------------------------------------------------------------|

void OnInit(void)

{

IndicatorShortName("Heiken ashi");

IndicatorDigits(Digits);

//--- indicator lines

SetIndexStyle(0,DRAW_HISTOGRAM,0,1,ExtColor1);

SetIndexBuffer(0,ExtLowHighBuffer);

SetIndexStyle(1,DRAW_HISTOGRAM,0,1,ExtColor2);

SetIndexBuffer(1,ExtHighLowBuffer);

SetIndexStyle(2,DRAW_HISTOGRAM,0,3,ExtColor3);

SetIndexBuffer(2,ExtOpenBuffer);

SetIndexStyle(3,DRAW_HISTOGRAM,0,3,ExtColor4);

SetIndexBuffer(3,ExtCloseBuffer);

//---

SetIndexLabel(0,"Low/High");

SetIndexLabel(1,"High/Low");

SetIndexLabel(2,"Open");

SetIndexLabel(3,"Close");

SetIndexDrawBegin(0,10);

SetIndexDrawBegin(1,10);

SetIndexDrawBegin(2,10);

SetIndexDrawBegin(3,10);

//--- indicator buffers mapping

SetIndexBuffer(0,ExtLowHighBuffer);

SetIndexBuffer(1,ExtHighLowBuffer);

SetIndexBuffer(2,ExtOpenBuffer);

SetIndexBuffer(3,ExtCloseBuffer);

//--- initialization done

}

//+------------------------------------------------------------------+

//| Heiken Ashi |

//+------------------------------------------------------------------+

int OnCalculate(const int rates_total,

const int prev_calculated,

const datetime &time[],

const double &open[],

const double &high[],

const double &low[],

const double &close[],

const long &tick_volume[],

const long &volume[],

const int &spread[])

{

int i,pos;

double haOpen,haHigh,haLow,haClose;

//---

if(rates_total<=10)

return(0);

//--- counting from 0 to rates_total

ArraySetAsSeries(ExtLowHighBuffer,false);

ArraySetAsSeries(ExtHighLowBuffer,false);

ArraySetAsSeries(ExtOpenBuffer,false);

ArraySetAsSeries(ExtCloseBuffer,false);

ArraySetAsSeries(open,false);

ArraySetAsSeries(high,false);

ArraySetAsSeries(low,false);

ArraySetAsSeries(close,false);

//--- preliminary calculation

if(prev_calculated>1)

pos=prev_calculated-1;

else

{

//--- set first candle

if(open[0]<close[0])

{

ExtLowHighBuffer[0]=low[0];

ExtHighLowBuffer[0]=high[0];

}

else

{

ExtLowHighBuffer[0]=high[0];

ExtHighLowBuffer[0]=low[0];

}

ExtOpenBuffer[0]=open[0];

ExtCloseBuffer[0]=close[0];

//---

pos=1;

}

//--- main loop of calculations

for(i=pos; i<rates_total; i++)

{

haOpen=(ExtOpenBuffer+ExtCloseBuffer)/2;

haClose=(open+high+low+close)/4;

haHigh=MathMax(high,MathMax(haOpen,haClose));

haLow=MathMin(low,MathMin(haOpen,haClose));

if(haOpen<haClose)

{

ExtLowHighBuffer=haLow;

ExtHighLowBuffer=haHigh;

}

else

{

ExtLowHighBuffer=haHigh;

ExtHighLowBuffer=haLow;

}

ExtOpenBuffer=haOpen;

ExtCloseBuffer=haClose;

}

//--- done

return(rates_total);

}

//+------------------------------------------------------------------+

The second one is the one written by metaquotes?

No wonder that new metatrader are not working as it should. That is one clumsy peace of code coded by someone that is confusing metatrader 4 and metatrader 5. They are continuing with their long term practice of having anything but clean and efficient code

Mladen Rakic
72037
Mladen Rakic  
thefxpros:
This was the old heiken ashi code
//+------------------------------------------------------------------+

//| Heiken Ashi.mq4 |

//| Copyright c 2004, MetaQuotes Software Corp. |

//| http://www.metaquotes.net |

//+------------------------------------------------------------------+

//| For Heiken Ashi we recommend next chart settings ( press F8 or |

//| select on menu 'Charts'->'Properties...'): |

//| - On 'Color' Tab select 'Black' for 'Line Graph' |

//| - On 'Common' Tab disable 'Chart on Foreground' checkbox and |

//| select 'Line Chart' radiobutton |

//+------------------------------------------------------------------+

#property copyright "Copyright © 2004, MetaQuotes Software Corp."

#property link "http://www.metaquotes.net"

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1 Brown

#property indicator_color2 DarkBlue

#property indicator_color3 OrangeRed

#property indicator_color4 SteelBlue

#property indicator_width1 1

#property indicator_width2 1

#property indicator_width3 2

#property indicator_width4 2

//----

extern color SellWickColor = Brown;

extern color BuyWickColor = DarkBlue;

extern color SellBodyColor = OrangeRed;

extern color BuyBodyColor = SteelBlue;

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

double ExtMapBuffer3[];

double ExtMapBuffer4[];

//----

int ExtCountedBars=0;

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//|------------------------------------------------------------------|

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, SellWickColor);

SetIndexBuffer(0, ExtMapBuffer1);

SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, BuyWickColor);

SetIndexBuffer(1, ExtMapBuffer2);

SetIndexStyle(2,DRAW_HISTOGRAM, 0, 2, SellBodyColor);

SetIndexBuffer(2, ExtMapBuffer3);

SetIndexStyle(3,DRAW_HISTOGRAM, 0, 2, BuyBodyColor);

SetIndexBuffer(3, ExtMapBuffer4);

//----

SetIndexDrawBegin(0,10);

SetIndexDrawBegin(1,10);

SetIndexDrawBegin(2,10);

SetIndexDrawBegin(3,10);

//---- indicator buffers mapping

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexBuffer(2,ExtMapBuffer3);

SetIndexBuffer(3,ExtMapBuffer4);

//---- initialization done

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//---- TODO: add your code here

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

double haOpen, haHigh, haLow, haClose;

if(Bars<=10) return(0);

ExtCountedBars=IndicatorCounted();

//---- check for possible errors

if (ExtCountedBars<0) return(-1);

//---- last counted bar will be recounted

if (ExtCountedBars>0) ExtCountedBars--;

int pos=Bars-ExtCountedBars-1;

while(pos>=0)

{

haOpen=(ExtMapBuffer3[pos+1]+ExtMapBuffer4[pos+1])/2;

haClose=(Open[pos]+High[pos]+Low[pos]+Close[pos])/4;

haHigh=MathMax(High[pos], MathMax(haOpen, haClose));

haLow=MathMin(Low[pos], MathMin(haOpen, haClose));

if (haOpen<haClose)

{

ExtMapBuffer1[pos]=haLow;

ExtMapBuffer2[pos]=haHigh;

}

else

{

ExtMapBuffer1[pos]=haHigh;

ExtMapBuffer2[pos]=haLow;

}

ExtMapBuffer3[pos]=haOpen;

ExtMapBuffer4[pos]=haClose;

pos--;

}

//----

return(0);

}

//+------------------------------------------------------------------+

Here is how that second one should look when written properly (it can be written differently, but this one is not declaring buffers two times in the init section, allows you to set ha widths ... and similar stuff. Of the code in the start() not even worth talking)

#property strict

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1 Brown

#property indicator_color2 DarkBlue

#property indicator_color3 OrangeRed

#property indicator_color4 SteelBlue

#property indicator_width1 1

#property indicator_width2 1

#property indicator_width3 2

#property indicator_width4 2

input color ExtColor1 = Brown; // Shadow of bear candlestick

input color ExtColor2 = DarkBlue; // Shadow of bull candlestick

input color ExtColor3 = OrangeRed; // Bear candlestick body

input color ExtColor4 = SteelBlue; // Bull candlestick body

double ExtLowHighBuffer[];

double ExtHighLowBuffer[];

double ExtOpenBuffer[];

double ExtCloseBuffer[];

//------------------------------------------------------------------

//

//------------------------------------------------------------------

void OnInit(void)

{

IndicatorShortName("Heiken ashi");

SetIndexBuffer(0,ExtLowHighBuffer); SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,EMPTY,ExtColor1); SetIndexLabel(0,"Low/High");

SetIndexBuffer(1,ExtHighLowBuffer); SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,EMPTY,ExtColor2); SetIndexLabel(1,"High/Low");

SetIndexBuffer(2,ExtOpenBuffer); SetIndexStyle(2,DRAW_HISTOGRAM,EMPTY,EMPTY,ExtColor3); SetIndexLabel(2,"Open");

SetIndexBuffer(3,ExtCloseBuffer); SetIndexStyle(3,DRAW_HISTOGRAM,EMPTY,EMPTY,ExtColor4); SetIndexLabel(3,"Close");

}

int OnCalculate(const int rates_total,

const int prev_calculated,

const datetime &time[],

const double &open[],

const double &high[],

const double &low[],

const double &close[],

const long &tick_volume[],

const long &volume[],

const int &spread[])

{

for(int i=MathMax(rates_total-prev_calculated-1,1); i>=0; i--)

{

if (i==rates_total-1) { ExtOpenBuffer = open; ExtCloseBuffer = close; continue; }

double haOpen = (ExtOpenBuffer+ExtCloseBuffer)/2;

double haClose = (open+high+low+close)/4;

double haHigh = MathMax(high,MathMax(haOpen,haClose));

double haLow = MathMin(low,MathMin(haOpen,haClose));

if(haOpen<haClose)

{ ExtLowHighBuffer = haLow; ExtHighLowBuffer = haHigh; }

else { ExtLowHighBuffer = haHigh; ExtHighLowBuffer = haLow; }

ExtOpenBuffer = haOpen;

ExtCloseBuffer = haClose;

}

return(rates_total);

}
Fausto Nunziante Del Gaudio
6156
Fausto Nunziante Del Gaudio  
mladen:
The second one is the one written by metaquotes?

yes, exactly.

Mladen Rakic
72037
Mladen Rakic  
thefxpros:
yes, exactly.

Oh well, one day they will learn ...

techmac
2976
techmac  
mladen:
Oh well, one day they will learn ...

I would not count on it

Mladen Rakic
72037
Mladen Rakic  
techmac:
I would not count on it

I hope you are not right

That heiken ashi is a poor example, but I really hope that somebody there is going to decide to start working as a company like that should work

techmac
2976
techmac  
mladen:
I hope you are not right That heiken ashi is a poor example, but I really hope that somebody there is going to decide to start working as a company like that should work

I don't know

What they are doing lately does not help in rebuilding confidence in metatader at all

To add comments, please log in or register