Few quick questions

 

Hi i have a few quick questions :

1) If i want to apply the icustom to a specific timeframe in this case 5 min, should i put : 5 or PERIOD_M5

2) If i want to add an icustom indicator then if the if i want to use the default values of that indicator can i put in every slot: "default",without "" or otherwise how to do it?

3) Is an exponential moving average applicable to the current bar or i must shift it back?

 
  1. Don't hard code numbers. E.g.
  2. Don't put in anything in the parameter section: iCustom( string symbol, int timeframe, string name, ..., int mode, int shift) drop the "...,". See also Detailed explanation of iCustom - MQL4 forum
  3. What you ask for is what you get. Do you want the current changing one or the previous bar?



 
WHRoeder:
  1. Don't hard code numbers. E.g.
  2. Don't put in anything in the parameter section: iCustom( string symbol, int timeframe, string name, ..., int mode, int shift) drop the "...,". See also Detailed explanation of iCustom - MQL4 forum
  3. What you ask for is what you get. Do you want the current changing one or the previous bar?




Regarding to point 2.,if i drop the "" empty does that work if the variable defaulted is an int, since "" is mostly used for strings.

Like this:

double EMA12=iCustom(Symbol(),PERIOD_M5, "GatorX",6,"");

Regarding to point 3. some indicators dont calculate for current bar, or they calculate close prices which is only known after the bar is formed.What if i have a custom indicator not necessary an EMA but something similar to it, should i shift it back 1 to be sure or try as it is?

 
Proximus:

Regarding to point 2.,if i drop the "" empty does that work if the variable defaulted is an int, since "" is mostly used for strings.

Regarding to point 3. some indicators dont calculate for current bar, or they calculate close prices which is only known after the bar is formed.What if i have a custom indicator not necessary an EMA but something similar to it, should i shift it back 1 to be sure or try as it is?

2. for iCustom you either specify them all or none, if you specify none then the default values coded into the Indicator are used.

3. bar 0 has a close value, it is Bid. Get the value for the bar number your strategy calls for.

 
Proximus:

double EMA12=iCustom(Symbol(),PERIOD_M5, "GatorX",6,"");
                   symbol^ Timeframe^ name^ mode=6 shift=?
 iCustom( string  symbol, int  timeframe, string  name, ..., int  mode, int  shift) 

Are there seven buffers in the indicator? do you want number 6?

What shift (number) are you using?

 
RaptorUK:

2. for iCustom you either specify them all or none, if you specify none then the default values coded into the Indicator are used.

I hope you don't mind if I correct you, but all the variables that are not mentioned in iCustom(..) AFTER the previous extern vars, were set to their default values!

Example: Stochastic has 3 external variables with their default:

extern int KPeriod=5;
extern int DPeriod=3;
extern int Slowing=3;

so

double main = iCustom(NULL,010,   0,0);

should give you the Value of the MainBuffer of Stochastic(10, 3,3,) [instead of (5,3,3)]

no?

Gooly

 
WHRoeder:

Are there seven buffers in the indicator? do you want number 6?

What shift (number) are you using?



Yea it has 12 buffers.So it is correct if the shift is "" ?


gooly:
I hope you don't mind if I correct you, but all the variables that are not mentioned in iCustom(..) AFTER the previous extern vars, were set to their default values!

Example: Stochastic has 3 external variables with their default:

so

should give you the Value of the MainBuffer of Stochastic(10, 3,3,) [instead of (5,3,3)]

no?

Gooly





Yea but stoch is a build in indicator.My indicator is custom and it's calculated based on EMA, ATR and other formulas.
 
Proximus: Yea it has 12 buffers.So it is correct if the shift is ""
  1. Indicator can only have 8 buffers.
  2. Shift is an int.
 
gooly:
double main = iCustom(NULL,0, "Stochastic", 10,   0,0);
should give you the Value of the MainBuffer of Stochastic(10, 3,3,) [instead of (5,3,3)]
Only if you call an indicator
 
WHRoeder:
Only if you call an indicator

Understood.I have 1 more question.

Can i put all myindicators in the Init(), since if i have them in the start() and i have like 30+ defined there, and the BUY/SELL signals are very complicated with many if(), so my PC will work very hard if i run a backtest.And if i got the indicators defined in the start it will load them up many times until i run out of ram and my pc crashes...Can i put them in the INIT() and call them in the start if i need it like;

init()

double main = iCustom(NULL,0, "Stochastic", 10,   0,0);
and start()
if ( main >50) BUY=true;
or something like it
 
gooly:
I hope you don't mind if I correct you, but all the variables that are not mentioned in iCustom(..) AFTER the previous extern vars, were set to their default values!

Example: Stochastic has 3 external variables with their default:

so

should give you the Value of the MainBuffer of Stochastic(10, 3,3,) [instead of (5,3,3)]

no?

I don't mind at all, I'm always ready to learn

How does iCustom know which of the externs you have specified ? if you provide just one does it assume it is the first ? what if you just provided the 2nd ? how would it know ? I haven't tested it, maybe you have ? the simple and least prone to error advice is "specify them all or specify none" IMO . . . it may not be the minimally needed information but it should work.

Reason: