iCustom for Heiken Ashi

 

I am looking for the Close of the Heinken Ashi.

Thought I have everything right, but gives me the wrong value 

   double HAClose;
   color  HColor1 = Red;
   color  HColor2 = LawnGreen;
   color  HColor3 = Red;
   color  HColor4 = LawnGreen;
   HAClose = iCustom(0,PERIOD_M1,"Heiken Ashi", HColor1,HColor2,HColor3,HColor4,3, 0);

Any ideas?

 
libby000:

I am looking for the Close of the Heinken Ashi.

Thought I have everything right, but gives me the wrong value 

Any ideas?

iCustom does not work like that, it returns the handle of the indicator for further use.

So normally get the handle just once in OnInit.

https://www.mql5.com/en/docs/indicators/icustom

Documentation on MQL5: Technical Indicators / iCustom
Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
[in]  The name of the custom indicator, with path relative to the root directory of indicators (MQL5/Indicators/). If an indicator is located in a subdirectory, for example, in MQL5/Indicators/ [in] input-parameters of a custom indicator, separated by commas. Type and order of parameters must match. If there is no parameters specified, then...
 
libby000:

I am looking for the Close of the Heinken Ashi.

Thought I have everything right, but gives me the wrong value 

Any ideas?

Is this MQL4 or 5?

 
libby000: I am looking for the Close of the Heinken Ashi. … but gives me the wrong value 
HAClose = iCustom(0,PERIOD_M1,"Heiken Ashi", HColor1,HColor2,HColor3,HColor4,3, 0);
  1. On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
              Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4

  2. You should encapsulate your iCustom calls to make your code self-documenting.
              take candle color hekin ashi - Inflation - MQL4 and MetaTrader 4 - or #8 ( 2018.02.21) MQL4 programming forum #1
              Detailed explanation of iCustom - MQL4 programming forum

 
Keith Watford:

Is this MQL4 or 5?

MQL4 thanks
 
libby000:
MQL4 thanks

In future please post in the correct section

I will move this topic to the MQL4 and Metatrader 4 section.

 
Keith Watford:

In future please post in the correct section

I will move this topic to the MQL4 and Metatrader 4 section.

Sorry, thought we could post both here.  How do I know whether this is MQL4 or MQL5 section?
 
libby000: How do I know whether this is MQL4 or MQL5 section?
  1. Look at the link before clicking on one.
  2. Hover over the up arrow at the top and bottom left (of every page): Forumsand read the pop up text or look at the URL.
  3. Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.
 
Thanks
Reason: