Data from Bband in separate indicator window

 

Hello


I am trying to write a script/indicator which obtains the values of bbands that is placed in a separate indicator window. I keep getting the value of the bbands from the main window.

Can you help please?

B

 

show your code

 
qjol:

show your code

Hello qjol


Thank you for responding

I have only got to the script stage until I resolve this problem.


int start() // Special funct. start
{
double LastHigh = iHigh(NULL,PERIOD_H4,+1);
double LastMA_01 = iMA(NULL,PERIOD_D1,8,0,MODE_SMA,0,+1);
double LastMA_02 = iMA(NULL,PERIOD_D1,8,0,MODE_SMA,0,+2);
double dBBu_t2 = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,+2);
double dBBl_t2 = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,+2);
double dBBu_t1 = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,+1);
double dBBl_t1 = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,+1);
double dRsi_t2 = iRSI(NULL,0,8,PRICE_CLOSE,+2);
double dRsi_t1 = iRSI(NULL,0,8,PRICE_CLOSE,+1);
//--------------------------------------------------- 4 ---------------------------------------------------------------------------------------
Print("dBBu_t1 ",dBBu_t1);
Print("dBBu_t2 ",dBBu_t2);
Print("dBBl_t1 ",dBBl_t1);
Print("dBBl_t2 ",dBBl_t2);
Print("dRsi_t1 ",dRsi_t1);
Print("dRsi_t2 ",dRsi_t2);
Print("LastMA_01 ",LastMA_01);
Print("LastMA_02 ",LastMA_02);

return; // Exit start()

}

I am having the same problem with the MA.

B

 
Show the indicator externals and the iCustom call
 

why

double LastHigh = iHigh(NULL,PERIOD_H4,+1);

double LastHigh = iHigh(NULL,PERIOD_H4,1);

 
WHRoeder:
Show the indicator externals and the iCustom call
Hello WHRoeder

I haven't got to the stage to place the information in a custom indicator yet, until I can get the correct values.

Am I missing something that I need to read up on?

B

 
qjol:

double LastHigh = iHigh(NULL,PERIOD_H4,+1);

double LastHigh = iHigh(NULL,PERIOD_H4,1);


Here is the script in its entirety.

All it does is print the values of the information requested.

//--------------------------------------------------- 1 ---------------------------------------------------------------------------------
//| BB_SC_Info_06.mq4 |
//| |
//| |
//--------------------------------------------------- 2 ---------------------------------------------------------------------------------
#property copyright ""
#property link ""
#include <WinUser32.mqh>
//--------------------------------------------------- 3 ---------------------------------------------------------------------------------
int start() // Special funct. start
{
double LastMA_01 = iMA(NULL,PERIOD_D1,8,0,MODE_SMA,0,+1);
double LastMA_02 = iMA(NULL,PERIOD_D1,8,0,MODE_SMA,0,+2);
double dBBu_t2 = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,+2);
double dBBl_t2 = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,+2);
double dBBu_t1 = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,+1);
double dBBl_t1 = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,+1);
double dRsi_t2 = iRSI(NULL,0,8,PRICE_CLOSE,+2);
double dRsi_t1 = iRSI(NULL,0,8,PRICE_CLOSE,+1);
//--------------------------------------------------- 4 ---------------------------------------------------------------------------------------
Print("dBBu_t1 ",dBBu_t1);
Print("dBBu_t2 ",dBBu_t2);
Print("dBBl_t1 ",dBBl_t1);
Print("dBBl_t2 ",dBBl_t2);
Print("dRsi_t1 ",dRsi_t1);
Print("dRsi_t2 ",dRsi_t2);
Print("LastMA_01 ",LastMA_01);
Print("LastMA_02 ",LastMA_02);

return; // Exit start()
}
//--------------------------------------------------- 5 ---------------------------------------------------------------------------------
 

Here is a screenshot of the chart and indicator window I would like to obtain the values from.


 

u don't need to pull the data from the window just use the same parameters (or iCustom())

 
qjol:

u don't need to pull the data from the window just use the same parameters (or iCustom())

When I run the script on the chart the information I get is as follows

2010.11.09 20:51:12 BB_SC_Info_06 EURCADgbp,H1: removed
2010.11.09 20:51:12 BB_SC_Info_06 EURCADgbp,H1: uninit reason 0
2010.11.09 20:51:12 BB_SC_Info_06 EURCADgbp,H1: LastMA_02 1.4157
2010.11.09 20:51:12 BB_SC_Info_06 EURCADgbp,H1: LastMA_01 1.4123
2010.11.09 20:51:12 BB_SC_Info_06 EURCADgbp,H1: dRsi_t2 34.4932
2010.11.09 20:51:12 BB_SC_Info_06 EURCADgbp,H1: dRsi_t1 31.1147
2010.11.09 20:51:12 BB_SC_Info_06 EURCADgbp,H1: dBBl_t2 1.3871
2010.11.09 20:51:12 BB_SC_Info_06 EURCADgbp,H1: dBBl_t1 1.3863
2010.11.09 20:51:12 BB_SC_Info_06 EURCADgbp,H1: dBBu_t2 1.3967
2010.11.09 20:51:12 BB_SC_Info_06 EURCADgbp,H1: dBBu_t1 1.3969
2010.11.09 20:51:12 BB_SC_Info_06 EURCADgbp,H1: loaded successfully

Is it possible to get the values that correspond to the indicator scale, insteand of the chart price?