Jo,
Let me know if this works how you would expect, i.e. consistent with MT3 results.
Let me know if this works how you would expect, i.e. consistent with MT3 results.
//+------------------------------------------------------------------+ //| HistoZZ.mq4 | //| Copyright © 2006, Mu Technologies | //| http://www.mutechnologies.com.au | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, Mu Technologies" #property link "http://www.mutechnologies.com.au" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Red //---- input parameters extern int Level = 2; extern int nBars = 400; extern int BuildChanel = 0; //---- buffers double ExtHistoBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexBuffer(0,ExtHistoBuffer); //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double zz = 0, zzlast = 0; // Check for possible errors if (IndicatorCounted() < 0) return(-1); int limit = Bars - IndicatorCounted() - 1; for (int iter = 0; iter < limit; iter++) { zz = iCustom(NULL, 0, "ZigZag", Level, nBars, BuildChanel, 0, iter); if (zz > 0) zzlast = zz; ExtHistoBuffer[iter] = zzlast; } return(0); } //+------------------------------------------------------------------+
Cheers,
Aaron.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
can someone please help to convert the MT3 HistoFractalZigZag indicator to MT4 please? The code is below.
thanks
---------------
/*[[
Name := HistoZZ
Separate Window := Yes
First Color := Red
First Draw Type := Histogram
First Symbol := 217
Use Second Data := No
Second Color := Red
Second Draw Type := Line
Second Symbol := 218
]]*/
Input : Level(2),nBars (400),BuildChanel(0);
Variable : shift(0), zz0(0), zzlast(0);
SetLoopCount(0);
For shift=nBars Downto 0 Begin
zz0=iCustom("ZigZag",Level,nBars,BuildChanel,MODE_FIRST,shift);
if (zz0 > 0) then zzlast = zz0);
SetIndexValue(shift, zzlast);
End;