forexwinter: Firstly, Im new to this forum, so hopefully this is the right section to post.
After compiling, the toolbox says, at line 41, "return value of OrderSend should be checked" ..please, what does this mean? Yes, OrderSend does return an integer value, particularly the ticket number of the order, but why would I want it to be checked? Wont I see the ticket number in my terminal? Most importantly though, the EA doesnt seem to open any orders at all... whats wrong? | Welcome
|
Thank you for your response :)
For now, I would just like to get a buy order opened.
For the beggining I will keep it simple with just a plain condition of one over other, so MA1>MA2
Shouldnt my code open a buy order if that condition is true, and there is no other order open at the moment?
I know Im not making some adjustments for 4/5 digit brokers and JPY pairs, for now this will be tested only on EURUSD., with a 5 digit broker. The aim of this EA is not profitability or super-functioning across JPY pairs, I would just like to open a buy order when MA1>MA2, and have no more than 1 order at a time (this is a 1st time coding test EA :) ).
The NULL in my OrderSend is for the "const string comment=NULL" part. Since I dont want any comment, I just kept NULL there, ..is that wrong for some reason?
Therefore, I dont really get what I messed up.. (maybe the MA variables can be under OnTick, yes, or some other details now and there modified).. but I dont get why this doesnt open orders when I think code-wise I have written everything correctly... If you see any syntax errors.. or where does it simply go wrong? (if there would be syntax errors, I guess it wouldnt compile? )
Thank you :)
Change this ... OrderSend(Symbol(), OP_BUY, LOTS,Ask,1,Ask+StopLoss*Point, Ask+TakeProfit*Point, NULL,0, 0,clrNONE); To this ... OrderSend(Symbol(), OP_BUY, LOTS,Ask,10,Bid-StopLoss*Point, Ask+TakeProfit*Point, NULL,0, 0, Blue);
forexwinter: Shouldnt my code open a buy order if that condition is true, and there is no other order open at the moment? The NULL in my OrderSend is for the "const string comment=NULL" part. Since I dont want any comment, I just kept NULL there, ..is that wrong for some reason? Therefore, I dont really get what I messed up.. (maybe the MA variables can be under OnTick, yes, or some other details now and there modified).. but I dont get why this doesnt open orders when I think code-wise I have written everything correctly... If you see any syntax errors.. or where does it simply go wrong? (if there would be syntax errors, I guess it wouldnt compile? ) | Previously answered!
|
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Greetings,
Firstly, Im new to this forum, so hopefully this is the right section to post.
Secondly, I am new to coding and MQL4. I have read the book as well as the reference from MetaEditor and I do get the concepts. I tried to write a very basic EA, of a Moving Average Crossover, for now only opening buy orders. For some reason, when I put it into strategy tester, it doesnt seem to open any orders at all. Can someone please review my code and tell me whats wrong? Thank you.
After compiling, the toolbox says, at line 41, "return value of OrderSend should be checked" ..please, what does this mean? Yes, OrderSend does return an integer value, particularly the ticket number of the order, but why would I want it to be checked? Wont I see the ticket number in my terminal?
Most importantly though, the EA doesnt seem to open any orders at all... whats wrong?
Thank you.