Hello,
I've got a Custom Indicator which outputs Entry Signals on the chart. In the Data Window I can see that the Indicator has 5 "Index Buffers" and outputs "Buy", "Sell", "Entry", "SL" and "TP".
I want to query this Indicator in an EA via iCustom.
The Indicator has several parameters. Mostly "Int" type, some "String" type separators, some "Double" type and some "Color" type. For instance:
And a few more. But let's assume these are all the parameters.
I use iCustom to call the Indicator like this:
When the Indicator finds a valid (buy) signal, the result of querying the "Index Buffer" 0 (Buy) is the current bid price of the Symbol, otherwise EMPTY_VALUE (2147483647).
Now the weird problem is, it all works perfectly fine in backtests. The EA receives various signals from the Indicator all over the test period. Also when I put the Indicator on the chart during the backtest to see if they match up, they do so perfectly fine. The Indicator outputs a signal and in the next tick the EA receives the same signal with the same values via iCustom and opens a trade.
However, during forward testing on a Live / Demo account, only the Indicator works and does its job. The EA doesn't seem to work, even though all settings are correct. During Live testing, the EA always receives EMPTY_VALUE from iCustom all the time, even though the Indicator on the chart outputs signals. And in like 1 of 10 cases, the EA receives the signal and opens a trade. The Indicator and the EA use exactly the same settings for the parameters (Min Pattern Length, Min Candles Between, ...).
Unfortunately, the only thing I can do to debug the problem is output the values I receive via iCustom. And they are mostly EMPTY_VALUE. So it doesn't help that much. I don't have the code of the Indicator, because it was given to me by a friend who kind of purchased it a while ago and asked me if I could wrap an EA around it. And the programmer of the Indicator seems to have left the scene. I can't attach the Indicator here, because of Licensing reasons and was asked to not do so.
I've got a Custom Indicator which outputs Entry Signals on the chart. In the Data Window I can see that the Indicator has 5 "Index Buffers" and outputs "Buy", "Sell", "Entry", "SL" and "TP".
I want to query this Indicator in an EA via iCustom.
The Indicator has several parameters. Mostly "Int" type, some "String" type separators, some "Double" type and some "Color" type. For instance:
Attached Image
And a few more. But let's assume these are all the parameters.
I use iCustom to call the Indicator like this:
Inserted Code
extern int Ind_Min_Pattern_Length = 20; // Min. Pattern Length, points extern int Ind_Min_Candles_Between = 36; // Min. Candles Between Signals extern int Ind_Min_Clean_Candles = 36; // Min. Clean Candles extern int Ind_Clean_Candles_Extra_Dist =5; // Clean Candles Extra Distance, points extern double Ind_Min_TP_Ratio = 2.0; // Min. TP Ratio extern double Ind_SL_Offs = 10.0; // Stop Loss Offset, points extern string sep04 = "Slow MA"; // ==== Slow MA ==== extern int Ind_SlowMA_Period = 200; // Period extern ENUM_MA_METHOD Ind_SlowMA_Method = MODE_EMA; // Method extern ENUM_APPLIED_PRICE Ind_SlowMA_Appl_Price = PRICE_CLOSE; // Applied Price extern int Ind_SlowMA_Shift = 0; // MA Shift const int Data_Index_Buy = 0; // ... double result = iCustom( _Symbol, PERIOD_CURRENT, Ind_Path_Name, Ind_Min_Pattern_Length, // Min. Pattern Length, points Ind_Min_Candles_Between, // Min. Candles Betwen Signals Ind_Min_Clean_Candles, // Min. Clean Candles Ind_Clean_Candles_Extra_Dist, // Clean Candles Extra Distance, points Ind_Min_TP_Ratio, // Min. TP Ratio Ind_SL_Offs, // Stop Loss Offset, points "", // ==== Slow MA ==== Ind_SlowMA_Period, // Period Ind_SlowMA_Method, // Method Ind_SlowMA_Appl_Price, // Applied Price Ind_SlowMA_Shift, // MA Shift Data_Index_Buy, // Index Buffer Buy = 0 1 // Shift = 1 = Previous bar );
When the Indicator finds a valid (buy) signal, the result of querying the "Index Buffer" 0 (Buy) is the current bid price of the Symbol, otherwise EMPTY_VALUE (2147483647).
Now the weird problem is, it all works perfectly fine in backtests. The EA receives various signals from the Indicator all over the test period. Also when I put the Indicator on the chart during the backtest to see if they match up, they do so perfectly fine. The Indicator outputs a signal and in the next tick the EA receives the same signal with the same values via iCustom and opens a trade.
However, during forward testing on a Live / Demo account, only the Indicator works and does its job. The EA doesn't seem to work, even though all settings are correct. During Live testing, the EA always receives EMPTY_VALUE from iCustom all the time, even though the Indicator on the chart outputs signals. And in like 1 of 10 cases, the EA receives the signal and opens a trade. The Indicator and the EA use exactly the same settings for the parameters (Min Pattern Length, Min Candles Between, ...).
Unfortunately, the only thing I can do to debug the problem is output the values I receive via iCustom. And they are mostly EMPTY_VALUE. So it doesn't help that much. I don't have the code of the Indicator, because it was given to me by a friend who kind of purchased it a while ago and asked me if I could wrap an EA around it. And the programmer of the Indicator seems to have left the scene. I can't attach the Indicator here, because of Licensing reasons and was asked to not do so.
- Have you ever seen such a behavior of iCustom?
- Do I miss something?
- Can an Indicator know if it was queried via iCustom and return garbage values?
- I assume that you need to pass ALL parameters on the iCustom call, also the String separators?
Thanks a lot in advance for your time and help!