[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 183

 

I understand thatMQL4cannot be mastered so quickly .It's just that now there is a specific problem that I can't solve at this stage. That's why I decided to ask for help from the forum participants. I'm not asking to write the entire EA, just a couple of lines - opening and closing. I really need it.

 
daytrader19:

I understand thatMQL4cannot be mastered so quickly .It's just that now there is a specific problem that I can't solve at this stage. That's why I decided to ask for help from the forum participants. I'm not asking to write the entire EA, just a couple of lines - opening and closing. I really need it.


And you can't do without a couple of lines here.
 
daytrader19:
I cannot write the part of the code that is responsible for closing and opening positions, i.e. I cannot formulate the trading criteria correctly.

Well, you write it yourself and we will correct it, ask what you don't understand

 
daytrader19:
Just a couple of weeks ago I started studying MQL4. I have started to write my first Expert Advisor to fix the theory in practice. Anyway, I face one problem. I chronically cannot write the part of the code responsible for position closing and opening, i.e. I cannot formulate trade criteria correctly. I cannot do it and I cannot do it at all.

So, I decided to ask for help. I just need to write a couple of lines of code.
I hope I will find some kind people here.



Trading criteria are as follows:
1. Formation of a buy signal from Stochastic. Stochastic signals are taken into account only when its two lines cross in the overbought/oversold zone.
2. at the same time (this is important - the signals should be synchronous) the signal is generated by Envelopes. For the signal to be treated as a "correct" one, the price must either break one of the Envelopes lines or at least touch it (i.e. it does not matter if it is close, high, or low; one candle breaks through or three - any break).
3. Confirmation by the Parabolic. Opening of the position. As soon as new Parabolic signal appears, confirming the trend direction - we open immediately.
Reverse Parabolic signal. Close the position. Upon receiving a reverse signal, the position should be closed immediately, and until this time we are in the market.

In this case, the close was immediately followed by a signal to open - it is normal and the position is opened, because the Stochastic and Envelopes signals were "correct" and Parabolic confirmed it.

Very, very, very much please help. I have no problems with writing a couple lines of code for an experienced programmer, but for me it's a very difficult task.


You should at least for fun open a textbook on this page and read the contents.

Start cooking yourself and we'll give you a hint...

 

Folks, I can't figure out why OrderModify() doesn't draw sticks when it modifies an order:

bool Ans_Mod OrderModify(Ticket, Price, SL, TP, Green);
   if (Ans_Mod == true)
      Print("Modifyed");
I don't know what to think anymore. Can't this function draw on the chart?
 
ScioMe:

Folks, I can't figure out why OrderModify() doesn't draw sticks when it modifies an order:

It's supposed to draw green, but it doesn't. I don't know what to think, can't this function draw on a chart?

bool Ans_Mod=OrderModify(Ticket, Price, SL, TP, Green);
   if (Ans_Mod == true)
      Print("Modifyed");

I should have put an equal sign on it?
 
todem:

I should have put an equal sign on it, shouldn't I?

That's the point, the equal sign (==) is already there! If you mean a single = sign, it's an assignment sign. In the log there are messages - and lots of them - that an order was modified. These are tester messages, not mine, i.e. not initiated by me using commands like Alert(), Print() or Comment(). And in the "Results" tab of the tester, there's also a record that the order was modified. But no markers were placed, and they still are not! I have been trying to figure it out for 2 days already! I'm starting to wonder what the secret might be, some kind of hocus-pocus!!!
 
I think the arrow is drawn on the bar with the opening time of the order, do you check it?
 
what does the error mean expression on global scope not allowed
 
ScioMe:

That's the point, the equal sign (==) is already there! If you mean the single = sign, it's an assignment sign. There are messages in the log - and numerous ones - that such-and-such order was modified. These are tester messages, not mine, i.e. not initiated by me with commands like Alert(), Print() and Comment(). And in the "Results" tab of the tester, there's also a record that the order was modified. But no markers were placed, and they still are not! I have been trying to figure it out for 2 days already! I am starting to wonder what the secret may be, some kind of hocus-pocus!!!

I mean the first line - you posted "no assignment sign"
Reason: