109 lines
4.1 KiB
MQL5
109 lines
4.1 KiB
MQL5
|
//+------------------------------------------------------------------+
|
||
|
//| Trade-Buy.mq5 |
|
||
|
//| Thorsten Fischer Copyright 2020 |
|
||
|
//| https://mql5.tfsystem.de |
|
||
|
//+------------------------------------------------------------------+
|
||
|
#property copyright "Thorsten Fischer Copyright 2020"
|
||
|
#property link "https://mql5.tfsystem.de"
|
||
|
#property version "1.00"
|
||
|
#include <Trade\SymbolInfo.mqh>
|
||
|
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| Expert initialization function |
|
||
|
//+------------------------------------------------------------------+
|
||
|
int OnInit()
|
||
|
{
|
||
|
//---
|
||
|
CSymbolInfo sym;
|
||
|
MqlTradeRequest m_request;
|
||
|
MqlTradeResult m_result;
|
||
|
ZeroMemory(m_request);
|
||
|
ZeroMemory(m_result);
|
||
|
//---
|
||
|
Print("Start");
|
||
|
m_request.action=TRADE_ACTION_PENDING;
|
||
|
Print("action = "+(string)m_request.action);
|
||
|
//m_request.comment="Test Trade";
|
||
|
//Print("comment = "+(string)m_request.comment);
|
||
|
//m_request.deviation=10;
|
||
|
//Print("deviation = "+(string)m_request.deviation);
|
||
|
//m_request.expiration=0;
|
||
|
//Print("expiration = "+(string)m_request.expiration);
|
||
|
//m_request.magic;
|
||
|
//Print("magic = "+(string)m_request.magic);
|
||
|
//m_request.order=22;
|
||
|
// Print("order = "+(string)m_request.order);
|
||
|
//m_request.position;
|
||
|
// Print("position = "+(string)m_request.position);
|
||
|
//m_request.position_by;
|
||
|
//Print("position_by = "+(string)m_request.position_by);
|
||
|
//m_request.price;
|
||
|
//Print("price = "+(string)m_request.price);
|
||
|
//m_request.sl;
|
||
|
//Print("sl = "+(string)m_request.sl);
|
||
|
//m_request.stoplimit;
|
||
|
//Print("stoplimit = "+(string)m_request.stoplimit);
|
||
|
m_request.symbol=Symbol();
|
||
|
Print("symbol = "+(string)m_request.symbol);
|
||
|
//m_request.tp;
|
||
|
//Print("tp = "+(string)m_request.tp);
|
||
|
m_request.type=ORDER_TYPE_BUY;
|
||
|
Print("type = "+(string)m_request.type); // Durch Standard 0 auf ORDER_TYPE_BUY gesetzt
|
||
|
m_request.type_filling=ORDER_FILLING_FOK;
|
||
|
Print("type_filling = "+(string)m_request.type_filling); // Durch Standart 0 auf ORDER_FILLING_FOK gesetzt
|
||
|
//m_request.type_time;
|
||
|
//Print("type_time = "+(string)m_request.type_time);
|
||
|
m_request.volume=0.01;
|
||
|
Print("volume = "+(string)m_request.volume);
|
||
|
if(OrderSend(m_request, m_result))
|
||
|
Print("True OrderSend");
|
||
|
else
|
||
|
Print("False OrderSend");
|
||
|
Print("Ende "+(string)m_result.retcode+" = "+m_result.comment);
|
||
|
//---
|
||
|
return(INIT_SUCCEEDED);
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| Expert deinitialization function |
|
||
|
//+------------------------------------------------------------------+
|
||
|
void OnDeinit(const int reason)
|
||
|
{
|
||
|
//---
|
||
|
Print("OnDeinit");
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| Expert tick function |
|
||
|
//+------------------------------------------------------------------+
|
||
|
void OnTick()
|
||
|
{
|
||
|
//---
|
||
|
//Print("OnTick");
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| |
|
||
|
//+------------------------------------------------------------------+
|
||
|
void OnTrade(void)
|
||
|
{
|
||
|
//---
|
||
|
Print("OnTrade");
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| |
|
||
|
//+------------------------------------------------------------------+
|
||
|
void OnTradeTransaction(const MqlTradeTransaction& trans,
|
||
|
const MqlTradeRequest& request,
|
||
|
const MqlTradeResult& result)
|
||
|
{
|
||
|
//---
|
||
|
Print("OnTradeTransaction");
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| |
|
||
|
//+------------------------------------------------------------------+
|
||
|
void OnBookEvent(const string& symbol)
|
||
|
{
|
||
|
//---
|
||
|
Print("OnBookEvent");
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|