Results 1 to 3 of 3
 0 Attachment(s)    

Thread: Adjusting pip profit

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    9

    Default Adjusting pip profit

    re: adjusting pip profit

    From this

    Code:
    double countprofit(int mode){
       double profit=0;
       if(OrdersTotal()>0){
          for(int 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())/SymPoints;
                if(mode==1)profit=profit+OrderProfit();
             }
             if(OrderSymbol()==Symbol() && OrderType()==OP_SELL && OrderMagicNumber()==Magic){
                if(mode==0)profit=profit+(OrderOpenPrice()-OrderClosePrice())/SymPoints;
                if(mode==1)profit=profit+OrderProfit();
             }
          }
          return(profit);
       }
    }
    to this ....... is it correct?

    Code:
    double countprofit2(int mode){
    
       double profit=0;
       double commissionlocal=0;
       if(OrdersTotal()>0){
          for(int ia=OrdersTotal()-1;ia>=0;ia--){
             OrderSelect(  ia,SELECT_BY_POS,MODE_TRADES);
             if(OrderSymbol()==Symbol() && OrderType()==OP_BUY && OrderMagicNumber()==Magic){
                if(mode==0)commissionlocal=commissionlocal+(OrderCommission())/SymPoints;
             }
             if(OrderSymbol()==Symbol() && OrderType()==OP_SELL && OrderMagicNumber()==Magic){
                if(mode==0)commissionlocal=commissionlocal+(OrderCommission())/SymPoints;
             }
          }   
          for(int 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())/SymPoints;
                if(mode==1)profit=profit+OrderProfit() - OrderCommission();
             }
             if(OrderSymbol()==Symbol() && OrderType()==OP_SELL && OrderMagicNumber()==Magic){
                if(mode==0)profit=profit+(OrderOpenPrice()-OrderClosePrice())/SymPoints;
                if(mode==1)profit=profit+OrderProfit() - OrderCommission();
             }
          }
          return(profit - commissionlocal);
       }
    }

  2. #2
    Junior Member
    Join Date
    Aug 2009
    Posts
    9

    Default

    yeah OrderCommission is used in the strategy tester - but is not visible , it seems


    profitorig+=OrderProfit()-OrderCommission();
    gives
    59.51 + 7.37 = 66.88 WRONG

    profitorig+=(OrderProfit()-OrderCommission());
    gives
    59.51 + 7.37 = 66.88 WRONG

    profitorig+= MathAbs ( OrderProfit()-OrderCommission() );
    gives
    59.51 + 7.37 = 66.88 WRONG

    profitorig+= (OrderProfit()-MathAbs (OrderCommission()));
    gives
    59.51 -7.37 = 52.14 CORRECT
    Last edited by netk; 02-12-2013 at 10:24.

  3. #3
    Junior Member
    Join Date
    Jun 2013
    Posts
    12

    Default

    good script..i need it..thanks

Similar Threads

  1. Replies: 6
    Last Post: 02-18-2016, 21:12
  2. My more than 100% profit in 9 days
    By timidave in forum Manual systems statements
    Replies: 11
    Last Post: 12-15-2012, 22:19
  3. EA źNetwork For Profit╗.
    By NetworkFP in forum Commercial expert advisors
    Replies: 19
    Last Post: 08-24-2012, 19:35
  4. Fx Profit EA
    By bnbb2004 in forum Ideas for expert advisors
    Replies: 8
    Last Post: 05-18-2012, 20:23

Tags for this Thread

profit, strategy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •