iCustom question - page 2

 

My EA now works, but I need to back test it.

At the moment, I load the Fibo indicator by hand. For backtesting I need the EA to load it automatically (every midnight at the market opening). I am thinking of using the GlobalVariableGet, but when trying this on a script, it does not work. The support and resistance lines are zeroes.

double dblMyCustomInd=GlobalVariableGet("Fibo");

double Pivot = ObjectGet("Piviot level", OBJPROP_PRICE1);
double R1 = ObjectGet("Resistance 1", OBJPROP_PRICE1);
double R2 = ObjectGet("Resistance 2", OBJPROP_PRICE1);
double R3 = ObjectGet("Resistance 3", OBJPROP_PRICE1);
double S1 = ObjectGet("Support 1", OBJPROP_PRICE1);
double S2 = ObjectGet("Support 2", OBJPROP_PRICE1);
double S3 = ObjectGet("Support 3", OBJPROP_PRICE1);
Print ("Pivot is ", Pivot);
Print ("Resistance 1 is ", R1);
Print ("Resistance 2 is ", R2);
Print ("Resistance 3 is ", R3);
Print ("Support 1 is ", S1);
Print ("Support 2 is ", S2);
Print ("Support 3 ", S3);

I am also testing the indicator today (no ticks, the market is closed), but the code above is in the init function. What am I doing wrong?

Thank you,

R

 

The Global variable functions do not do what you think they do . . . don't get mixed up between Global Variables and globally defined variables.

All you need to do is add the Indicator to the chart you are using during back testing, start the Strategy Tester, pause it, add the Indicator to the chart . . .. or add the Indicator to the tester.tpl or a specific template you use with your EA.

 

Hi, Raptor. Thanks for your answer. I have tried to add a standard RSI indicator (that comes with MT4) and it worked fine.

However, I cannot add the indicator I am using in the strategy tester. It initiliases and deinitialises immediately...I tried to save it in a template and that did not work too. When the template is loaded in the strategy tester it loses the indicator. It does not lose it in the normal chart (in the usual trade window).

I can write a Fibo indicator in the body of the EA, but I would like to avoid as in the future version of the EA, I want to be able to substitute indicators in an easy way. Hence I am thinking if it is possible to call and load an indicator in the EA...

Any ideas are highly appreciated.

 

I believe iCustom will load the Indicator but I don't know if that includes drawing any Objects that the Indicator normally draws.

Can't you debug the Indicator to find why it is starting and stopping ? is there anything in the logs ?

 

Unfortunately, I only have an .ex4 file for the indi, hence can't see inside and apart from the initialisation/deinitialisation messages there is nothing in the logs.

It is not critical for me to get the lines drawn. I only need to get the values at which they are drawn. Can the iCustom be still used? Previously, I have tried to fiddle with its parms and

could not get any sensible output...Will try again and see.

 
resin17:

Unfortunately, I only have an .ex4 file for the indi, hence can't see inside and apart from the initialisation/deinitialisation messages there is nothing in the logs.

It is not critical for me to get the lines drawn. I only need to get the values at which they are drawn. Can the iCustom be still used? Previously, I have tried to fiddle with its parms and

could not get any sensible output...Will try again and see.

Nope, if the lines are created as Objects and their values aren't stored in buffers then iCustom won't help you.
 

It would probably be a lot simpler to calculate the pivot points you need within your EA instead of trying to extract them from that indicator. S/R levels are easy to calculate from the previous days prices.

Fibonacci Pivot Point

R3 = PP + ((High - Low) x 1.000)
R2 = PP + ((High - Low) x .618)
R1 = PP + ((High - Low) x .382)
PP = (H + L + C) / 3
S1 = PP - ((High - Low) x .382)
S2 = PP - ((High - Low) x .618)
S3 = PP - ((High - Low) x 1.000)


C - Closing Price, H - High, L - Low

Reason: