help with perkyasctrend

 

Hi,

i'd like to make an ea with this indicator : perkyasctrend, (thanks collector !!), but the ea seems to miss some dot .... but not all of them ?!?

here is my code :

double perk_up = iCustom(NULL, 0, "PerkyAsctrend",4,250,0,1);
double perk_down = iCustom(NULL, 0, "PerkyAsctrend",4,250,1,1);


if (perk_up != 2147483647){
tfx_direction="up";
}else if (perk_down != 2147483647){
tfx_direction="down";
}else{
tfx_direction="flat";
}

Can anyone help me ?

thanks a lot !!

 

And a dot is?


CB

 
cloudbreaker wrote >>

And a dot is?

CB

a dot is the object on the chart, that's all, i finally found my way into this problem, with a loop !!

Anyway as always thanks CB for the willing to help !!

regards

Victor

 
victor21:

a dot is the object on the chart, that's all, i finally found my way into this problem, with a loop !!

Anyway as always thanks CB for the willing to help !!

regards

Victor

No worries, glad you got it sorted.


CB

 
victor21 wrote >>

Hi,

i'd like to make an ea with this indicator : perkyasctrend, (thanks collector !!), but the ea seems to miss some dot .... but not all of them ?!?

here is my code :

double perk_up = iCustom(NULL, 0, "PerkyAsctrend",4,250,0,1);
double perk_down = iCustom(NULL, 0, "PerkyAsctrend",4,250,1,1);


if (perk_up != 2147483647){
tfx_direction="up";
}else if (perk_down != 2147483647){
tfx_direction="down";
}else{
tfx_direction="flat";
}

Can anyone help me ?

thanks a lot !!

Unfortunately that doesnt seem to work. My understanding is that you need to place a value in a buffer for return through the iCustom call.

I have tried adapting code from another indicator that works for this, but it is not working here and I havent yet figured out why.

Here is what I did..

SetIndexBuffer(0, val1buffer);
SetIndexBuffer(1, val2buffer);
SetIndexBuffer(2, b2);
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY); SetIndexArrow(0, 108);
SetIndexStyle(1, DRAW_ARROW, EMPTY); SetIndexArrow(1, 108);
SetIndexStyle(2, DRAW_NONE);

I added an array called b2. Farther down in the code, where the buy/sell decision is made, I added this;

b2[0] = -1;
Alert(Symbol(), " ", Period(), "M Asctrend BUY ",b2[0]);
return(0);

I set a value of -1 in the b2[0] location. according to my understanding, the following call to icustom

should return the value for the current bar.

double perk_value = iCustom(NULL, 0, "PerkyAsctrend",4,250,2,0);

What I am finding is that the setting of the value in b2[0] is simply not happening. You see I attempt to print it

in the alert, and I always get a value of zero. I have no idea why.

 
bney wrote >>

Unfortunately that doesnt seem to work. My understanding is that you need to place a value in a buffer for return through the iCustom call.

I have tried adapting code from another indicator that works for this, but it is not working here and I havent yet figured out why.

Here is what I did..

SetIndexBuffer(0, val1buffer);
SetIndexBuffer(1, val2buffer);
SetIndexBuffer(2, b2);
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY); SetIndexArrow(0, 108);
SetIndexStyle(1, DRAW_ARROW, EMPTY); SetIndexArrow(1, 108);
SetIndexStyle(2, DRAW_NONE);

I added an array called b2. Farther down in the code, where the buy/sell decision is made, I added this;

b2[0] = -1;
Alert(Symbol(), " ", Period(), "M Asctrend BUY ",b2[0]);
return(0);

I set a value of -1 in the b2[0] location. according to my understanding, the following call to icustom

should return the value for the current bar.

double perk_value = iCustom(NULL, 0, "PerkyAsctrend",4,250,2,0);

What I am finding is that the setting of the value in b2[0] is simply not happening. You see I attempt to print it

in the alert, and I always get a value of zero. I have no idea why.

Updating this a bit more, I found that I was not setting the property correctly,

#property indicator_buffers 3

Once I did this I was able to set the value. Unfortunately the return is now 2147483647

rather than my value. This seems like I am getting a pointer rather than a value.

I need a more experienced indicator/ea coder to help on this one.

Reason: