You are testing against zero. Does the indicator use zero for empty instead of EMPTY_VALUE?
//--- indicator buffers mappingSetIndexBuffer(0,BufferUP1,INDICATOR_DATA);
SetIndexBuffer(1,BufferDN1,INDICATOR_DATA);
SetIndexBuffer(2,BufferUP2,INDICATOR_DATA);
SetIndexBuffer(3,BufferDN2,INDICATOR_DATA);
SetIndexBuffer(4,BufferUP3,INDICATOR_DATA);
SetIndexBuffer(5,BufferDN3,INDICATOR_DATA);
SetIndexBuffer(6,BufferMA11,INDICATOR_CALCULATIONS);
SetIndexBuffer(7,BufferMA12,INDICATOR_CALCULATIONS);
SetIndexBuffer(8,BufferMA13,INDICATOR_CALCULATIONS);
SetIndexBuffer(9,BufferMA21,INDICATOR_CALCULATIONS);
SetIndexBuffer(10,BufferMA22,INDICATOR_CALCULATIONS);
SetIndexBuffer(11,BufferMA31,INDICATOR_CALCULATIONS);
SetIndexBuffer(12,BufferMA32,INDICATOR_CALCULATIONS);
SetIndexBuffer(13,BufferATR,INDICATOR_CALCULATIONS);
//--- setting a code from the Wingdings charset as the property of PLOT_ARROWPlotIndexSetInteger(0,PLOT_ARROW,225);
PlotIndexSetInteger(1,PLOT_ARROW,226);
PlotIndexSetInteger(2,PLOT_ARROW,225);
PlotIndexSetInteger(3,PLOT_ARROW,226);
PlotIndexSetInteger(4,PLOT_ARROW,225);
PlotIndexSetInteger(5,PLOT_ARROW,226);
//--- setting indicator parametersIndicatorSetString(INDICATOR_SHORTNAME," POWERED BY HFT");
IndicatorSetInteger(INDICATOR_DIGITS,Digits());
//--- setting buffer arrays as timeseriesArraySetAsSeries(BufferUP1,true);
ArraySetAsSeries(BufferDN1,true);
ArraySetAsSeries(BufferUP2,true);
ArraySetAsSeries(BufferDN2,true);
ArraySetAsSeries(BufferUP3,true);
ArraySetAsSeries(BufferDN3,true);
//---ArraySetAsSeries(BufferMA11,true);
ArraySetAsSeries(BufferMA12,true);
ArraySetAsSeries(BufferMA13,true);
ArraySetAsSeries(BufferMA21,true);
ArraySetAsSeries(BufferMA22,true);
ArraySetAsSeries(BufferMA31,true);
ArraySetAsSeries(BufferMA32,true);
ArraySetAsSeries(BufferATR,true);
here is the buffer mapping of the indicator, Kindly help me out i want to call Buffer UP3 and Buffer DN3
#include <Trade/Trade.mqh>
#include <Trade/OrderInfo.mqh>
#include <Trade/PositionInfo.mqh>
//--- input parametersinputdouble Lots = 0.1;
inputint StopLoss = 100;
inputint TakeProfit = 50;
inputint TrailingStop = 0;
// Miscellaneousinputstring OrderComment = "PROJECT";
//---int handle_iCustom; // variable for storing the handle of the iCustom indicator// Main trading objects
CTrade trade;
CPositionInfo PositionInfo;
// Global variables// Commonbool HaveLongPosition;
bool HaveShortPosition;
//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+intOnInit()
{
//--- create handle of the indicator iCustom
handle_iCustom=iCustom(Symbol(),Period(),"Any custom indicator");
//--- if the handle is not createdif(handle_iCustom==INVALID_HANDLE)
{
//--- tell about the failure and output the error codePrintFormat("Failed to create handle of the iCustom indicator for the symbol %s/%s, error code %d",
Symbol(),
EnumToString(Period()),
GetLastError());
//--- the indicator is stopped earlyreturn(INIT_FAILED);
}
//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
//---
}
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+voidOnTick()
{
//---double up[],down[];
ArraySetAsSeries(up,true);
ArraySetAsSeries(down,true);
int start_pos=0,count=3;
if(!iGetArray(handle_iCustom,0,start_pos,count,up) ||
!iGetArray(handle_iCustom,1,start_pos,count,down))
{
return;
}
//---double Ask = SymbolInfoDouble(Symbol(), SYMBOL_ASK);
if(up[0]!=EMPTY_VALUE)
{
//--- signal "Up" in bar #0int d=0;
Print(__FUNCTION__,"> New Buy signal trade");
trade.Buy(1);
}
if(up[1]!=EMPTY_VALUE)
{
//--- signal "Up" in bar #1int d=0;
}
double Bid = SymbolInfoDouble(Symbol(), SYMBOL_BID);
if(down[0]!=EMPTY_VALUE)
{
//--- signal "Down" in bar #0int d=0;
Print(__FUNCTION__,"> New Sell signal trade");
trade.Sell(1);
}
if(down[1]!=EMPTY_VALUE)
{
//--- signal "Down" in bar #1int d=0;
}
}
//+------------------------------------------------------------------+//| Get value of buffers |//+------------------------------------------------------------------+bool iGetArray(constint handle,constint buffer,constint start_pos,
constint count,double &arr_buffer[])
{
bool result=true;
if(!ArrayIsDynamic(arr_buffer))
{
PrintFormat("ERROR! EA: %s, FUNCTION: %s, this a no dynamic array!",__FILE__,__FUNCTION__);
return(false);
}
ArrayFree(arr_buffer);
//--- reset error codeResetLastError();
//--- fill a part of the iBands array with values from the indicator bufferint copied=CopyBuffer(handle,buffer,start_pos,count,arr_buffer);
if(copied!=count)
{
//--- if the copying fails, tell the error codePrintFormat("ERROR! EA: %s, FUNCTION: %s, amount to copy: %d, copied: %d, error code %d",
__FILE__,__FUNCTION__,count,copied,GetLastError());
//--- quit with zero result - it means that the indicator is considered as not calculatedreturn(false);
}
return(result);
}
//+------------------------------------------------------------------+
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
You are testing against zero. Does the indicator use zero for empty instead of EMPTY_VALUE?
here is the buffer mapping of the indicator, Kindly help me out i want to call Buffer UP3 and Buffer DN3
i tried adding Main Trading Objects as well but