Whats wrong with this code?

 

Whats wrong with this code?

I get previous day high/low/close and start calculation.

To get previous day high/low/close i got simple code here. just added some code for previous day low,close and calculations.

when i compile which shows error message

[' - array index is to be an integer

Here is the code i tried:

datetime today;
datetime yesterday;
int iToday;
int iYesterday;
double iYestHigh=0;
double iYestLow=0;
double iYestClose=0;
double Pivot=0;
double Range=0;
double Move=0;
double Bynow=0;
double Slnow=0;
double Btp=0;
double Stp=0;
double Bsl=0;
double Ssl=0;


int init()
{
    NDigits = Digits;
    
    if (false) ObjectsDeleteAll();      // clear the chart
    
    
    
    
    
    
    Comment("");    // clear the chart
}

// Expert start
int start()
{
    if (Bars < 10)
    {
        Comment("Not enough bars");
        return (0);
    }
    if (Terminated == true)
    {
        Comment("EA Terminated.");
        return (0);
    }
    
    OnEveryTick5();
    
}

void OnEveryTick5()
{
    if (true == false && false) PipValue = 10;
    if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10;
    
    PreviousHighLow();
    
}


void PreviousHighLow()
{
    today= iTime(NULL, PERIOD_D1, 0);
    yesterday= iTime(NULL, PERIOD_D1, 1);
    iToday= iBarShift(NULL, 0, today);
    iYesterday= iBarShift(NULL, 0, yesterday);
    iYestHigh=Highest(NULL,0,MODE_HIGH, iYesterday-iToday, iToday+1);
    iYestLow=Lowest(NULL,0,MODE_LOW, iYesterday-iToday, iToday+1);
    iYestHigh=High[iYestHigh];
    iYestLow=Low[iYestLow];
    iYestClose = iClose(NULL,PERIOD_D1,1);
    Pivot=iYestHigh+iYestLow+iYestClose/3;
    Range=iYestHigh-iYestLow;
    Move=Range*0.25;
    Bynow=iYestClose+Move;
    Slnow=iYestClose-Move;
    Btp=Bynow+Move;
    Stp=Slnow-Move;
    Bsl=Bynow-0.01;
    Ssl=Slnow+0.01;
    Comment("H: ",iYestHigh,"L: ",iYestLow,"C: ",iYestClose,"P: ",Pivot,"R: ",Range,"M: ",Move,"Buy: ",Bynow,"Sell: ",Slnow,"BTP: ",Btp,"STP: ",Stp,"BST: ",Bsl,"SSL: ",Ssl);
    
}



int deinit()
{
    if (false) ObjectsDeleteAll();
    
    
    
    
    
    
}

 
the mq4 editor jumps to the line and the char-column of the error: where is that error?
 

Error message:

[' - array index is to be an integer

error seems to be here. but i couldnt figure out.

    iYestHigh=High[iYestHigh];
    iYestLow=Low[iYestLow];
 
sheriffonline:

Error message:

[' - array index is to be an integer

error seems to be here. but i couldnt figure out.


don't you see ?? is it string, double, integer, color, ........ or is it all together and can we change every tick again
    iYestHigh=High[iYestHigh];   //same name before    same name after
    iYestLow=Low[iYestLow];
 
sheriffonline:

Whats wrong with this code?

I get previous day high/low/close and start calculation.

To get previous day high/low/close i got simple code here. just added some code for previous day low,close and calculations.

when i compile which shows error message

[' - array index is to be an integer

Here is the code i tried:

This says it all . . . "array index is to be an integer"

double iYestHigh = 0;
double iYestLow = 0;

iYestHigh = High[ iYestHigh ];
iYestLow = Low[ iYestLow ];
 

Yes. i set as int.

but how to change as double. bcoz it says single decimal.

when i do calculations it take first decimal point only.

eg:

need to get range. so we use 1.3150-1.3080, but it says only "1". please clear my doubt!

My Code:

//         int ToDaysHighestPrice = iHigh(NULL, PERIOD_D1, 0);
//         int YesterDaysHighestPrice = iHigh(NULL, PERIOD_D1, 1);
datetime today     = iTime(NULL, PERIOD_D1, 0),
         yesterday = iTime(NULL, PERIOD_D1, 1);
int      iToday    = iBarShift(NULL, 0, today),
         iYesterday= iBarShift(NULL, 0, yesterday),
         iTodayHigh= Highest(NULL,0,MODE_HIGH, iToday+1, 0), // or not incl. 0 bar: ..iToday, 1)
         iYestHigh = Highest(NULL,0,MODE_HIGH, iYesterday-iToday, iToday+1),
         iTodayLow= Lowest(NULL,0,MODE_LOW, iToday+1, 0), // or not incl. 0 bar: ..iToday, 1)
         iYestLow = Lowest(NULL,0,MODE_LOW, iYesterday-iToday, iToday+1),
         YestHigh=High[iYestHigh],
         YestLow=Low[iYestLow],
         YestClose=iClose(NULL,PERIOD_D1,1);
Comment("yesterday's high ", YestHigh ,"yesterday's Low ",YestLow ,"Close: ",YestClose);
 
sheriffonline:

Yes. i set as int.

but how to change as double. bcoz it says single decimal.

Use 2 variables, one for the price one for the bar number ( shift ) perhaps YestHighPrice and YestHighShift the first is a double the second is an int
Reason: