Minor Errors When Compiling. Cannot figure them out

 
Hi guys,

I was wondering if you could help me with two issues I am currently having? :)

Here is number 1:

 if(PositionSelect(_Symbol) == false) // We have no open position
      {

      if(MathAbs(PriceDataTable[1] - mAData[1]) < 10 * P)
           {

           if (my conditions to open a trade)
                 {

        (Open a Buy Trade)

For some reason though, I am getting two errors that say 'Illegal
operation in use' and 'parameter conversion not allowed'.

Do you know why this is? It is a rule I am putting in place that
essentially says if the price action gets within 10 pips of the MA
line and meets my other conditions,
it will enter a trade.


Number 2:

I have then created a function at the bottom of my program (right at
the bottom out of the OnTick area). This is what I did:

   int SearchArray()
  {

   if (PositionSelect(_Symbol) == true) // If there is an open position
   {
      ArrayMaximum(PriceDataTable[9], 0, WHOLE_ARRAY);

   }
   return 0;
  }

... but i get the error: 'PriceDataTable' - array required??

Really not sure how to get past these two issues?

Thanking you in advance
 

1° No idea, you need to provide more code, and code that compiles, not pseudo code.

2° Yes an array. PriceDataTable is an array I suppose, PriceDataTable[9] is not an array.

 

are you sure you defined 

double PriceDataTable[]; 
 
ArrayMaximum(PriceDataTable, 0, WHOLE_ARRAY);
 
Ariel Rivas Batista:

are you sure you defined 

double PriceDataTable[]; 
Yes i did define that in the setup of the EA. Thank you for your comment though! 
 
TheForexGamer:
Yes i did define that in the setup of the EA. Thank you for your comment though! 

For the first part, from the few lines of code you disclosed, nobody can answer you what is the trouble with your code

If you don't want to post the entire code, almost sure that you will be left to find the error alone

 
Alain Verleyen:

1° No idea, you need to provide more code, and code that compiles, not pseudo code.

2° Yes an array. PriceDataTable is an array I suppose, PriceDataTable[9] is not an array.

Ah ok i didnt realise. Sure I will do that from now on. Ok i will provide more of the code when i get home and for number 2: 

Ahhh ok i see. I need to take off the [ ]. Why is this though if is the [ ] that shows its an array? And because I am outside of the OnTick area, do i have to redeclare anything?
 
Mladen Rakic:

For the first part, from the few lines of code you disclosed, nobody can answer you what is the trouble with your code

If you don't want to post the entire code, almost sure that you will be left to find the error alone

Oh no i dont mind posting the code, i just didnt want to post anything that wasnt needed and make the post longer than it needed to be. My apologies
 
TheForexGamer:
Ah ok i didnt realise. Sure I will do that from now on. Ok i will provide more of the code when i get home and for number 2: 

Ahhh ok i see. I need to take off the [ ]. Why is this though if is the [ ] that shows its an array? And because I am outside of the OnTick area, do i have to redeclare anything?

Why ? There is no why...it's how it's designed by the language developers.

Please show your code if you need coding help.

 
TheForexGamer:
Oh no i dont mind posting the code, i just didnt want to post anything that wasnt needed and make the post longer than it needed to be. My apologies
I will post more of the code when i get home to my computer. I do appreciate the help!
 
Alain Verleyen:

Why ? There is no why...it's how it's designed by the language developers.

Please show your code if you need coding help.

Just wanted to make sure i understood. Yes i will post the code when i get home today. Thanks again
Reason: