- nati2009: i run my EA at real account at MQL4 and the EA dosnt make a trade when he wes should (
That is because it is broken.
-
ordershort=OrderSend(NULL,OP_SELL,optimall…
Be careful with NULL.
- On MT4, you can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not, OrderSend does not.
- Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
- Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
- MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
- Cloud Protector Bug? - MQL4 programming forum 2020.07.25
Thank you for your answer
soo every place that i worth "NULL" i need to change to "_Symbol" and every place i worth "0" i need to change to "_Period" ?
why at the back test its was work good despite i worth "NULL" and " 0 "
also , i wrote a quote that give me outpot if there is any error with the ordersend and i didnt get any error or alert
ordershort=OrderSend(NULL,OP_SELL,optimallotsize(percentloss,Bid,stoplossshort),Bid,20,stoplossshort,takeprofitshort,NULL,magicNMshort); if(ordershort<0) { Alert("order faild error = " + GetLastError()); } else { Alert("order was sent"); }
IF you are not getting any alert then obviously the OrderSend() is not being executed.
You should check the conditions that should execute the above block of code
All the conditions above the block was ok
as i said, i check this trade with back test and the trade was executed
No they are not.
No they are not.
so i ask again
why at the back test the trade was executed and at the real time is not ?
to only reason i see its like the previos commant was that i use "NULL" insted " _Symbol"
so i ask again
why at the back test the trade was executed and at the real time is not ?
to only reason i see its like the previos commant was that i use "NULL" insted " _Symbol"
someone have answer please ?
"Doesn't work" is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
How To Ask Questions The Smart Way. 2004
When asking about code
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.
Always post all relevant code.
How To Ask Questions The Smart Way. 2004
Be precise and informative about your problem
We can't see your broken code.
Fix your broken code.
With the information you've provided — we can only guess. And you haven't provided any useful information for that.
"Doesn't work" is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
How To Ask Questions The Smart Way. 2004
When asking about code
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.
Always post all relevant code.
How To Ask Questions The Smart Way. 2004
Be precise and informative about your problem
We can't see your broken code.
Fix your broken code.
With the information you've provided — we can only guess. And you haven't provided any useful information for that.
What i ask is there any familiar reason why at back test the EA make trade and at real time it dosent make any trade ? maybe something at the options ?
as i said before i
the "Auto trading " and "Allow live trading " is on
also , there is happy smiling at the top right corner ( As i know that mean that the EA allowed to work)
What i ask is there any familiar reason why at back test the EA make trade and at real time it dosent make any trade ? maybe something at the options ?
as i said before i
the "Auto trading " and "Allow live trading " is on
also , there is happy smiling at the top right corner ( As i know that mean that the EA allowed to work)
Hi Nati2009,
I had the same issue with one of my accounts only to find out that my Broker blocked my account from using Expert Advisors.
Use the following code to see if you are allowed to use an expert advisor on your account.
bool AccountTradeExpert = AccountInfoInteger (ACCOUNT_TRADE_EXPERT);//Is Expert Advisor allowed on my account true/false? Comment ("Is EA allowed:",AccountTradeExpert);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi
i run my EA at real account at MQL4 and the EA dosnt make a trade when he wes should ( this is my first time that i run any EA at real time )
i run the EA at back test and he made the trade
the "Auto trading " and "Allow live trading " is on
also , there is happy smiling at the top right corner
also , i worte a quote that give me outpot if there is any error with the ordersend and i didnt get any error or alert
there is any option that i need to change at metatrader platform ? again at back test its work
the send order quote