Just as I thought I was getting a small grasp of MetaTrader. The 'stochsig' array is displayed in the indicator window and in the data window. The 'upbar' and 'dnbar' arrays are not displayed in either window. Data is being entered into the arrays as evidenced by the print statements as the data is processed. Thank you for your guidance.
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.
Just as I thought I was getting a small grasp of MetaTrader. The 'stochsig' array is displayed in the indicator window and in the data window. The 'upbar' and 'dnbar' arrays are not displayed in either window. Data is being entered into the arrays as evidenced by the print statements as the data is processed. Thank you for your guidance.
#property indicator_separate_window
#property indicator_color1 Yellow#property indicator_color2 Green
#property indicator_color3 Red
extern int StochPeriod1=14;
extern int DPeriod1=3;
extern int SlowingPeriod1=3;
double stochsig[];
double upbar[];
double dnbar[];
int init()
{
IndicatorBuffers(3);
SetIndexBuffer(0,stochsig);
SetIndexLabel(0,"StochSig");
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(1,upbar);
SetIndexLabel(1,"UpBar");
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID); //upbar
SetIndexEmptyValue(1,EMPTY_VALUE);
SetIndexBuffer(2,dnbar);
SetIndexLabel(2,"DnBar");
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID); //dnbar
SetIndexEmptyValue(2,EMPTY_VALUE);
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int counted_bars=IndicatorCounted();
int shift,limit;
limit=Bars-31;
IndicatorShortName("StochHist ("+StochPeriod1+","+DPeriod1+","+SlowingPeriod1+")");
if(counted_bars>=31) limit=Bars-counted_bars-1;
for (shift=limit;shift>=0;shift--)
{
stochsig[shift]=iStochastic(NULL,0,StochPeriod1,DPeriod1,SlowingPeriod1,MODE_SMA,0,MODE_MAIN,shift)-50;
if(stochsig[shift]>0)
{
upbar[shift]=stochsig[shift]; //green bars
Print("upbar..."+upbar[shift]);
}
else
if (stochsig[shift]<0)
{
dnbar[shift]=stochsig[shift]; //red bars
Print("dnbar..."+dnbar[shift]);
}
}
return(0);
}