Ask! - page 144

 

iStochastic help needed -Slowing field variable issue...

Hi:

I am having problem with iStochastic.

It returns ZERO value when the MODE_SIGNAL (value of 1) - is used

with SLOWING as a variable.

extern int stoch1k = 14 ;

extern int stoch1s = 3 ;

extern int stoch1d = 3 ;

double stoch1s = iStochastic (NULL,0, stoch1k,stoch1d,stoch1s, 0,0,1,0) ;

always return a ZERO value and not the real position of signal line when

variable is used in SLOWING filed (stoch1s).

But when I HARDCODE that parameter, instead of variable stocha1s (Slowing)

I put number 3 in the same statement it works fine like below :

double stoch1s = iStochastic (NULL,0, stoch1k,stoch1d,3, 0,0,1,0) ;

Can anyone guide me on this please.

I would like to use variable fields for diff values.

Thanks in advance

Pipmonger

 

NewBar

numbercruncher:
Just in case somebody's listening ...

How about this ? Does it make sense for 5min timscale?

Hi numbercruncher, I use this function that I wrote .You can use any of the timeframes to determine if its an new bar in that timeframe

int start()

{

if(ISNewBar(5))

{

//do some thing

}

}

bool ISNewBar(int iTimeFrame)

{

int iIndex = -1;

switch(iTimeFrame)

{

case 1 : iIndex = 0; break;

case 5 : iIndex = 1; break;

case 15 : iIndex = 2; break;

case 30 : iIndex = 3; break;

case 60 : iIndex = 4; break;

case 240 : iIndex = 5; break;

case 1440 : iIndex = 6; break;

default : iIndex =-1; break;

}

static int LastBar[7]= {0,0,0,0,0,0,0};

datetime curbar = iTime(Symbol() ,iTimeFrame, 0);

if(LastBar!=curbar)

{

LastBar=curbar;

return (true);

}

else return(false);

}

 
bobfourie:
Hi numbercruncher, I use this function that I wrote .You can use any of the timeframes to determine if its an new bar in that timeframe

Thanks bobfourie

 

How to modify alert code so it alerts as it happens

Hi guys,

I'm newbie to coding. I have this OSMA indicator, it already has built in zero cross alert but unfortunately it only alerts at the beginning of next candle. Please show me how to modify the alert code so it will alert as it happens. And please show me how to add arrow alert.

Thanks.

Files:
 

importing function

Hi there!!

I'm new to coding and as long as I did some code change in the past I never get to acctually write something from scratch before.

Basically I would like to know how to make a pop up box appear on my chart when I right click with my mouse in a candle.

If somebody knows about a template or some plug already there that does it, I'm pretty sure I can take a look at the code and learn from it

 

EA vs indicator

I am trying to modify an indicator to place trades. Beside inserting the Order commands, what do I need to change to let MT4 know it is an EA? My program simply does not load/respond when I try to load it as an EA.

Also, where should I look to find this answer without bothering you experienced programmers?

 

help for ea base on indicator

dear all

i have indicator(3ma cross with signal)i need to change it to ea , can i copy ind init() to expert init() and ind start() to expert start() and then put sell and buy function when the arrow give me signal??

i do it but it dosent work

 
 

How to change charting time frames?

Anybody help me? in the mt4 plotform the charts are given in fixed time frames i.e. 1min, 5min, 15min, 30min, 1hour, 4hour, day ,etc. I want to see the charts4min,6min, 10min, 20min, 25min, 35min etc time frames live. How to change the time frames to as per our reqiured time frames? I am not a programmer. Hence, kindly explain it in detail how to do it. If there is any code etc available, please post it.

Thanks in advace.

 

MT4 floating point errors

Is it possible to write mql4 code that does floating point arithmetic correctly?

I am a retired programmer with over 40 years of experience. I have thus far been unsuccessful in making an indicator I have written do correct calculations, in spit of using CompareDoubles and NormalizeDouble in every instance that they are necessary.

I've written a Python script (using the decimal library) to duplicate the work of my indicator and the errors of mql4 are clear to see when I compare the output of the two. There are not many discrepancies but there are some and this should not happen.

TIA

Reason: