-
Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
Messages Editor -
We have no idea which line is 55, since you didn't use code button, everything is double spaced.
-
You haven't specified how many buffers you're going to have, nor created them. Nothing to display.
-
EMA_High = iMA(NULL, 0, EMA_Period, 0, MODE_EMA, PRICE_HIGH, prev_calculated);
You returned rates_total, what bar are you reading?
-
Arrays must be manually sized. They have no direction. You must move elements if you want a stack/as-series (set non-series, enlarge the array, set as-series).
-
Buffers are automatically size, are as-series, and elements are moved for you, new elements are set to EMPTY_VALUE (or your designated. They can also draw on the chart automatically.
-
In MT4, buffers and MT4 predefined arrays are all ordered AsSeries. There is a difference between the arrays passed to OnCalculate (e.g. low[]) and the MT4 predefined variables (e.g. Low[].) The passed arrays have no default direction, just like MT5.
To determine the indexing direction of time[], open[], high[], low[], close[], tick_volume[], volume[] and spread[], call ArrayGetAsSeries(). In order not to depend on default values, you should unconditionally call the ArraySetAsSeries() function for those arrays, which are expected to work with.
Event Handling Functions - Functions - Language Basics - MQL4 Reference -
int ticket = OrderSend(NULL, OP_BUY, Lots, ask, 3, stopLoss, takeProfit, "Long position", 0, clrNONE);
Indicators can not trade.
Be careful with NULL.
- On MT4, you can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not, OrderSend does not.
- Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
- Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
- MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
- Cloud Protector Bug? - MQL4 programming forum (2020)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
This is my script.
When I compile it said 2 warnings "possible loss of data due to type conversion Double EMAs Gold Digger.mq4 55 27" and "possible loss of data due to type conversion Double EMAs Gold Digger.mq4 56 27", any suggestions to fix this?