Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL5 (http://www.expert-advisor.com/forum/forumdisplay.php?f=221)
-   -   Seperates Panel um Werte anzeigen zu lassen? (http://www.expert-advisor.com/forum/showthread.php?t=4466)

lolly 12.09.15 20:04

Seperates Panel um Werte anzeigen zu lassen?
 
Ich habe mir mal zur verdeutlichen wie man ein Panel aufbaut "Simple Display Panel" geladen und nur ein klein wenig verändert.

Das ganze sieht dann so aus:

https://picload.org/image/proalad/mypanel_1.png

Wenn ich aber "#property indicator_separate_window" mit in den Code nehme weil ich das ganz in einem Seperatem Fenster haben möchte, sieht das ganze dann so aus.

https://picload.org/image/proalao/mypanel_2.png

Was mache ich da falsch bzw. was muss ich beachten?

Code:

//+------------------------------------------------------------------+
//|                                      MyPanel.mq5 |
//|                                      http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015"
#property link      "http://www.mql5.com"
#property version  "1.00"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_plots  1

//+------------------------------------------------------------------+
//| Includes                                                        |
//+------------------------------------------------------------------+
#include <Controls\Dialog.mqh>
#include <Controls\Label.mqh>
#include <Controls\Panel.mqh>

//+------------------------------------------------------------------+
//| Global parameters                                                |
//+------------------------------------------------------------------+
int      panelXX    =  10;
int      panelYY    =  10;
int      panelWidth  =  500;
int      panelHeight =  300;

//+------------------------------------------------------------------+
//| Global variabels                                                |
//+------------------------------------------------------------------+
//--- Panel itself
CAppDialog m_panel;
//--- Bid objects
CPanel m_bidcolor;
CLabel m_bidlabel;
//--- Ask objects
//CPanel m_askcolor;
CLabel m_asklabel;
//--- Spread objects
//CPanel m_spreadcolor;
CLabel m_spreadlabel;

//+------------------------------------------------------------------+
//| On Init                                                          |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- Panel create
  m_panel.Create(0,"MyPanel - 1.00",0,panelXX,panelYY,panelWidth,panelHeight);
//--- Bid label and colors
  m_bidcolor.Create(0,"Bid Background Color",0,1,1,panelWidth-30,30);
  m_bidcolor.ColorBackground(clrDarkKhaki);
  m_panel.Add(m_bidcolor);
  m_bidlabel.Create(0,"Bid Text",0,5,5,0,0);
  m_bidlabel.Text("Bid: "+DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits));
  m_bidlabel.Color(clrBlack);
  m_panel.Add(m_bidlabel);
//--- Ask label and colors
//  m_askcolor.Create(0,"Ask Background Color",0,1,60,panelWidth-30,30);
//  m_askcolor.ColorBackground(clrAqua);
//  m_panel.Add(m_askcolor);
  m_asklabel.Create(0,"Ask Text",0,100,5,0,0);
  m_asklabel.Text("Ask: "+DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits));
  m_asklabel.Color(clrBlack);
  m_panel.Add(m_asklabel);
//--- Spread label and colors
//  m_spreadcolor.Create(0,"Spread Background Color",0,1,201,panelWidth-30,230);
//  m_spreadcolor.ColorBackground(clrDarkKhaki);
//  m_panel.Add(m_spreadcolor);
  m_spreadlabel.Create(0,"Spread Text",0,200,5,0,0);
  m_spreadlabel.Text("Spread: "+IntegerToString(SymbolInfoInteger(_Symbol,SYMBOL_SPREAD)));
  m_spreadlabel.Color(clrBlack);
  m_panel.Add(m_spreadlabel);
//--- Run panel
  m_panel.Run();
  return(0);
  }

//+------------------------------------------------------------------+
//| On DeInit                                                        |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- Destroy panel
  m_panel.Destroy(reason);
//--- Delete all objects
  ObjectsDeleteAll(0,0);
  }

//+------------------------------------------------------------------+
//| On Calculate                                                    |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
//--- A very simples bid label
  m_bidlabel.Text("Bid: "+DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits));
//--- A very simples ask label
  m_asklabel.Text("Ask: "+DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits));
//--- A very simples Spread label
  m_spreadlabel.Text("Spread: "+IntegerToString(SymbolInfoInteger(_Symbol,SYMBOL_SPREAD)));

  return(rates_total);
  }

//+------------------------------------------------------------------+
//| Chart event handler                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//--- Move the panel with the mouse
  m_panel.ChartEvent(id,lparam,dparam,sparam);
//---
  }
//+------------------------------------------------------------------+



Alle Zeitangaben in WEZ +2. Es ist jetzt 22:10 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum