Awesome job with this indicator! I have been trying to make a small EA based on this indicator. When the indicator becomes green, it will send a buy order and vice versa (Red = Sell). Though I am having an issue with the indicator buffers while using iCustom. Buffers #2 and #3 always seemed to be returning Empty_Value, while all other buffers return zero. This is the same case always regardless if the indicator is green or red.
Here is a small piece of EA which I used to extract the buffer values during backtest in MT4 Strategy Tester.
Code: Select all
#include <stdlib.mqh>
extern int AvgPeriod = 25;
extern ENUM_APPLIED_PRICE AvgPrice = PRICE_CLOSE;
extern ENUM_MA_METHOD AvgType = MODE_EMA;
extern bool AvgSup = false;
extern bool alertsOn = false;
extern bool alertsOnCurrent = false;
extern bool alertsMessage = false;
extern bool alertsSound = false;
extern bool alertsPushNotif = false;
extern bool alertsEmail = false;
extern color ColorUp = 65280;
extern color ColorDown = 11823615;
extern color ColorShadow = 6908265;
extern int LinesWidth = 1;
extern bool Interpolate = true;
void OnTick()
{
double Buffer0 = iCustom(Symbol(), 0, "Super smoothed average trend 1.2", AvgPeriod, AvgPrice,AvgType,AvgSup,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsPushNotif,alertsEmail,ColorUp,ColorDown,ColorShadow, LinesWidth, Interpolate, 0, 1);
Print("The value of Indicator Buffer 0 is: ", Buffer0);
double Buffer1 = iCustom(Symbol(), 0, "Super smoothed average trend 1.2", AvgPeriod, AvgPrice,AvgType,AvgSup,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsPushNotif,alertsEmail,ColorUp,ColorDown,ColorShadow, LinesWidth, Interpolate, 1, 1);
Print("The value of Indicator Buffer 1 is: ", Buffer1);
double Buffer2 = iCustom(Symbol(), 0, "Super smoothed average trend 1.2", AvgPeriod, AvgPrice,AvgType,AvgSup,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsPushNotif,alertsEmail,ColorUp,ColorDown,ColorShadow, LinesWidth, Interpolate, 2, 1);
Print("The value of Indicator Buffer 2 is: ", Buffer2);
double Buffer3 = iCustom(Symbol(), 0, "Super smoothed average trend 1.2", AvgPeriod, AvgPrice,AvgType,AvgSup,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsPushNotif,alertsEmail,ColorUp,ColorDown,ColorShadow, LinesWidth, Interpolate, 3, 1);
Print("The value of Indicator Buffer 3 is: ", Buffer3);
double Buffer4 = iCustom(Symbol(), 0, "Super smoothed average trend 1.2", AvgPeriod, AvgPrice,AvgType,AvgSup,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsPushNotif,alertsEmail,ColorUp,ColorDown,ColorShadow, LinesWidth, Interpolate, 4, 1);
Print("The value of Indicator Buffer 4 is: ", Buffer4);
double Buffer5 = iCustom(Symbol(), 0, "Super smoothed average trend 1.2", AvgPeriod, AvgPrice,AvgType,AvgSup,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsPushNotif,alertsEmail,ColorUp,ColorDown,ColorShadow, LinesWidth, Interpolate, 5, 1);
Print("The value of Indicator Buffer 5 is: ", Buffer5);
double Buffer6 = iCustom(Symbol(), 0, "Super smoothed average trend 1.2", AvgPeriod, AvgPrice,AvgType,AvgSup,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsPushNotif,alertsEmail,ColorUp,ColorDown,ColorShadow, LinesWidth, Interpolate, 6, 1);
Print("The value of Indicator Buffer 6 is: ", Buffer6);
double Buffer7 = iCustom(Symbol(), 0, "Super smoothed average trend 1.2", AvgPeriod, AvgPrice,AvgType,AvgSup,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsPushNotif,alertsEmail,ColorUp,ColorDown,ColorShadow, LinesWidth, Interpolate, 7, 1);
Print("The value of Indicator Buffer 7 is: ", Buffer7);
double Buffer8 = iCustom(Symbol(), 0, "Super smoothed average trend 1.2", AvgPeriod, AvgPrice,AvgType,AvgSup,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsPushNotif,alertsEmail,ColorUp,ColorDown,ColorShadow, LinesWidth, Interpolate, 8, 1);
Print("The value of Indicator Buffer 8 is: ", Buffer8);
}
When I run backtest using this code, the tester journal gives me results as shown in the image below. Also, the indicator doesn't show up on the chart once we finish/stop the backtesting in Visual mode.
Will you please advise me on how to get around this? Thank you very much for your time.