1. Function oldest long profit and oldest short profit / 2. count profit history buy / sell

MQL4 컨설팅

작업 종료됨

실행 시간 2 분
피고용인의 피드백
Great customer. highly recommended!
고객의 피드백
good Job and fast.

명시


1.

i would like the funkction to integrate it in my EA.

the Profit of the oldest open/pending Long-position

the Profit of the oldest open/pending short-position


something like that (that is for all positions)....:

//+------------------------------------------------------------------+
double countprofitBS(int mode,int order_type)
  {
   double profit=0;
   if(OrdersTotal()>0)
     {
      for(i=OrdersTotal()-1;i>=0;i--)
        {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         if(OrderSymbol()==Symbol() && OrderType()==order_type && OrderMagicNumber()==magic)
           {
            if(mode==0)profit=profit+(OrderClosePrice()-OrderOpenPrice())/pt;
            if(mode==1)profit=profit+OrderProfit()+OrderCommission()+OrderSwap();
           }
        }
     }
   return(profit);
  }


2.

and the function for Count Profit for buy / and sell positions

countprofit sell

Countprofit buy

something simaler like that:

// mode 0 = pips, mode 1 = dollars

double countprofit(int mode)
  {
   double profit=0;
   if(OrdersTotal()>0)
     {
      for(i=OrdersTotal()-1;i>=0;i--)
        {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         if(OrderSymbol()==Symbol() && OrderType()==OP_BUY && OrderMagicNumber()==magic)
           {
            if(mode==0)profit=profit+(OrderClosePrice()-OrderOpenPrice())/pt;
            if(mode==1)profit=profit+OrderProfit()+OrderCommission()+OrderSwap();
           }
         if(OrderSymbol()==Symbol() && OrderType()==OP_SELL && OrderMagicNumber()==magic)
           {
            if(mode==0)profit=profit+(OrderOpenPrice()-OrderClosePrice())/pt;
            if(mode==1)profit=profit+OrderProfit()+OrderCommission()+OrderSwap();
           }
        }
      if(OrdersHistoryTotal()>0)
        {
         for(i=OrdersHistoryTotal()-1;i>=0;i--)
           {
            OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
            if(OrderOpenTime()<timex)break;
            if(OrderSymbol()==Symbol() && OrderType()==OP_BUY && OrderMagicNumber()==magic)
              {
               if(mode==0)profit=profit+(OrderClosePrice()-OrderOpenPrice())/pt;
               if(mode==1)profit=profit+OrderProfit()+OrderCommission()+OrderSwap();
              }
            if(OrderSymbol()==Symbol() && OrderType()==OP_SELL && OrderMagicNumber()==magic)
              {
               if(mode==0)profit=profit+(OrderOpenPrice()-OrderClosePrice())/pt;
               if(mode==1)profit=profit+OrderProfit()+OrderCommission()+OrderSwap();
              }
           }
        }
     }
   return(profit);
  }
  


응답함

1
개발자 1
등급
(213)
프로젝트
246
45%
중재
42
10% / 57%
기한 초과
5
2%
무료
2
개발자 2
등급
(590)
프로젝트
789
71%
중재
9
33% / 33%
기한 초과
22
3%
무료
게재됨: 8 코드
3
개발자 3
등급
(365)
프로젝트
412
36%
중재
35
26% / 57%
기한 초과
63
15%
무료
4
개발자 4
등급
(499)
프로젝트
744
56%
중재
48
31% / 31%
기한 초과
120
16%
무료
게재됨: 1 코드
5
개발자 5
등급
(574)
프로젝트
945
47%
중재
309
58% / 27%
기한 초과
125
13%
무료
6
개발자 6
등급
(94)
프로젝트
148
59%
중재
16
38% / 13%
기한 초과
25
17%
무료
게재됨: 1 코드
7
개발자 7
등급
(885)
프로젝트
1410
67%
중재
123
32% / 41%
기한 초과
217
15%
무료
게재됨: 1 코드
8
개발자 8
등급
(1)
프로젝트
1
0%
중재
0
기한 초과
0
무료
9
개발자 9
등급
(206)
프로젝트
333
35%
중재
66
12% / 58%
기한 초과
87
26%
무료
10
개발자 10
등급
(33)
프로젝트
35
40%
중재
11
9% / 91%
기한 초과
4
11%
무료
게재됨: 4 코드
11
개발자 11
등급
(4)
프로젝트
6
0%
중재
2
0% / 50%
기한 초과
4
67%
무료

프로젝트 정보

예산
30+ USD