/*------------------------v1--------------------------------
Profit Calcualation Ea
By Trader101
Trader101@optonline.net
------------------------------------------------------------
-----------------------------------------------------------*/
#property copyright "Copyright © 2008, Trader101"
#property link "Trader101 @optonline.net"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Silver
#property indicator_color2 Red
#property indicator_width1 2
double profitsell[];
double profitbuy[];
//----------------------------------------------------------------------------------------
int start()
{
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
//SetIndexDrawBegin(0,0);
//SetIndexDrawBegin(1,0);
SetIndexBuffer(0,profitsell);
SetIndexBuffer(1,profitbuy);
IndicatorShortName("PROFIT_CALC");
SetIndexLabel(0,"Profit_sell");
SetIndexLabel(1,"Profit_buy");
int totalorders = OrdersTotal();
for(int n=totalorders-1;n>=0;n--)
{
OrderSelect(n, SELECT_BY_POS);
if ( OrderType()== OP_BUY){
double Profit_b = OrderProfit();
double TotalProfit_b = TotalProfit_b + Profit_b;
}
if ( OrderType()== OP_SELL){
double Profit_s = OrderProfit();
double TotalProfit_s = TotalProfit_s + Profit_s;
}
}
profitsell[0]= TotalProfit_s;
profitbuy[0]= TotalProfit_b;
}
Comments