//+------------------------------------------------------------------+
//| BrokerComission.mq5 |
//| Copyright 2024, AM2. |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, AM2."
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property indicator_chart_window
input string s="EURUSD";
#include <Trade\PositionInfo.mqh>
CPositionInfo pos;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutLabel(string text)
{
//--- создадим текстовую метку
ObjectCreate(0,"L",OBJ_LABEL,0,0,0);
//--- установим координаты метки
ObjectSetInteger(0,"L",OBJPROP_XDISTANCE,111);
ObjectSetInteger(0,"L",OBJPROP_YDISTANCE,22);
//--- установим угол графика, относительно которого будут определяться координаты точки
ObjectSetInteger(0,"L",OBJPROP_CORNER,2);
//--- установим текст
ObjectSetString(0,"L",OBJPROP_TEXT,text);
//--- установим шрифт текста
ObjectSetString(0,"L",OBJPROP_FONT,"Arial");
//--- установим размер шрифта
ObjectSetInteger(0,"L",OBJPROP_FONTSIZE,12);
//--- установим цвет
ObjectSetInteger(0,"L",OBJPROP_COLOR,Red);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Com()
{
double com=0;
for(int i=PositionsTotal()-1; i>=0; i--)
{
if(PositionSelectByTicket(PositionGetTicket(i)))
{
if(PositionGetString(POSITION_SYMBOL)==_Symbol)
{
com=pos.Commission();
break;
}
}
}
return(com);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
PutLabel("Comission: "+string(Com()));
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Если Андрей не против, могу попробовать написать.
ChartApplyTemplate(0,"ADX.tpl");
Нет настройки второго уровня индикаторавторой считается автоматом 100 -3 0
AM2