Custom Indicator Returns Integer Value

 

Hi, all

I have a problem when create a custom indicator which return 4 values. 2 of them are double value while the others are interger. But I can only get the double values, the interger values are empty. I set the right buffer type, it seems in vain anyway. Does somebody know how to solve it? Thx so much in advance :)

 

SetIndexBuffer is expecting a double array. iCustom returns double.

If your indicator is using an integer array, that could be a problem.

 
brewmanz:

SetIndexBuffer is expecting a double array. iCustom returns double.

If your indicator is using an integer array, that could be a problem.

Thx for your reply. Then you mean iCustom() can't return a integer value? I also try some cast way from integer to double, but it doesn't work. My integer values are all positive numbers like 10 How can I transform it into 10.0?

I think the API doesn't provide any interface like this.

 

Look on integers as truncated doubles when passing values back and forth. You seem to be getting hung up on conversion between them.

If you were to show us some code, maybe we could give specific advice rather than general.

 

Sorrry for late reply. I was on vocation these days. Since the code is a litthle bit long, i just show you the reference part. My original intention is like these:

#property indicator_buffers 4

//two double buffers to store price

double DDLne1[];

double DDLIne2[]

//two integer buffers to store bars

int DDline1Pre[];

int DDline2Pre[];

It seems impossible to assign double to the double buffer while assign integer to integer buffer and get the right result from the MT4 indicator window.

Further more I want to change all the buffers as double buffes and give double to the double buffer used as the integer one. For instance, asign 1.0 for 1,

but still I can't receive what I want.

Thank you very much and wait for your reply.

 
Asked and answered. Make the arrays a double. For assignment:
  1. DDline1Pre[index]=Normalize(aDoubleValue,0);
  2. DDline1Pre[index]=aIntValue;
  3. int Int(double d){ return(d); }
    DDline1Pre[index]=Int(aDoubleValue);
    

 

can someone help me edit sar ohlc to use heiken ashi ohlc

Hi, I have an MTF indicator that uses sar, however I'd like the sar to calculate heiken ashi ohlc, and not the normal type

Can you tell me how I can do this, my mtf indicator calls to the sar indicator to calculate sar formula, I think it is calling to the internal indicator in mt4 that can not edit

you can skype or email if you can assist and like to talk about it

skype sty671

email sty671@gmail.com

I can also supply the original file that I'm trying to use heiken ashi ohlc for

Reason: