When I look at Heiken Ashi.mq4 I see
extern color color1 = Red; extern color color2 = White; extern color color3 = Red; extern color color4 = White;
ExtMapBuffer1[pos]=haHigh; ExtMapBuffer2[pos]=haLow; } ExtMapBuffer3[pos]=haOpen; ExtMapBuffer4[pos]=haClose;
- You not passing any parameters to it, and add some defines to get the right buffer.
color color1 = Red; color color2 = White; color color3 = Red; color color4 = White; #define HAHIGH 0 #define HALOW 1 #define HAOPEN 2 #define HACLOSE 3 double HAHigh = iCustom(NULL,0,"Heiken Ashi", color1,color2,color3,color4, HAHIGH, 0);
There's never a need for normalize. Print("High: " + HAHigh, " Open: " + HAOpen, " Close: " + HAClose, " Low: " + HALow);
Print defaults to 4 digits, try Print("High: ", PriceToStr(HAHigh)...//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits == 5 || Digits == 3){ // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl } string PriceToStr(double p){ string pFrc = DoubleToStr(p, Digits); if(Digits.pips==0) return(pFrc); string pPip = DoubleToStr(p, Digits-1); if (pPip+"0" == pFrc) return(pPip); return(pFrc); } string DeltaToPips(double d){ if (d > 0) string sign = "+"; else sign = ""; double pips = d / pips2dbl; string dPip = sign + DoubleToStr(pips, 0); if(Digits.pips==0) return(dPip); string dFrc = sign + DoubleToStr(pips, Digits.pips); if (dPip+".0" == dFrc) return(dPip); return(dFrc); }
Doh! Thanks mate, I totally forgot about the four candle color externs which obviously have to have a passed argument.
Cheers :)
Hey thanks again - I was about to post some more troubles I had - though I solved it - turns out I was trying to grab data from candle 0, which is 'new', no wonder I was having same pairs. looking at the last fully closed bar of index 1, and i get the right results.
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
Hi guys,
Just trying to build a doji detector for Heiken Ashi using iCustom.
bool check_for_heiken_doji() {
double HAHigh = NormalizeDouble(iCustom(NULL,0,"Heiken Ashi", 0, 0), Digits);
double HALow = NormalizeDouble(iCustom(NULL,0,"Heiken Ashi", 1, 0), Digits);
double HAOpen = NormalizeDouble(iCustom(NULL,0,"Heiken Ashi", 2, 0), Digits);
double HAClose = NormalizeDouble(iCustom(NULL,0,"Heiken Ashi", 3, 0), Digits);
Print("High: " + HAHigh, " Open: " + HAOpen, " Close: " + HAClose, " Low: " + HALow);
}
I'm probably doing something terribly obviously wrong, but my output is:
High: 40.12900000 Open: 40.12900000 Close: 39.59000000 Low: 39.59000000
High: 40.33600000 Open: 40.33600000 Close: 40.16000000 Low: 40.16000000
High: 40.43500000 Open: 40.43500000 Close: 40.43000000 Low: 40.43000000
High: 40.36200000 Open: 40.36200000 Close: 40.60000000 Low: 40.60000000
As you can see the high and open values are always the same, likewise for close/low. However, visual inspection of the bars indicates this is definately not the case! Even if i have the wrong buffer/OHLC, these values certainly shouldnt always be the same in pairs..
I don't understand if I am using the wrong buffer from the indicator, or incorrect syntax in iCustom... any ideas?
Thanks,
Sera