Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I am trying to learn how to programme my own expert advisor, i am sure you will all be shocked at how simple this code is but I am learning so please help me and point out where I am going wrong.
I have an indicator that I use, super_signals_v2_Alert.mq4, this paints green or red buy and sell signals and then sound an alert. When a green signal is painted I would like to open a long market order at the open of the next bar.
When a red signal is painted I would like to open a shoprt market entry at the open of the next bar.
If a long position is open and anotherr signal is painted in the same direction, it is ignored, only 1 trade open in any direction at any time.
If an opposing signal sounds then this closes the trade. I would like to have an option to have the EA always in the market so reverse when an opposing signal is triggered.
I have been trying to get this right but I am having no luck...
Here is what I have so far but I am not sure if the condition to open and close is correct as per the indicator as it doesnt open trades when the indicator alarms, it only buys and opens multiple trades in the same direction.
#include <stdlib.mqh>
extern double downtrend;// downtrend=iCustom(NULL,0,"super_signals_v2_alert",1,0); ???
extern double uptrend; // uptrend=iCustom(NULL,0,"super_signals_v2_alert",0,0); ???
extern int dist2=21;
extern int SignalBar=1;
input double lots=3;
input double TakeProfit=550;
int OpenOrders=0, cnt=0;
int start()
{
int downtrend = iHighest(NULL,0,MODE_HIGH,dist2,SignalBar-dist2/2);
int uptrend = iLowest(NULL,0,MODE_LOW,dist2,SignalBar-dist2/2);