Adding comment to a position, then try to call that specific position by its comment to count its profit or loss and close it - page 3

 
king64:

I am a newbie, that's it! What's the problem in this code I really don't know. 😐🙁

Please, when you quote somebody, place your reply outside of the quote box. I have edited your post to move your reply.

 
king64:

I am a newbie, that's it! What's the problem in this code I really don't know. 😐🙁

Your style is all over the place. There is no consistency to the indentation and brace placement. You really need to read a C++ style guide and pick an indentation style and stick to it! 

 
Ok sure, I will do that, I didn't know anything about it thank you. 
But my problem is not with indentation and place of braces for now
 
king64: Ok sure, I will do that, I didn't know anything about it thank you. But my problem is not with indentation and place of braces for now
Yes, but good styling helps see the code more clearly and logically, helping you identify problematic areas and identify logic that is incorrect.
 
Ok guys I am so sorry for that and I will improve it thanks a lot for your mention, but for God's sake let's get back to my code and find the way to do that correctly, I am really appreciated 🙏🙏🙏  
 
king64:
Ok guys I am so sorry for that and I will improve it thanks a lot for your mention, but for God's sake let's get back to my code and find the way to do that correctly, I am really appreciated 🙏🙏🙏  

You will find that if you continue to post poorly formatted and difficult to parse code that those in a position to help you will ignore you. 

 
nicholi shen:

You will find that if you continue to post poorly formatted and difficult to parse code that those in a position to help you will ignore you. 

the reason is that I really didn't know how to do that and how much this is important, just like my poor coding. I try my best to do it and learn it quickly.

//+------------------------------------------------------------------+
//|B1 profit calculator Function                                 |
//+------------------------------------------------------------------+
double B1profit(void){

  CPositionInfo pi;
      CTrade trade;
         double B1Prf=0;
            int i,j;
 
        for(i=0;i<CROSS_NUMBER;i++) {
            for(j=0;j<MAX_LEVEL;j++){
                  if(pi.SelectByTicket(baseTickets[i][j])&&pi.Comment()=="B1"&&pi.PositionType()==POSITION_TYPE_BUY)
                                    {B1Prf += pi.Profit();//+PositionGetDouble(POSITION_SWAP); //*********//commision is omited 
                                    }
                                    }
                                    }
  return B1Prf;

                     }


 

 
I'm out.
 
king64:

the reason is that I really didn't know how to do that and how much this is important, just like my poor coding. I try my best to do it and learn it quickly.


 

Just use the styler (press ctrl + ,) and the styling is done automatically
 
Amir Yacoby:
Just use the styler (press ctrl + ,) and the styling is done automatically
Thanks bro :)
Reason: