Download MetaTrader 5
To add comments, please log in or register
Find out how social trading can improve your profits
tektronic 2010.07.12 13:40 

I use Ichimoku this is a test code

void OnTick()

   double aTmp[1];
   double aT = aTmp[0];
   double aK = aTmp[0];
   double aA = aTmp[0];
   double aB = aTmp[0]; 
   Print(" T/K/A/B(0): "+string(aT)+","+string(aK)+","+string(aA)+","+string(aB));


At shift/index 0: Tenkan and Kijun are reported correctly, SenkouB is correctly also and is the value 26 periods ago; fixed for current bar time

But the Senkou A appears reported incorrectly and as I see it is current value (now) from shift -26 in future; it should be also the value of 26 periods ago like Senkou B ??

I checked with the built in Ichimoku and Example Ichimoku. Both reports the same error ?.

Initially, I created for me a custom indicator similar with Ichimoku with 2 lines moved in future and I get similar problem. For a line, at shift 0 I get the correct value (from past), for the another one I get the current value (from future) which should be also from past like Ichimoku Senkou A/B. I thought I do mistakes so I did a test on Ichimoku and the same problem.

Is something wrong with me ?

Here a capture:


tektronic 2010.07.12 13:59  

I also have the following problems with custom indicators and I dont know how to solve. Nb. I think I read the docs.

I created a custom indicator which uses 3 built in indicators like stochastic, rsi, demarker using default Symbol() and timeframe. Testing it on a chart is ok.

Now, I want create a 2nd indicator for multiple symbols which uses the first indicator.

eg. in the second one I use:

int iH1 = iCustom("EURUSD",0,"firstind", parameters);

int iH2 = iiCustom("EURJPY",0,"firstind", parameters);

etc, for AUDUSD, other pairs 

I check all errors in init and creating handles is ok. But it appears not working when trying using multiple symbols and/or on different charts.

More exactly, if I use only EURUSD in above statements, and I attach to EURUSD chart my 2nd indicator appears ok.

If I attach to another chart , eg GBPJPY, it is not working even I only use EURUSD or different symbols as above.

I can not use in iCustom the last parameter to specify the Apply to method for first indicator

because the first indicator uses multiple price types, eg. uses stochastic with STOLOWHIGH and RSI with PRICE_MEDIAN.

In first indicator I use OnCalculate with full parameters, 2nd form. etc.. I am fogged. 

thank you 

Step on New Rails: Custom Indicators in MQL5
  • 2009.11.23
  • Андрей
I will not list all of the new possibilities and features of the new terminal and language. They are numerous, and some novelties are worth the discussion in a separate article. Also there is no code here, written with object-oriented programming, it is a too serous topic to be simply mentioned in a context as additional advantages for developers. In this article we will consider the indicators, their structure, drawing, types and their programming details, as compared to MQL4. I hope that this article will be useful both for beginners and experienced developers, maybe some of them will find something new.
To add comments, please log in or register