This is a mystery to me!

 

I am in the process of writing an EA to alert me under certain conditions. One of the conditions is based on the custom indicator CurrencySLopeStrength, but I am experiencing a strange phenomenon.

I am filling three variables of every currency with the values read from the custom indicator at three different shift positions. Now no matter how I change the shift positions, change the position of the code, change the name of the variable, Thr third variable is always filled with a value of "0", while the others are correctly filled with valid numbers, e.g

20:30:34 2013.10.01 00:02 SR Alert CC GBPUSD,H1: USDbefore1 is -0.2962 USDafter is 0 USDbefore2 is -0.2942
20:30:34 2013.10.01 00:02 SR Alert CC GBPUSD,H1: GBPbefore1 is 0.2962 GBPbefore2 is 0.2942 GBPafter is 0

    double USDbefore1 = iCustom(NULL,0,"CurrencySlopeStrength(2)",0,2);
    double USDbefore2 = iCustom(NULL,0,"CurrencySlopeStrength(2)",0,3);
    double USDafter = iCustom(NULL,0,"CurrencySlopeSrength(2)",0,1); 
    double GBPbefore1 = iCustom(NULL,0,"CurrencySlopeStrength(2)",2,2);
    double GBPbefore2 = iCustom(NULL,0,"CurrencySlopeStrength(2)",2,3);
    double GBPafter = iCustom(NULL,0,"CurrencySlopeSrength(2)",2,1);

The only thing that I can think that is causing this problem is the following "error" message in the Strategy Tester Journal:

20:19:42 2013.10.01 00:00 CurrencySlopeStrength(2) GBPUSD,H1: unknown subwindow number -1 for ObjectCreate function

Can anyone please help?

 
ernest02:

I am in the process of writing an EA to alert me under certain conditions. One of the conditions is based on the custom indicator CurrencySLopeStrength, but I am experiencing a strange phenomenon.

I am filling three variables of every currency with the values read from the custom indicator at three different shift positions. Now no matter how I change the shift positions, change the position of the code, change the name of the variable, Thr third variable is always filled with a value of "0", while the others are correctly filled with valid numbers, e.g

20:30:34 2013.10.01 00:02 SR Alert CC GBPUSD,H1: USDbefore1 is -0.2962 USDafter is 0 USDbefore2 is -0.2942
20:30:34 2013.10.01 00:02 SR Alert CC GBPUSD,H1: GBPbefore1 is 0.2962 GBPbefore2 is 0.2942 GBPafter is 0

The only thing that I can think that is causing this problem is the following "error" message in the Strategy Tester Journal:

20:19:42 2013.10.01 00:00 CurrencySlopeStrength(2) GBPUSD,H1: unknown subwindow number -1 for ObjectCreate function

Can anyone please help?


I think you need to test in visual mode so the Indicator can draw it's Objects . . .
 
ernest02: Can anyone please help?
Without the code (or at least link to the code) to the indicator, unlikely.
 
Looks like the problem is only with the "after" variables. Please post more code showing where the "after" variables are being set.
 
RaptorUK:
I think you need to test in visual mode so the Indicator can draw it's Objects . . .

I have tested in visual mode and I do not see any errors or problems. The indicator is drawn correctly in test mode.

THe "mystery" is why two of the three varaibales are filled, but not the third one?

I think the clue must lie in the message saying "GBPUSD,H1: unknown subwindow number -1 for ObjectCreate function"

 
WHRoeder:
Without the code (or at least link to the code) to the indicator, unlikely.


