input ENUM_APPLIED_PRICE Source1
You already know what the problem is. You haven't declared Source1 as an array. Source1 is the constant zero (PRICE_CLOSE).
Use your Source1, to read the current and previous price.
I am trying to set conditions for long and Short
In this code, Source1 is an input and its set to close.
input ENUM_APPLIED_PRICE Source1 = PRICE_CLOSE;
All others are Array. Declared as follows.
The problem is when i compile it shows Error at" Source1[i-1] ".
Can Anyone help me to solve this error. I am a newbie to MQL5.
It seems that you do not understand well how to distinguish data types
Read the basics again
You can compare an array data type with a normal data type in MQL5 programming language by using the ArrayCompare function. This function returns the result of comparing two arrays of simple types or custom structures without complex objects³.
I hope this helps!
(1) Array Functions - MQL5 Reference - Reference on algorithmic/automated .... https://www.mql5.com/en/docs/array.
(2) Data Types - Language Basics - MQL5 Reference - Reference on .... https://www.mql5.com/en/docs/basis/types.
(3) Structures, Classes and Interfaces - Data Types - MQL5. https://www.mql5.com/en/docs/basis/types/classes.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am trying to set conditions for long and Short
In this code, Source1 is an input and its set to close.
input ENUM_APPLIED_PRICE Source1 = PRICE_CLOSE;
All others are Array. Declared as follows.
The problem is when i compile it shows Error at" Source1[i-1] ".
Can Anyone help me to solve this error. I am a newbie to MQL5.