Soooo endlich n Graph!
Code:
//+------------------------------------------------------------------+
//| GUITest.mq5 |
//| Manuel Simon |
//| https://www.mql5.com/de/users/aleksi-trader |
//+------------------------------------------------------------------+
#property copyright "Manuel Simon"
#property link "https://www.mql5.com/de/users/aleksi-trader"
#property version "1.00"
#include <EasyAndFastGUI\WndCreate.mqh>
ulong magic=123;
double x_norm[];//time
double y_norm[];//test
double y_norm2[];//test
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
class CProgram: public CWndCreate
{
private:
CWindow m_window;
CGraph m_graph1;
public:
void CreateGui()
{
CWndCreate::CreateWindow(m_window,"Test",20,20,800,600);
CreateGraph1(2,50);
CWndEvents::CompletedGUI();
}
void OnTimerEvent()
{
CWndEvents::OnTimerEvent();
}
void OnInitEvent()
{
}
void OnTickEvent()
{
}
void InitArrays()
{
int arraysize= 3;//HistoryDealsTotal();
ArrayResize(x_norm,arraysize);
ArrayResize(y_norm,arraysize);
ArrayResize(y_norm2,arraysize);
x_norm[0]=(double)TimeCurrent(); //Zeitachse Value
y_norm[0]=1000; // testachse1 value
y_norm2[0]=1067; // testachse1 value
}
bool CreateGraph1(int x_gap,int y_gap)
{
m_graph1.MainPointer(m_window);
InitArrays();
m_graph1.AutoXResizeMode(true);
m_graph1.AutoXResizeRightOffset(2);
if(!m_graph1.CreateGraph(x_gap,y_gap))
return(false);
CGraphic *graph=m_graph1.GetGraphicPointer();
graph.BackgroundColor(::ColorToARGB(clrWhiteSmoke));
CAxis *x_axis=graph.XAxis();
x_axis.AutoScale(true);
x_axis.Type(AXIS_TYPE_CUSTOM);
x_axis.ValuesFunctionFormat(TimeFormat);
CCurve *curve1=graph.CurveAdd(y_norm,::ColorToARGB(clrCornflowerBlue),CURVE_LINES,"test achse1");
CCurve *curve2=graph.CurveAdd(y_norm2,::ColorToARGB(clrRed),CURVE_LINES,"test achse2");
x_axis.DefaultStep(10);
graph.CurvePlotAll();
graph.Update(true);
CWndContainer::AddToElementsArray(0,m_graph1);
return(true);
}
};
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
string TimeFormat(double x,void *cbdata)
{
return(TimeToString((datetime)x_norm[ArraySize(x_norm)-(int)x-1]));
}
CProgram Program;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
Program.CreateGui();
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
Program.OnTickEvent();
}
//+------------------------------------------------------------------+
//| TradeTransaction function |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction& trans,
const MqlTradeRequest& request,
const MqlTradeResult& result)
{
//---
}
//+------------------------------------------------------------------+
Jetzt ist nur noch die Fage wie ich meine Historischen Daten da rein bekomme.
Hätte jemand eine Idee?