Here is some more of the code applicable to this particular problem:

 //Determine value of each currency in the pair
    
      
    double USDbefore1 = iCustom(NULL,0,"CurrencySlopeStrength(2)",0,2);
    double USDbefore2 = iCustom(NULL,0,"CurrencySlopeStrength(2)",0,3);
    double USDafter = iCustom(NULL,0,"CurrencySlopeSrength(2)",0,1); 
    double EURbefore1 = iCustom(NULL,0,"CurrencySlopeStrength(2)",1,2);
    double EURbefore2 = iCustom(NULL,0,"CurrencySlopeStrength(2)",1,3);
    double EURafter = iCustom(NULL,0,"CurrencySlopeSrength(2)",1,1);
    double GBPbefore1 = iCustom(NULL,0,"CurrencySlopeStrength(2)",2,2);
    double GBPbefore2 = iCustom(NULL,0,"CurrencySlopeStrength(2)",2,3);
    double GBPafter = iCustom(NULL,0,"CurrencySlopeSrength(2)",2,1);
    double CHFbefore1 = iCustom(NULL,0,"CurrencySlopeStrength(2)",3,2);
    double CHFbefore2 = iCustom(NULL,0,"CurrencySlopeStrength(2)",3,3);
    double CHFafter = iCustom(NULL,0,"CurrencySlopeSrength(2)",3,1);
    double JPYbefore1 = iCustom(NULL,0,"CurrencySlopeStrength(2)",4,2);
    double JPYbefore2 = iCustom(NULL,0,"CurrencySlopeStrength(2)",4,3);
    double JPYafter = iCustom(NULL,0,"CurrencySlopeSrength(2)",4,1);
    double AUDbefore1 = iCustom(NULL,0,"CurrencySlopeStrength(2)",5,2);
    double AUDbefore2 = iCustom(NULL,0,"CurrencySlopeStrength(2)",5,3);
    double AUDafter = iCustom(NULL,0,"CurrencySlopeSrength(2)",5,1);
    double CADbefore1 = iCustom(NULL,0,"CurrencySlopeStrength(2)",6,2);
    double CADbefore2 = iCustom(NULL,0,"CurrencySlopeStrength(2)",6,3);
    double CADafter = iCustom(NULL,0,"CurrencySlopeSrength(2)",6,1);
    double NZDbefore1 = iCustom(NULL,0,"CurrencySlopeStrength(2)",7,2);
    double NZDbefore2 = iCustom(NULL,0,"CurrencySlopeStrength(2)",7,3);
    double NZDafter = iCustom(NULL,0,"CurrencySlopeSrength(2)",7,1);

//Determine which currencies are applicable to the chart
   
    string CurrPair = Symbol();
    string FirstCurr = StringSubstr(CurrPair,0,3);
    string SecondCurr = StringSubstr(CurrPair,3,3);
    
Print("USDbefore1 is ", USDbefore1, " USDafter is " , USDafter, " USDbefore2 is ", USDbefore2);
Print("GBPbefore1 is ",GBPbefore1, " GBPbefore2 is ",GBPbefore2, " GBPafter is ", GBPafter);
Print("First Currency is ", FirstCurr, " Second Currency is ", SecondCurr);
    
if (FirstCurr == "GBP" && SecondCurr == "USD") 
   {
      Pair = "GBPUSD";
      if ((GBPbefore1 > USDbefore1) || (GBPbefore2 > USDbefore2) && (GBPafter < USDafter)) 
      SellArray[3] = true;
      if ((GBPbefore1 < USDbefore1) || (GBPbefore2 < USDbefore2) && (GBPafter > USDafter))
      BuyArray[3] = true;
   }
 

I do not know the indicator, but maybe it is meant to be a zero value?

Does it show a value in the data window?

 
GumRai:

I do not know the indicator, but maybe it is meant to be a zero value?

Does it show a value in the data window?


Yes it does show values in the data window.
 

I ran a test with the shifts set at 1,2 & 3 and observed the values for period 1:23:

22:01:02 2013.10.01 01:23 SR Alert CC GBPUSD,H1: USDbefore1 is -0.3049 USDafter is 0 USDbefore2 is -0.2962

Then I ran a test with shifts set at 2,3 & 4 and got the following values for the same period (1:23) :

21:55:55 2013.10.01 01:23 SR Alert CC GBPUSD,H1: USDbefore1 is -0.2962 USDafter is 0 USDbefore2 is -0.2942

As you can see USDbefore2 (shift = 3) is equal to USDbefore1 (shift = 3) - which is correct. But the value for the third shift/variable is never available.

Is there a possibility that this indicator can only calculate two bars at a time and the third bar is not saved or something and is therefore not available?

As you can see I am clutching at straws here!

 

I have NOW discovered that the values of the indicator drawn in the Strategy Tester is not the same as the values of the same indicator when run in normal mode on the same currency pair - ALTHOUGH THE CROSSINGS TAKES PLACE AT EXACTLY THE SAME PERIOD.

I am attaching the code for the indicator if anybody wants to help me to find out why this happens.

NOBODY HAS SAID ANYTHING ABOUT THE "ERROR" MESSAGE I GET IN THE JOURNAL: "unknown subwindow number -1 for ObjectCreate function"

 
ernest02:


NOBODY HAS SAID ANYTHING ABOUT THE "ERROR" MESSAGE I GET IN THE JOURNAL: "unknown subwindow number -1 for ObjectCreate function"


RaptorUK:
I think you need to test in visual mode so the Indicator can draw it's Objects . . .


The Indicator is probably trying to get the window number from where it is attached so it can draw it's Objects, but it isn't actually attached so it fails to get the Window number, hence -1, so it can't draw it's Objects, does it need these Objects to function correctly ? do you have the source code for the Indicator ?
Reason: