informindicatorML8_v1

Author: MOLET
0 Views
0 Downloads
0 Favorites
informindicatorML8_v1
//+------------------------------------------------------------------+
//|                                           informindicatorML8.mq4 |
//|                                                            MOLET |
//|                                    icq 459027664; possol@meta.ua |
//+------------------------------------------------------------------+
#property copyright "MOLET"
#property link      "icq 459027664; possol@meta.ua"

#property indicator_chart_window
extern int posorder=0;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   ObjectCreate("TP",OBJ_LABEL,0,0,0);
   ObjectSet("TP",OBJPROP_XDISTANCE,750);
   ObjectSet("TP",OBJPROP_YDISTANCE,250);
   ObjectCreate("SL",OBJ_LABEL,0,0,0);
   ObjectSet("SL",OBJPROP_XDISTANCE,750);
   ObjectSet("SL",OBJPROP_YDISTANCE,350);
   ObjectSetText("TP","0",50,"Times New Roman",Green);
   ObjectSetText("SL","0",50,"Times New Roman",Red);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectDelete("SL");
   ObjectDelete("TP");
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {

     {
      if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES)==false)
        {
         ObjectSetText("TP","0",50,"Times New Roman",Green);
         ObjectSetText("SL","0",50,"Times New Roman",Red);
        }
     }


//--------------------  

     {
      if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES))
         if(OrderStopLoss()>0)
            if(OrderTakeProfit()>0)
               if(OrderType()==OP_SELL)
                 {
                  ObjectSetText("TP",DoubleToStr((Ask-OrderTakeProfit())/Point,0),50,"Times New Roman",Green);
                  ObjectSetText("SL",DoubleToStr((OrderStopLoss()-Ask)/Point,0),50,"Times New Roman",Red);
                 }
     }

     {
      if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES))
         if(OrderStopLoss()>0)
            if(OrderTakeProfit()>0)
               if(OrderType()==OP_BUY)
                 {
                  ObjectSetText("TP",DoubleToStr((OrderTakeProfit()-Bid)/Point,0),50,"Times New Roman",Green);
                  ObjectSetText("SL",DoubleToStr((Bid-OrderStopLoss())/Point,0),50,"Times New Roman",Red);
                 }
     }

//--------------------

     {
      if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES))
         if(OrderStopLoss()>0)
            if(OrderTakeProfit()==0)
               if(OrderType()==OP_SELL)
                 {
                  ObjectSetText("TP","0",50,"Times New Roman",Green);
                  ObjectSetText("SL",DoubleToStr((OrderStopLoss()-Ask)/Point,0),50,"Times New Roman",Red);
                 }
     }

     {
      if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES))
         if(OrderStopLoss()>0)
            if(OrderTakeProfit()==0)
               if(OrderType()==OP_BUY)
                 {
                  ObjectSetText("TP","0",50,"Times New Roman",Green);
                  ObjectSetText("SL",DoubleToStr((Bid-OrderStopLoss())/Point,0),50,"Times New Roman",Red);
                 }
     }

//--------------------   

     {
      if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES))
         if(OrderStopLoss()==0)
            if(OrderTakeProfit()>0)
               if(OrderType()==OP_SELL)
                 {
                  ObjectSetText("TP",DoubleToStr((Ask-OrderTakeProfit())/Point,0),50,"Times New Roman",Green);
                  ObjectSetText("SL","0",50,"Times New Roman",Red);
                 }
     }

     {
      if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES))
         if(OrderStopLoss()==0)
            if(OrderTakeProfit()>0)
               if(OrderType()==OP_BUY)
                 {
                  ObjectSetText("TP",DoubleToStr((OrderTakeProfit()-Bid)/Point,0),50,"Times New Roman",Green);
                  ObjectSetText("SL","0",50,"Times New Roman",Red);
                 }
     }

//--------------------  

     {
      if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES))
         if(OrderStopLoss()==0)
            if(OrderTakeProfit()==0)
              {
               ObjectSetText("TP","0",50,"Times New Roman",Green);
               ObjectSetText("SL","0",50,"Times New Roman",Red);
              }
     }

   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 ---