DislikedThanks R4ME for transparency. Is this still correct and do you plan on opening up any other buffers. #define INDEX_EXPORTED_BUY (14) #define INDEX_EXPORTED_SELL (15) #define INDEX_EXPORTED_EXIT (16)Ignored
@Pip-Miner -- the indices and inputs have changed since I last posted that. Here are the new index settings and how I call iCustom() from my EAs:
enum ENUM_EXIT_CONDITION {
EXIT_CROSS_MIDLINE = 101, // Exit when price crosses midline
EXIT_CROSS_OPPOSITE_BAND = 102, // Exit when price crosses opposite band
EXIT_CLOSE_ABOVE_MIDLINE = 103 // Exit when price closes above / below midline
};
#define INDEX_EXPORTED_BUY (15)
#define INDEX_EXPORTED_SELL (16)
#define INDEX_EXPORTED_EXIT (17)
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
string g_strCustomPath_BishopDotun = "R4M-BD-ADR";
bool CustomValue_BishopDotun(string strSymbol, int iPeriod, int shift, int iPercentADR, int& iExportedBUY, int& iExportedSELL, int& iExportedEXIT,
int iMaxBars = 100, int iNumberOfDaysToAverage=20, ENUM_EXIT_CONDITION eWhichExitCondition=EXIT_CROSS_MIDLINE, ENUM_BD_TIMEFRAMES eBDTimeFrame=BD_TF_10080,
bool bApplyMomentumFilter=false)
{
string strMessage = "";
strMessage = StringFormat("*** ENTERING iCustom | %s", WindowExpertName());
// Print(strMessage);
ResetLastError();
iExportedBUY = (int)iCustom(strSymbol, iPeriod /*timeframe*/, g_strCustomPath_BishopDotun,
"", eBDTimeFrame, iPercentADR, iMaxBars, iNumberOfDaysToAverage, eWhichExitCondition, bApplyMomentumFilter,
INDEX_EXPORTED_BUY, shift);
iExportedSELL = (int)iCustom(strSymbol, iPeriod /*timeframe*/, g_strCustomPath_BishopDotun,
"", eBDTimeFrame, iPercentADR, iMaxBars, iNumberOfDaysToAverage, eWhichExitCondition, bApplyMomentumFilter,
INDEX_EXPORTED_SELL, shift);
iExportedEXIT = (int)iCustom(strSymbol, iPeriod /*timeframe*/, g_strCustomPath_BishopDotun,
"", eBDTimeFrame, iPercentADR, iMaxBars, iNumberOfDaysToAverage, eWhichExitCondition, bApplyMomentumFilter,
INDEX_EXPORTED_EXIT, shift);
// if (iExportedEXIT > 0)
// {
// strMessage = StringFormat("*** ExportEXIT iCustom | %s | iExportedEXIT: %d | shift: %d", WindowExpertName(), iExportedEXIT, shift);
// Print(strMessage);
// }
int iLastError = GetLastError();
if (0 != iLastError)
{
// NOTE: 4072 ==> "Cannot load custom indicator"
strMessage = StringFormat("*** [FAILED]: %s: %s: ErrorCode: %d: -- %s",
"CustomValue_BishopDotun", strSymbol, iLastError, ErrorDescription(iLastError));
Print(strMessage);
Alert(strMessage);
return (false);
}
return (true);
}