Problem with iCustom

 

I have a little problem with iCustom which involves a few indicators.

When I'm testing strategy TestLukas.mql4 it gives me result (look on image below) but I wanna to send order when arrow down or arrow up appears. What I do wrong ?

Thanks for answer anyway.



Files:
 

The Indicator has 3 externs . .

extern int SSP       = 6;     //ïåðèîä ëèíåéíîãî ðàçâîðîòà èíäèêàòîðà
extern int CountBars = 2250;  //ðàñ÷åòíûé ïåðèîä 
extern int SkyCh     = 13;    //÷óâñòâèòåëüíîñòü ê ïðîáîþ êàíàëà 

to use iCustome correctly you need to call it with all these parameters . . ( https://docs.mql4.com/indicators/iCustom )

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)

... - Parameters set (if necessary). The passed parameters and their order must correspond with the desclaration order and the type of extern variables of the custom indicator.
 

Thanks RaptorUK for advice.

I changed arrowup and arrowdown in TestLukas to:

double arrowUp = iCustom(NULL,0,"lukas-curves",6,2250,13,0,1);

double arrowDown = iCustom(NULL,0,"lukas-curves",6,2250,13,1,1);

but it's still working the same

Any other idea ?

 
zdzisiunio:

Thanks RaptorUK for advice.

Any other idea ?


Did you look at the Indicator code ?

val1[i] = 0;  
val2[i] = 0;

the values for the arrow buffers are set to zero as default, so your test for EMPTY_VALUE (EMPTY_VALUE 0x7FFFFFFF Default custom indicator empty value.) probably always fails . . .

Add a Print statement to print the arrowUp and arrowDown values so you can see what they actually are . . .

Look at this chart, see all those arrows at the bottom of the chart, they are at 0 . . .

 

Thanks for paying attention to that.

So I changed conditions in EA to:

if (arrowDown >0 && arrowDown!=2147483647 && OrdersTotal()==0)
OrderSend(Symbol(),OP_SELL,lots,Bid,0,Bid+pips_sl*Point,Bid-pips_tp*Point,"SELL",16384);
if (arrowUp >0 && arrowUp!=2147483647 && OrdersTotal()==0)
OrderSend(Symbol(),OP_BUY,lots,Ask,0,Ask-pips_sl*Point,Ask+pips_tp*Point,"BUY",16384);


and it seems to work fine

Best regards

 
zdzisiunio:

Thanks for paying attention to that.

So I changed conditions in EA to:


Well done :-)
 

Hey RaptorUK, if you don't mind I would ask you one more question. I have problem with another indicator called Sidus.

I changed iCustom in TestLukas.mql4 to:

double arrowUp = iCustom(NULL,0,"sidus v.2",14,21,17,true,2,1);
double arrowDown = iCustom(NULL,0,"sidus v.2",14,21,17,true,3,1);


but this doesn't work properly

Actually within 1 month it send only one order, but the arrows were a lot more.

What could be problem this time ?

Below is the test result image with one order:


Files:
sidusmv.2.mq4  5 kb
 
zdzisiunio:

Hey RaptorUK, if you don't mind I would ask you one more question. I have problem with another indicator called Sidus.

I changed iCustom in TestLukas.mql4 to:

double arrowUp = iCustom(NULL,0,"sidus v.2",14,21,17,true,2,1);
double arrowDown = iCustom(NULL,0,"sidus v.2",14,21,17,true,3,1);


Looks like you have the wrong Indicator name in your code . . . . shouldn't it be sidusmv.2 ?

 

Unfortunately that is not problem. This forum changed the name of file when I was uploading it.
The problem is, why this indicator gives only one arrow signal within whole month in iCustom function.

 
  1. RaptorUK said the indicator has 3 externs - all ints. So what is that true doing there?
  2.         ExtMapBuffer4[i-1] = High[i-1]-5*Point;
    Your indicator is looking into the future - so it's useless
  3.      sigPrevious=sigCurrent;
         pipdiffPrevious=pipdiffCurrent;
    
    This won't work in indicators, only valid the first time where it generates each bar. Subsequent bars, especially on refresh or skipped bars, it's using a global instead of the last bar's value.
 
WHRoeder:
  1. RaptorUK said the indicator has 3 externs - all ints. So what is that true doing there?

That was for the old Indicator being used . . lukas-curves.mq4 this new one ( sidusmv.2.mq4 ) has the following . . .

extern int       FastEMA=14;
extern int       SlowEMA=21;
extern int       RSIPeriod=17;
extern bool      Alerts=false;