close_orders_in_profits

Author: 5.00 USD Free No-Deposit Bonus
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself
Miscellaneous
It issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
close_orders_in_profits
ÿþ#property copyright " 5.00 USD Free No-Deposit Bonus"

#property link      "https://agea.trading/?=51115"

#property strict

double harvester_pips ;

//+------------------------------------------------------------------+

//| to close some of the orders which has profits over certain pips  

//|      |

//+------------------------------------------------------------------+

int start()

 

 

{

    for(int k=OrdersTotal()-1;k>=0;k--)

   {

      if(!OrderSelect(k,SELECT_BY_POS,MODE_TRADES))

         continue;

      if(OrderSymbol()!=Symbol())

         continue; 

       

          

      if(OrderType()==OP_BUY &&  (((MarketInfo(Symbol(),MODE_BID) -   OrderOpenPrice()) /Point/10))>  harvester_pips )  

        {



      bool orderclose_long  = OrderClose(OrderTicket(),OrderLots(),Bid, 3);

      

      if ( orderclose_long==true)

         {

          Alert("Collected USD:",OrderProfit()-OrderCommission(),",Pips:", (((MarketInfo(Symbol(),MODE_BID) -   OrderOpenPrice()) /Point/10)) );

         }

      

    // Alert(OrderProfit()-OrderCommission());

    // Alert(OrderTicket(),"---", (((MarketInfo(Symbol(),MODE_ASK) -   OrderOpenPrice()) /Point/10)) );

        }

      

      

      

      if(OrderType()==OP_SELL  && ((( OrderOpenPrice()  -  (MarketInfo(Symbol(),MODE_ASK)  ))/Point/10))> harvester_pips )   

        {

       int orderclose_short = OrderClose(OrderTicket(),OrderLots(),Ask, 3); 

       

          if (orderclose_short==true)

            {

             Alert("Collected USD:",OrderProfit()-OrderCommission(),",Pips", ((( OrderOpenPrice()  -  (MarketInfo(Symbol(),MODE_ASK)  ))/Point/10)) );

            }

        }

           

}

  

 

 

   return(0);

  }

//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---