Help Needed to Create an MT5 Expert Advisor with Heiken Ashi Smoothed

 

Hi everyone,

I’m working on creating an Expert Advisor (EA) in MT5 that uses the Heiken Ashi Smoothed indicator. Here's what I want the EA to do:

  • Open a long position when the Heiken Ashi Smoothed candle is green.
  • Open a short position when the Heiken Ashi Smoothed candle is red.

I’m new to coding EAs and need help with the following:

  1. How to access the Heiken Ashi Smoothed indicator values in MT5.
  2. Implementing the logic for detecting candle colors (green/red).

If anyone has experience with something similar or can point me to useful tutorials or resources, I’d greatly appreciate it!

Thanks for your help!

 
I am sending you my bot written in MQL5 along with the indicator(HEKENSSS), but the bot is not opening positions due to error 4756. The bot is trying to open positions at the right moment, but this error occurs. When I open a position manually, everything works fine, and other bots function as expected, only this one is not working.
Files:
HEKENSSS.mq5  15 kb
bot.mq5  10 kb
 

This error is "unsupported filling mode" - it means that the selected filling mode is not supported by your broker- but as you've not explicitly set the filling mode, the default is not accepted. 

Search  "unsupported filling mode" on mql5.com and you'll find many threads.

A simple fix might be to add: request.type_filling = ORDER_FILLING_IOC; or request.type_filling = ORDER_FILLING_FOK; and see which one works on your demo account.

A more generic solution is to use SymbolInfoInteger(_Symbol, SYMBOL_FILLING_MODE); and select a supported mode.

This thread might help:  Order filling type problem. Help? - Trading Hours - Expert Advisors and Automated Trading - MQL5 programming forum

Order filling type problem. Help?
Order filling type problem. Help?
  • 2023.10.25
  • rrsch
  • www.mql5.com
Hey gang, I've been at this one for a couple hours with no success yet. I've tried 2 brokers so far with the EA I'm porting over from MT4...