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**:
<img src='//babypips-discourse-media-production.s3.amazonaws.com/original/3X/1/e/1e6a87b22bb6617afa6611c4941e835a3def4386.png' width='690' height='331'>
And for a **Sell**:
<img src='//babypips-discourse-media-production.s3.amazonaws.com/original/3X/4/1/41e94f922727fb80550abcd242330a36e0ccb29f.png' width='690' height='448'>
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**:
<img src='//babypips-discourse-media-production.s3.amazonaws.com/original/3X/1/e/1e6a87b22bb6617afa6611c4941e835a3def4386.png' width='690' height='331'>
And for a **Sell**:
<img src='//babypips-discourse-media-production.s3.amazonaws.com/original/3X/4/1/41e94f922727fb80550abcd242330a36e0ccb29f.png' width='690' height='448'>
Aug 24, 2017 at 06:23
Oct 12, 2016からメンバー
855 投稿
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
*商用利用やスパムは容認されていないので、アカウントが停止される可能性があります。
ヒント:画像/YouTubeのURLを投稿すると自動的に埋め込まれます!
ヒント:この討論に参加しているユーザー名をオートコンプリートするには、@記号を入力します。