UnknownInnocent / Publications
Forum
mt5 initialization of expert failed with code 0
Hello, when I try to add an expert to my mt5 I always get this error: mt5 initialization of expert failed with code 0 (prepare to execution failed) First I thought it was because of my Implementation but this even happens when using a Metaquotes-example. What does this error mean
How to embed python in mql5?
Hello, I have a complete python- project that calculates signals for a history of data. For simplicity lets say I have a class like that: class PythonSignal: def next(self, price_data) -> int : signal = ... # do some calculation on my state and the specified data
how to get ORDER_FILLING_MODE from symbol_info
Hello, I tried to get the ORDER_FILLING_MODE from symbol_info: symbol_info_dict = mt5.symbol_info(symbol)._asdict() mode = symbol_info_dict['filling_mode'] This gives me 2 as result and if I got it correct it is like this: 0 = ORDER_FILLING_FOK 1 = ORDER_FILLING_IOC 2 = ORDER_FILLING_RETURN but if I
Getting retcode TRADE_RETCODE_INVALID_STOPS when sending request
Hello, I am trying to send a buy request using the metatrader python libary: import time import MetaTrader5 as mt LOGIN = ... PASSWORD = ... SERVER = "ICMarketsSC-Demo" symbol = 'BTCUSD' lot_size = 0.1 if not mt.initialize(login=LOGIN, password=PASSWORD, server=SERVER): print("initialize()
onChartEvent: only listen to mouseclick if mouse isn't dragged
Hello, in my expert I listen for mouseclicks on the chart with if (id == CHARTEVENT_CLICK ) Now what I want is that I only get inside the if, if I really get a mouseclick. Now I also get inside the if when dragging the mouse to scroll for example. How can I avoid that
How to save and load a MqlRate
Hello, what is the easiest way of saving and loading a MqlRate? The code below is to give an idea, what my goal is. MqlRates rate; ... FileWrite (file_handle, ???rate??? ); MqlRates rate = load(); MqlRates load() { string line = FileReadString (file_handle); MqlRates result =
Save and Load data
Hello, In my Expert I have this list: CArrayList<ClickDatapoint *> *clickData; ClickDatapoint has these for us relevant funtions: ClickDatapoint::ClickDatapoint( const MqlRates &price_data, const CLICK_TYPE &click_type) { priceData = price_data; ArrayResize (clickType, 1 ); clickType[ 0 ] =
Find clicked MqlRate
Hello, I want to use the click-event to select a candlestick. To find this specific Candlestick I have following code: void OnChartEvent ( const int id, const long &lparam, const double &dparam, const string &sparam){ if (id == CHARTEVENT_CLICK ) { int x = ( int ) lparam; int y = (
How to fix error "objects are passed by reference only"
Hello, I have the following piece of code: struct clickDatapoint { datetime time; int x; int y; CLICK_TYPE click_type; }; datetime minimum(List<clickDatapoint> &data) { datetime res = data.get( 0 ).time; for ( unsigned int i = 1 ; i < ( unsigned int )data.size(); ++i) { if