StatMonitor_1.1-Phat-4&5digits

Author: Lowphat � 2006
StatMonitor_1.1-Phat-4&5digits

This script, named "SwapMon," is designed to display real-time trading information for a specific currency pair directly on a separate chart window.

Here's how it works:

  1. Initialization: When the script starts, it gives the chart window a specific title showing the monitored currency pair.

  2. Data Gathering: The script constantly retrieves key information about the current currency pair:

    • Spread: The difference between the buying and selling price.
    • Swap (Long & Short): The interest rate either paid or charged for holding a position overnight (separately for buying (long) and selling (short)).
    • Volume: The amount of trading activity.
  3. Displaying the Information: The script then creates a series of text labels within the special chart window to show this data. These labels are positioned at the top-left corner of the window and are placed horizontally. Each label displays a specific piece of information:

    • Labels are created to display the current spread, buy swap, sell swap, and volume.

    • The script labels the type of data being displayed (e.g., "Current Spread," "Buy Swap").

    • The script displays the calculated or retrieved values for each of these data points next to their labels.

    • The "Buy Swap" and "Sell Swap" values are displayed in green if they are positive numbers (meaning the trader gets paid), and in red if they are negative numbers (meaning the trader is charged).

The overall effect is to give the trader a clear, real-time display of key trading statistics within a separate window on their trading platform.

2 Views
0 Downloads
0 Favorites
StatMonitor_1.1-Phat-4&5digits
//+------------------------------------------------------------------+
//|                                                     SwapMon      |
//|                                                   Lowphat © 2006 |
//+------------------------------------------------------------------+
#property copyright "Lowphat © 2006"
#property link      "mystikvgv@yahoo.com (mail only)"
#property indicator_separate_window

double    swaplong,swapshort;
int Vol;
double spread;
int init(){
IndicatorShortName("Stat Monitor ("+Symbol()+")");

return(0);}
int deinit(){return(0);}

int start()
  {
spread=MarketInfo(Symbol(),13);
swaplong=NormalizeDouble(MarketInfo(Symbol(),18),2);
swapshort=NormalizeDouble(MarketInfo(Symbol(),19),2);
Vol=Volume[0];
spread=spread/10;
        ObjectCreate("Stat Monitor1", OBJ_LABEL, WindowFind("Stat Monitor ("+Symbol()+")"), 0, 0);
        ObjectSetText("Stat Monitor1","Current Spread:", 10, "Arial Bold", CadetBlue);
        ObjectSet("Stat Monitor1", OBJPROP_CORNER, 0);
        ObjectSet("Stat Monitor1", OBJPROP_XDISTANCE, 150);
        ObjectSet("Stat Monitor1", OBJPROP_YDISTANCE, 2);
        
        ObjectCreate("Stat Monitor2", OBJ_LABEL, WindowFind("Stat Monitor ("+Symbol()+")"), 0, 0);
        ObjectSetText("Stat Monitor2",DoubleToStr(spread ,1),10, "Arial Bold", Lime);
        ObjectSet("Stat Monitor2", OBJPROP_CORNER, 0);
        ObjectSet("Stat Monitor2", OBJPROP_XDISTANCE, 260);
        ObjectSet("Stat Monitor2", OBJPROP_YDISTANCE, 2);
        
        ObjectCreate("Stat Monitor3", OBJ_LABEL, WindowFind("Stat Monitor ("+Symbol()+")"), 0, 0);
        ObjectSetText("Stat Monitor3","Buy Swap:", 10, "Arial Bold", CadetBlue);
        ObjectSet("Stat Monitor3", OBJPROP_CORNER, 0);
        ObjectSet("Stat Monitor3", OBJPROP_XDISTANCE, 350);
        ObjectSet("Stat Monitor3", OBJPROP_YDISTANCE, 2);
        
        ObjectCreate("Stat Monitor4", OBJ_LABEL, WindowFind("Stat Monitor ("+Symbol()+")"), 0, 0);
        if (swaplong>0)
        {
        ObjectSetText("Stat Monitor4",DoubleToStr( swaplong ,2),10, "Arial Bold", Lime);
        }
        else ObjectSetText("Stat Monitor4",DoubleToStr( swaplong ,2),10, "Arial Bold", Red);
        ObjectSet("Stat Monitor4", OBJPROP_CORNER, 0);
        ObjectSet("Stat Monitor4", OBJPROP_XDISTANCE, 430);
        ObjectSet("Stat Monitor4", OBJPROP_YDISTANCE, 2);
        
        ObjectCreate("Stat Monitor5", OBJ_LABEL, WindowFind("Stat Monitor ("+Symbol()+")"), 0, 0);
        ObjectSetText("Stat Monitor5","Sell Swap:", 10, "Arial Bold", CadetBlue);
        ObjectSet("Stat Monitor5", OBJPROP_CORNER, 0);
        ObjectSet("Stat Monitor5", OBJPROP_XDISTANCE, 530);
        ObjectSet("Stat Monitor5", OBJPROP_YDISTANCE, 2);
        
        ObjectCreate("Stat Monitor6", OBJ_LABEL, WindowFind("Stat Monitor ("+Symbol()+")"), 0, 0);
        if (swapshort>0)
        {
        ObjectSetText("Stat Monitor6",DoubleToStr( swapshort ,2),10, "Arial Bold", Lime);
        }
        else ObjectSetText("Stat Monitor6",DoubleToStr( swapshort ,2),10, "Arial Bold", Red);
        ObjectSet("Stat Monitor6", OBJPROP_CORNER, 0);
        ObjectSet("Stat Monitor6", OBJPROP_XDISTANCE, 610);
        ObjectSet("Stat Monitor6", OBJPROP_YDISTANCE, 2);
        
        ObjectCreate("Stat Monitor7", OBJ_LABEL, WindowFind("Stat Monitor ("+Symbol()+")"), 0, 0);
        ObjectSetText("Stat Monitor7","Volume:", 10, "Arial Bold", CadetBlue);
        ObjectSet("Stat Monitor7", OBJPROP_CORNER, 0);
        ObjectSet("Stat Monitor7", OBJPROP_XDISTANCE, 700);
        ObjectSet("Stat Monitor7", OBJPROP_YDISTANCE, 2);
        
        ObjectCreate("Stat Monitor8", OBJ_LABEL, WindowFind("Stat Monitor ("+Symbol()+")"), 0, 0);
        ObjectSetText("Stat Monitor8",DoubleToStr(Vol ,0),10, "Arial Bold", Lime);
        ObjectSet("Stat Monitor8", OBJPROP_CORNER, 0);
        ObjectSet("Stat Monitor8", OBJPROP_XDISTANCE, 760);
        ObjectSet("Stat Monitor8", OBJPROP_YDISTANCE, 2);

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