MQL4 - automated forex trading   /  

Forum

Login | Register | Language: ru cn en
DOWNLOAD THE NEW METATRADER 5 ANDROID WITH THE DEPTH OF MARKET AND NEWSDOWNLOAD THE NEW METATRADER 5 ANDROID WITH THE DEPTH OF MARKET AND NEWS

Maximum Profit, How to Code it?

Back to topics list To post a new topic, please log in or register
avatar
11
nugienos 2009.10.21 09:48
 

I have an Idea about maximizing profit, but i have some trouble to coded it...


Here is the Idea :

If we have open position (even martiangle), and already reach 50 pips profit, then we loop the max profit.

Close the position if the profit is fall 50% from its max profit.


Here is the code I've tried : (still can't work as the idea goals)


extern double Profit = 500;

double MaxProfit ( )

{

double Profits = CalculateProfits( ); // it counts the sum of profit all open position

double maxprofit;

if(Profits > Profit)

{

while(Profit <= Profits)

{

if(maxprofit > Profit)

maxprofit = Profits;

Profit++;

}

}

return(maxprofit);

}


 
Back to topics list  

To add comments, please log in or register