Help me to understand how FrameAdd() work


I'm a bit confused about how frames work.

I know that you can set a custom optimization criteria as follows.

double OnTester()
   return MyCustomCriteria();

The genetic algorithm will search to maximize the value of this criteria.

I'm not sure if frames are used to do the same thing. I mean, if for example I give these values to the FrammeAdd() function.

double OnTester()
   double values[2];  
   values[0] = TesterStatistics(STAT_EXPECTED_PAYOFF); 
   values[1] = TesterStatistics(STAT_SHARPE_RATIO);  
   FrameAdd("MyFrame", 0, 0, values);
   return 0;//--> it must return zero?

The genetic algorithm will search to maximize the expected payoff and the sharpe ratio too?

Or am I completely wrong and the frameAdd() function has a completely different purpose?

OnTester() function should return zero or can it still be used to return another value to maximize?

Thank you very much for your help!!