English

## Problem with an EA

 34 Stan4o1 2015.12.16 00:32   Hi Guys I`m here with a problem again. In my EA I calculate an average level, i named AvgLevel  and i am using it for signals. ```if( Ask > AvgLevel &&  Open[1]
 Moderator3404 GumRai 2015.12.16 00:53 #   Print the value of AvgLevel to make sure that it is being calculated properly. Possibly it equals zero.
 34 Stan4o1 2015.12.16 09:46 #   ```  int HighLevelIndex = iHighest(NULL,0,MODE_HIGH,LevelsPeriodicity,1);   int LowLevelIndex = iLowest (NULL,0,MODE_LOW,LevelsPeriodicity,1);   double HighLevel = High[HighLevelIndex];   double LowLevel = Low[LowLevelIndex];   double AvgLevel = (HighLevel - LowLevel)/2; ```This is how I calculate it. Is it wrong?
 2017 gooly 2015.12.16 10:15 #   Stan4o1: This is how I calculate it. Is it wrong?If you use the debugger you can check yourself!
 34 Stan4o1 2015.12.16 13:32 #   I used it then, it shows everything is ok, but the EA doesn`t trade in the shown case
 Moderator3404 GumRai 2015.12.16 13:35 #   Stan4o1: This is how I calculate it. Is it wrong?If you had printed the result as I advised, you would have found your problem```   double AvgLevel = (HighLevel - LowLevel)/2;``` should be```   double AvgLevel = (HighLevel + LowLevel)/2;``` .
 34 Stan4o1 2015.12.16 13:47 #   Thanks for the help, but how to print the result
 Moderator3404 GumRai 2015.12.16 14:08 #   `Print(DoubleToStr(AvgLevel,Digits));`I find it hard to believe that you can write the code that you have posted, but are unable to code a simple print statement.