QUESTION: DEMO EA/Scripts

 

Hello everyone,

This may be a simple question, but I am new to programming MQL4 and appreciate the patience.


I have conducted a script to take a trade, and the compilation said 0 errors. However when I add it to the chart, nothing happens. The journal records it successfully, but no trade is taken.


One deduction that came to mind is:


Can DEMO accounts run EA/Scripts or must you use a live account.


If anyone has any other input, I would greatly appreciate it.


Warmest regards,


ZRC

 
I never had problems runing script in demo. Better simply post script code so others can se it. I have had such problems with my EA-problem was with incorrect currency pairs, also incorect lot size,insuciffient fundings and so on,so check those parameters. Also make a line which returs possible error code after Ordersend.
 

Hey Sanitars!

Thank you for the response.

I did put in a code to see last error, it was 4109 (Trade is not allowed). But the true answer I wanted is that you can run these on the demo?

I apologize, but I prefer not to show the source code for this particular EA.


Warmest regards,


ZRC

 

This is script from the book for placing orders in the market, and still after compiled and no errors, it comes back as (TRADE NOT ALLOWED)

<<<<CODE REMOVED>>>>>
 
ZacharyRC:

This is script from the book for placing orders in the market, and still after compiled and no errors, it comes back as (TRADE NOT ALLOWED)

<CODE REMOVED>

Please edit your post . . . 


Please use this to post code . . . it makes it easier to read.

 
ZacharyRC:

This is script from the book for placing orders in the market, and still after compiled and no errors, it comes back as (TRADE NOT ALLOWED)

Did you look up the error in the Documentation ?   

ERR_TRADE_NOT_ALLOWED4109Trade is not allowed. Enable checkbox "Allow live trading" in the expert properties.

 

Did you "Allow live trading" in MT4 ?

MT4 allow live trading 

 
ZacharyRC:

This is script from the book for placing orders in the market, and still after compiled and no errors, it comes back as (TRADE NOT ALLOWED)

Why do you Alert an error if there isn't one ?  you should check if OrderSend() worked or failed and if it failed then Alert(), Print() or Comment()  the information,  including the Error number and also maybe Bid, Ask, order type, etc. etc.

Read this for more info:   What are Function return values ? How do I use them ?

 
RaptorUK:

Why do you Alert an error if there isn't one ?  you should check if OrderSend() worked or failed and if it failed then Alert(), Print() or Comment()  the information,  including the Error number and also maybe Bid, Ask, order type, etc. etc.

Read this for more info:   What are Function return values ? How do I use them ?


Dear Raptor UK,



I fear I had too little sleep last night and was "looping" myself. I had not clicked "allow live trading" on my demo MT4 terminal.


Thank you for the support,


ZRC

Reason: