Calling indicators in offline chart

 

I tried to get correct signals from calling BBands stop indicator on offline charts but it keeps saying sell, sell, and sell all days. Can you help solve it?

extern int StopLoss=0;
extern int TakeProfit=0;
extern double Lots=1;
extern int Slippage=3;

extern int Length=5; // Bollinger Bands Period
extern int Deviation=1; // Deviation
extern double MoneyRisk=1.00; // Offset Factor
extern int Signal=1; // Display signals mode: 1-Signals & Stops; 0-only Stops; 2-only Signals;
extern int Line=1; // Display line mode: 0-no,1-yes
extern int Nbars=0;

int init()
{
start(); // call start() function
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int BB=0;
while (!IsStopped())
{
if( RefreshRates())
{
// mBid = MarketInfo( Symbol(), MODE_BID );
// mAsk = MarketInfo( Symbol(), MODE_ASK );
//double ma = iMA( NULL, 0, ....... ); // insert other things here
double
BB01=iCustom(NULL,0,"BB Stop",Length,Deviation,MoneyRisk,Signal,Line,Nbars,0,1),
BB02=iCustom(NULL,0,"BB Stop",Length,Deviation,MoneyRisk,Signal,Line,Nbars,0,2),
BB11=iCustom(NULL,0,"BB Stop",Length,Deviation,MoneyRisk,Signal,Line,Nbars,1,1),
BB12=iCustom(NULL,0,"BB Stop",Length,Deviation,MoneyRisk,Signal,Line,Nbars,1,2);
if(BB12>0 && BB01>0) BB=1;
if(BB02>0 && BB11>0) BB=-1;

Alert(BB);
Sleep(50000);
}
}
return(0);
}
 

Some things I don't understand ...

- Why is start() called from init()?

- Why is Sleep(50000) in there?

- Where is the Sell, Sell, Sell?

And then ...

- Why not use the SRC button to nicely format your code?

 
  1. You CAN NOT call start() from init() See IsConnected() - MQL4 forum https://www.mql5.com/en/forum/128803/page2

  2. You are sleeping for 50 seconds, why would you expect the signal to be different and NOT alert the same thing? If the signal was no longer value but not the opposite, do you ever reset BB to zero?


Reason: