profitgraphSELL

Download script
profitgraphSELL

This script serves as a specialized visual monitoring tool designed to track the performance of active "Sell" positions within your trading account. Rather than analyzing market trends or price action, its primary logic is focused on real-time profit/loss tracking for specific trades.

Core Functionality

The tool scans your open trades specifically looking for sell orders. When it identifies these positions, it performs a calculation to determine how much the current market price has moved relative to your entry point.

How the Logic Works:

  • Automated Scanning: Every time the market price updates (a "tick"), the script scans through all of your currently open orders in reverse order.
  • Sell Order Filtering: It specifically identifies orders of the "Sell" type and ignores other types, such as Buys or Pending orders.
  • Dynamic Calculation: For each sell position found, the script calculates the difference between your original opening price and the current market asking price.
  • Point Measurement: This distance is converted into "points" (the smallest unit of price movement in a currency pair). This allows you to see exactly how many pips or points a trade is currently in profit or loss.
  • Visual Output: The script provides up to seven distinct data slots. Each slot corresponds to one of your open sell positions. By mapping these values to the visual display, it allows for a clear, organized overview of the status of multiple concurrent trades at a glance.

In summary, this tool acts as a dedicated dashboard that isolates your sell positions and translates their current market standing into a readable numerical format, helping you monitor the floating profit or loss of up to seven active trades simultaneously.

Orders Execution
Checks for the total of open orders
Miscellaneous
Implements a curve of type %1
6 Views
0 Downloads
0 Favorites
profitgraphSELL
//+-----------+
//| LSMA      |
//+-----------+
#property  copyright "Copyright 2005 Ron Thompson"
#property  link      "http://www.forexmt4.com/"

//---- indicator settings
#property  indicator_separate_window

#property indicator_buffers   7

#property indicator_color1  Red
#property indicator_width1  2
#property indicator_color2  Red
#property indicator_width2  2
#property indicator_color3  Red
#property indicator_width3  2
#property indicator_color4  Red
#property indicator_width4  2
#property indicator_color5  Red
#property indicator_width5  2
#property indicator_color6  Red
#property indicator_width6  2
#property indicator_color7  Red
#property indicator_width7  2


//---- buffers
double B1[];  //Yellow
double B2[];  //Green
double B3[];  //Red
double B4[];  //Blue
double B5[];  //Aqua
double B6[];  //LawnGreen
double B7[];  //Yellow



//+-----------+
//| Init      |
//+-----------+
int init()
  {
   // 233 up arrow
   // 234 down arrow
   // 158 little dot
   // 159 big dot
   // 168 open square
   // 120 box with X

   SetIndexBuffer(0,B1);
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(1,B2);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(2,B3);
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(3,B4);
   SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(4,B5);
   SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(5,B6);
   SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(6,B7);
   SetIndexStyle(6, DRAW_LINE, STYLE_SOLID, 2);



   Print("Init complete");
  }

//+-----------+
//| DE-Init   |
//+-----------+
int deinit()
  {
   Print("DE-Init complete");
  }


//+-----------+
//| Each Tick |
//+-----------+
int start()
  {   
   int ptr=0;
   
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      OrderSelect(i, SELECT_BY_POS);
      if ( OrderType()== OP_SELL) ptr++;
           
      if(ptr==1) {B1[0]=(OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))/MarketInfo(OrderSymbol(),MODE_POINT); SetIndexLabel(0,OrderSymbol());}
      if(ptr==2) {B2[0]=(OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))/MarketInfo(OrderSymbol(),MODE_POINT); SetIndexLabel(1,OrderSymbol());}
      if(ptr==3) {B3[0]=(OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))/MarketInfo(OrderSymbol(),MODE_POINT); SetIndexLabel(2,OrderSymbol());}
      if(ptr==4) {B4[0]=(OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))/MarketInfo(OrderSymbol(),MODE_POINT); SetIndexLabel(3,OrderSymbol());}
      if(ptr==5) {B5[0]=(OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))/MarketInfo(OrderSymbol(),MODE_POINT); SetIndexLabel(4,OrderSymbol());}
      if(ptr==6) {B6[0]=(OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))/MarketInfo(OrderSymbol(),MODE_POINT); SetIndexLabel(5,OrderSymbol());}
      if(ptr==7) {B7[0]=(OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))/MarketInfo(OrderSymbol(),MODE_POINT); SetIndexLabel(6,OrderSymbol());}
      
     }
      
   }//start



Comments