Expert Advisor to control multiple indicators - page 2

 
ihsany87:
Then, I just thought that my code is working. Actually, there are also some errors in my each indicators' code. I tried to debug with Print() but I didnt do it. Can you tell me how print works during debug. Where can I see the print's output ?

Oh dear ...

MetaTrader 4 > Terminal Window Ctrl + T > expert tab.

 
When it closed the sell order, it shouldnt open sell order again, it should only open buy order. Same thing is for take profit.
 
onewithzachy:

Oh dear ...

MetaTrader 4 > Terminal Window Ctrl + T > expert tab.

Indeed . . .

Or if you are using the Strategy Tester you need to look in the Journal and/or the tester/logs folder for the log file.

 
ihsany87:
When it closed the sell order, it shouldnt open sell order again, it should only open buy order. Same thing is for take profit.
Just because compiler says OK that does not mean your logic is OK.
 

I know I know, what I wrote in here seems to be like an epic fail :D

But please tolerate my amateurishness :)))

I started to write he mql4 for 1 week and I really need you guys' help to love the mql4 I really wanna train myself on this language.

 
ihsany87:
I'm newbie on writing mql4 therefore I wrote some codes as I see from somewhere. You are right nTicket is an int I shouldnt do this like that. But I just used it like that because compiler did not give any error and I thought it was okay. Secondly, I saw that there are two different types of close order with Ask and Bid and I thought that I should use both of them to close order. One of them is enough to close order ?

A Buy order is opened at Ask, a Sell at Bid . . . to close a Buy order a Sell is used so a Buy is closed at Bid . . . a Sell is closed at Ask. If you are trying to close a Buy your first line of code will generate an error . . . if you are trying to close a Sell it will be close by the first line of code . . the 2nd will then generate an error because the order it is trying to close has already been closed . . .

Use one line of code, don't use Bid or Ask . . . use OrderClosePrice() . . BUT . . make sure you have selected the order first using OrderSelect()

 
ihsany87:

I know I know, what I wrote in here seems to be like an epic fail :D

But please tolerate my amateurishness :)))

I started to write he mql4 for 1 week and I really need you guys' help to love the mql4 I really wanna train myself on this language.

There is no seem about it . . . but if you are really interested in learning then you can . . . read the Book <-- this is a link, please click it !
 
Thanks for the help I will try to my best :)
 
RaptorUK:
You have major problems with your code . . . can it pick up from where it left off if MT4 crashes ? you only select by ticket, when your EA starts it doesn't have the ticket number so it can't close anything until it places a new order . . . you don't report any errors, you have zero debugging Print() statements, all your Comment statements are commented out . . . .

Hi ihsany87,

It took me less than a minute to find syntax error in your code however I still don't understand the logic, - that's why I didn't reply immediately - Unless you can answer and explain my question on page 1.

I wish you good luck in learning mql, and do ask a question after reading the book and writing some code.

Reason: