Download MetaTrader 5
To add comments, please log in or register
Write articles, help other developers and make money
Dominic Gilbert
1632
Dominic Gilbert 2014.03.19 21:41 
Quick one; is it possible to manually close trades whilst back-testing MQL4 code in MT4?

In a nut-shell, I am wanting to do a hybrid of automation and manual trading. It's so hard to write what I want in code, but I can easily manually close the trade out. Does MT4 facilitate this option whilst in strategy tester?

Cheers.
qjol
3243
qjol 2014.03.19 22:22  
i check it out a few years back, as far as i know metatrader didn't change since and doesn't offer this luxury ;-) but i came up with a tricky solution
and it can be done
Dominic Gilbert
1632
Dominic Gilbert 2014.03.19 23:09  
No way! You can't leave me hanging with being vague :)

What's this solution? Could you point me in the right direction at least :)
Keith Watford
Moderator
7862
Keith Watford 2014.03.19 23:20  

The only way that I think this is possible is to have the EA set Global Variables when it places a trade

Then you can press F3 and modify the variable

Then the EA reads the variable and acts accordingly

Dominic Gilbert
1632
Dominic Gilbert 2014.03.19 23:25  
That's a clever idea^ thanks!

Would be so awesome if they allowed you to manually close the trade. Funny why it's not already a functionality of ST...
qjol
3243
qjol 2014.03.19 23:55  
DomGilberto:

No way! You can't leave me hanging with being vague :)

oh ye of cource i'm gonna leave you hung LOL

What's this solution? Could you point me in the right direction at least :)

why not my pleasure


i created objects like this:

ObjectCreate("HLineBuy1", OBJ_HLINE, ....
ObjectCreate("ArrowBuy", OBJ_ARROW, ....
ObjectCreate("HLineBuy2", OBJ_HLINE, ....

ObjectCreate("HLineSell1", OBJ_HLINE, ....
ObjectCreate("ArrowSell", OBJ_ARROW, ....
ObjectCreate("HLineSell2", OBJ_HLINE, ....


And use it By moving the arrow up and down (above and below the right line)

if (ArrowBuy > HLineBuy1)
   open Buy Position
if (ArrowBuy < HLineBuy2)
   close Buy Position

if (ArrowSell > HLineSell1)
   open Sell Position
if (ArrowSell < HLineSell2)
   close Sell Position
/
To add comments, please log in or register