# counting max achievable profit

413

Hi guys, I´m building one EA based on MA crosses. This EA uses trailing stops. I want to find out values that would cause profit in majority of cases. I was wondering if we can calculate somehow "max achievable profit" If I open a trade just after 2 MA crosses, what is the max profit I can reach. I would need these values, their average value, modus and median. It can be displayed in chart or in xls file.

Any ideas? thanks

35031

As a rule, ZigZag indicator is used to calculate maximal possible profit. Just take extremums inside your crossings.
41597

marketeer:
As a rule, ZigZag indicator is used to calculate maximal possible profit. Just take extremums inside your crossings.

Why do you need ZigZag for that ? Just calculate the maximum/minimum between 2 crosses.

Something like :

```double getMaximum(datetime firstCross,datetime secondCross)
{
double high[];

if(CopyHigh(_Symbol,_Period,firstCross,seconCross,high)!=-1)
{
int index=ArrayMaximum(high);
if(index!=-1)
return(high[index]);
}
return(-1);
}
```
413

Thank you!
35031

angevoyageur:

Why do you need ZigZag for that ? Just calculate the maximum/minimum between 2 crosses.

Something like :

What your code is supposed to return? Highest high between 2 crosses? This is far from the potential profit inbetween, marked on the screenshot.

ZigZag is a well-known tool for potential profit measurement - this is not my personal invention.

41597

marketeer:

What your code is supposed to return? Highest high between 2 crosses? This is far from the potential profit inbetween, marked on the screenshot.

Really ? Why ?

ZigZag is a well-known tool for potential profit measurement - this is not my personal invention.

Then you can maybe explain how.