Edit Your Comment
Can You Help Me With This EA
Aug 23, 2017 at 07:04
(एडिट हो रहा है Aug 21, 2017 at 15:49)
तबसे मेंबर है Aug 21, 2017
1 पोस्टों
Hello Everybody,
I am new here, I decided I would like to create an Expert Advisor. I am busy getting familiar with MQL5 and it is going great! I thought I would start of by creating a simple MA crossover EA, and so far so good.
**BUT**
The problem comes in when I need to open a trade.
I want my EA to only **BUY** if the candle stick after the MA cross _**closes**_ higher than the candle stick at the cross. and do the complete opposite for a **SELL**
I tried using **priceInfo[-1].close** but that obviously that doesn't work. ("_priceInfo_" is the array for mqlRates)
So could this be solved with logic ? Or is there a method that I can use ? And if so any help would be appreciated.
Just a visual explanation:
In other words this is what I would like for a **Buy**:

And for a **Sell**:
I am new here, I decided I would like to create an Expert Advisor. I am busy getting familiar with MQL5 and it is going great! I thought I would start of by creating a simple MA crossover EA, and so far so good.
**BUT**
The problem comes in when I need to open a trade.
I want my EA to only **BUY** if the candle stick after the MA cross _**closes**_ higher than the candle stick at the cross. and do the complete opposite for a **SELL**
I tried using **priceInfo[-1].close** but that obviously that doesn't work. ("_priceInfo_" is the array for mqlRates)
So could this be solved with logic ? Or is there a method that I can use ? And if so any help would be appreciated.
Just a visual explanation:
In other words this is what I would like for a **Buy**:

And for a **Sell**:

तबसे मेंबर है Oct 12, 2016
779 पोस्टों
Aug 24, 2017 at 06:23
तबसे मेंबर है Oct 12, 2016
779 पोस्टों
You should catch MA value in a handle and then, compare it with Candle price.
priceInfo[-1].close should be replaced by PriceInfo[1].close provided if you have sorted the elements using "ArraysetAsSeries()" as well as copied the price information using "CopyData"
You should do a little search for the exact sample code or I may post it in my next post.
priceInfo[-1].close should be replaced by PriceInfo[1].close provided if you have sorted the elements using "ArraysetAsSeries()" as well as copied the price information using "CopyData"
You should do a little search for the exact sample code or I may post it in my next post.
Artificial General Intelligence
तबसे मेंबर है Oct 12, 2016
779 पोस्टों
Aug 24, 2017 at 06:24
तबसे मेंबर है Oct 12, 2016
779 पोस्टों
A small correction to the above post, the price information should be copied using "CopyRates"
Artificial General Intelligence
तबसे मेंबर है Jul 11, 2011
38 पोस्टों
Aug 27, 2017 at 20:16
तबसे मेंबर है Jul 11, 2011
38 पोस्टों
I can help.....
To win you have to risk loss

*व्यवसायिक इस्तेमाल और स्पैम को ब्रदाश नहीं किया जाएगा, और इसका परिणाम खाता को बन्द करना भी हो सकता है.
टिप: किसी चित्र या यूट्यूब या URL को पोस्ट करने से वे अपने आप आपके पोस्ट में आजाएगा!
टिप: @ चिन्ह को टाइप करें उपभोगता के नाम को अपने आप करने के लिए जो इस चर्चा में भाग ले रहा है.