EA close only if i'm in gain

 

Hola

i want to close my position only if i'm in gain is this possible?

where i wrong?


for(cnt=0;cnt<total;cnt++)
     {
      //Seleziono quell'ordine
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELL &&   // check for opened position
         OrderSymbol()==Symbol())  // check for symbol
        {
          if(OrderType()==OP_BUY)   // long position is opened
           {
            if(OrderProfit() > 0,64$
             {
               if ( ... = true)
                   {
                   priceclose=OrderOpenClose;
                   OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
                   lastgainl=OrderProfit();
                   lastclodeprice=OrderClosePrice();
         //close my position

There is any Onlineinformation when i use a parameter like Help or other thing in metaeditor maybe push F12 and i can see the info about parameter like other debugger on C compilator?

Question:

-Is possible to have the gain in pip?like 50 pip and not in $?

-How i close the position only is in gain?

-Why if i print in comment "lastclosedprice" i can't see nothing?

Part 2

I want to take a long/short only just prime on current time frame break 40 EMA

And if cross the price don't close so far like max 10/12 pip if not i put a limit order at moving avrege price

if(long==0 &&  LastClosedBar != Time[0]  && Ask >= MA_40  && minprevius <= MA_40 && maxprevius >= MA_40)
// so entry long is right???
Thanks for Help

Reason: